]> mj.ucw.cz Git - libucw.git/blob - build/installer
Merge with git+ssh://cvs.ucw.cz/projects/sherlock/GIT/sherlock.git#v3.11
[libucw.git] / build / installer
1 #!/bin/sh
2 set -e
3 DEST=`eval echo $1`
4 echo "Installing to $DEST"
5 for d in "" cf $SH_EXTRA_RUNDIRS ; do
6         if [ ! -d $DEST/$d ] ; then
7                 echo "Creating $DEST/$d"
8                 mkdir -p $DEST/$d
9         fi
10 done
11 for d in $SH_INSTALL_RUNDIRS ; do
12         echo "Installing to $DEST/$d"
13         rm -rf $DEST/$d
14         mkdir -p $DEST/$d
15         cp -aL run/$d/* $DEST/$d/
16 done
17 echo "Installing config files..."
18 for a in $SH_CONFIGS ; do
19         if [ -f run/cf/$a ] ; then
20                 if [ ! -f $DEST/cf/$a ] ; then
21                         echo "cf/$a: new, installed"
22                         cp run/cf/$a $DEST/cf/$a
23                 elif [ $a = catalog-rules ] ; then
24                         echo "cf/$a: will be regenerated automatically"
25                 elif diff -u $DEST/cf/$a run/cf/$a ; then
26                         echo "cf/$a: no differences"
27                 else
28                         echo -n "cf/$a differs, replace it [Yn]? "
29                         read x
30                         if [ -z "$x" -o "$x" = "y" -o "$x" = "Y" ] ; then
31                                 echo "cf/$a: replacing and keeping the old version as cf/$a.old"
32                                 mv $DEST/cf/$a $DEST/cf/$a.old
33                                 cp run/cf/$a $DEST/cf/$a
34                         else
35                                 echo "cf/$a: installing the new version as cf/$a.dist"
36                                 cp run/cf/$a $DEST/cf/$a.dist
37                         fi
38                 fi
39         fi
40 done
41 echo "Done."