Initial version imported to CVS
[bbaumbach/samba-autobuild/.git] / source / script / installbin.sh
1 #!/bin/sh
2 INSTALLPERMS=$1
3 BASEDIR=$2
4 BINDIR=$3
5 LIBDIR=$4
6 VARDIR=$5
7 shift
8 shift
9 shift
10 shift
11 shift
12
13 for d in $BASEDIR $BINDIR $LIBDIR $VARDIR; do
14 if [ ! -d $d ]; then
15 mkdir $d
16 if [ ! -d $d ]; then
17   echo Failed to make directory $d
18   exit 1
19 fi
20 fi
21 done
22
23
24 for p in $*; do
25  echo Installing $p as $BINDIR/$p
26  if [ -f $BINDIR/$p ]; then
27    mv $BINDIR/$p $BINDIR/$p.old
28  fi
29  cp $p $BINDIR/$p
30  chmod $INSTALLPERMS $BINDIR/$p
31 done
32
33
34 cat << EOF
35 ======================================================================
36 The binaries are installed. You may restore the old binaries (if there
37 were any) using the command "make revert"
38 ======================================================================
39 EOF
40
41 exit 0
42