]> mj.ucw.cz Git - libucw.git/blob - build/installer
Added an "install" target.
[libucw.git] / build / installer
1 #!/bin/sh
2 set -e
3 DEST=$1
4 echo "Installing to $DEST"
5 if [ ! -d $DEST/bin ] ; then
6         echo "Creating $DEST and the whole directory hierarchy under it."
7         mkdir -p $DEST/{bin,cf,db,index,log,tmp}
8 fi
9 echo "Installing binaries..."
10 rm -f $DEST/bin/*
11 cp run/bin/* $DEST/bin/
12 echo "Installing config files..."
13 for a in cf/* ; do
14         if [ -f $a ] ; then
15                 if [ ! -f $DEST/$a ] ; then
16                         echo "$a: new, installed"
17                         cp $a $DEST/$a
18                 elif diff -u $DEST/$a $a ; then
19                         echo "$a: no differences"
20                 else
21                         echo -n "$a differs, replace it [Yn]? "
22                         read x
23                         if [ -z "$x" -o "$x" == "y" -o "$x" == "Y" ] ; then
24                                 echo "$a: replacing and keeping the old version as $a.old"
25                                 mv $DEST/$a $DEST/$a.old
26                                 cp $a $DEST/$a
27                         else
28                                 echo "$a: installing the new version as $a.dist"
29                                 cp $a $DEST/$a.dist
30                         fi
31                 fi
32         fi
33 done
34 echo "Done."