]> mj.ucw.cz Git - libucw.git/blob - build/installer
ucw docs: Documented mempools
[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                         if [ -z "$SH_AUTO_CONFIRM" ] ; then
30                                 read x
31                         else
32                                 x="$SH_AUTO_CONFIRM"
33                                 echo "$x"
34                         fi
35                         if [ -z "$x" -o "$x" = "y" -o "$x" = "Y" ] ; then
36                                 echo "cf/$a: replacing and keeping the old version as cf/$a.old"
37                                 mv $DEST/cf/$a $DEST/cf/$a.old
38                                 cp run/cf/$a $DEST/cf/$a
39                         else
40                                 echo "cf/$a: installing the new version as cf/$a.dist"
41                                 cp run/cf/$a $DEST/cf/$a.dist
42                         fi
43                 fi
44         fi
45 done
46 echo "Done."