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