]> mj.ucw.cz Git - libucw.git/commitdiff
Added an "install" target.
authorMartin Mares <mj@ucw.cz>
Tue, 16 Jul 2002 21:54:51 +0000 (21:54 +0000)
committerMartin Mares <mj@ucw.cz>
Tue, 16 Jul 2002 21:54:51 +0000 (21:54 +0000)
build/installer [new file with mode: 0755]

diff --git a/build/installer b/build/installer
new file mode 100755 (executable)
index 0000000..607c9f7
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -e
+DEST=$1
+echo "Installing to $DEST"
+if [ ! -d $DEST/bin ] ; then
+       echo "Creating $DEST and the whole directory hierarchy under it."
+       mkdir -p $DEST/{bin,cf,db,index,log,tmp}
+fi
+echo "Installing binaries..."
+rm -f $DEST/bin/*
+cp run/bin/* $DEST/bin/
+echo "Installing config files..."
+for a in cf/* ; do
+       if [ -f $a ] ; then
+               if [ ! -f $DEST/$a ] ; then
+                       echo "$a: new, installed"
+                       cp $a $DEST/$a
+               elif diff -u $DEST/$a $a ; then
+                       echo "$a: no differences"
+               else
+                       echo -n "$a differs, replace it [Yn]? "
+                       read x
+                       if [ -z "$x" -o "$x" == "y" -o "$x" == "Y" ] ; then
+                               echo "$a: replacing and keeping the old version as $a.old"
+                               mv $DEST/$a $DEST/$a.old
+                               cp $a $DEST/$a
+                       else
+                               echo "$a: installing the new version as $a.dist"
+                               cp $a $DEST/$a.dist
+                       fi
+               fi
+       fi
+done
+echo "Done."