first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
[kai/samba.git] / source3 / script / installscripts.sh
index c27d41c36b5a84d4c4372096b767717f7aa66a9e..bff5423e7cb3b52c52cd59e8495b1a2a7434d569 100755 (executable)
@@ -1,8 +1,12 @@
 #!/bin/sh
 # this script courtesy of James_K._Foote.PARC@xerox.com
+# 5 July 96 Dan.Shearer@UniSA.Edu.Au  Don't hardcode script names, get from Make
+
 INSTALLPERMS=$1
 BINDIR=$2
-SRCDIR=$3
+
+shift
+shift
 
 echo Installing scripts in $BINDIR
 
@@ -11,16 +15,33 @@ for d in $BINDIR; do
   mkdir $d
   if [ ! -d $d ]; then
     echo Failed to make directory $d
+    echo Have you run installbin first?
     exit 1
   fi
  fi
 done
 
-cp ${SRCDIR}smbtar $BINDIR
-cp ${SRCDIR}addtosmbpass $BINDIR
-echo Setting permissions on scripts
-chmod $INSTALLPERMS $BINDIR/smbtar
-chmod $INSTALLPERMS $BINDIR/addtosmbpass
+for p in $*; do
+  p2=`basename $p`
+  echo Installing $BINDIR/$p2
+  if [ -f $BINDIR/$p2 ]; then
+    rm -f $BINDIR/$p2.old
+    mv $BINDIR/$p2 $BINDIR/$p2.old
+  fi
+  cp $p $BINDIR/
+  chmod $INSTALLPERMS $BINDIR/$p2
+  if [ ! -f $BINDIR/$p2 ]; then
+    echo Cannot copy $p2... does $USER have privileges?
+  fi
+done
+
+cat << EOF
+======================================================================
+The scripts have been installed. You may uninstall them using
+the command "make uninstallscripts" or "make install" to install binaries,
+man pages and shell scripts. You may recover the previous version (if any
+by "make revert".
+======================================================================
+EOF
 
-echo Scripts installed
 exit 0