first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
[kai/samba.git] / source3 / script / installbin.sh
1 #!/bin/sh
2
3 INSTALLPERMS=$1
4 BASEDIR=$2
5 BINDIR=$3
6 LIBDIR=$4
7 VARDIR=$5
8 shift
9 shift
10 shift
11 shift
12 shift
13
14 for d in $BASEDIR $BINDIR $LIBDIR $VARDIR; do
15 if [ ! -d $d ]; then
16 mkdir $d
17 if [ ! -d $d ]; then
18   echo Failed to make directory $d
19   exit 1
20 fi
21 fi
22 done
23
24
25 for p in $*; do
26  p2=`basename $p`
27  echo Installing $p as $BINDIR/$p2
28  if [ -f $BINDIR/$p2 ]; then
29    rm -f $BINDIR/$p2.old
30    mv $BINDIR/$p2 $BINDIR/$p2.old
31  fi
32  cp $p $BINDIR/
33  chmod $INSTALLPERMS $BINDIR/$p2
34
35  # this is a special case, mount needs this in a specific location
36  if [ $p2 = smbmount ]; then
37    ln -sf $BINDIR/$p2 /sbin/mount.smbfs
38  fi
39 done
40
41
42 cat << EOF
43 ======================================================================
44 The binaries are installed. You may restore the old binaries (if there
45 were any) using the command "make revert". You may uninstall the binaries
46 using the command "make uninstallbin" or "make uninstall" to uninstall
47 binaries, man pages and shell scripts.
48 ======================================================================
49 EOF
50
51 exit 0