X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvunify.old.sh;h=dde50b84c1a4502c978f6d0ca63d242bfd8b1103;hb=de30e2f29cedb2e048c68c409cdd567d668063a3;hp=50c960e883dc4e4fb5a780a201a5ea6b2c1eafb3;hpb=da691fd4bad5e187b307b7fd86bf5fd61e47c3fc;p=util-vserver.git diff --git a/util-vserver/scripts/vunify.old.sh b/util-vserver/scripts/vunify.old.sh index 50c960e..dde50b8 100755 --- a/util-vserver/scripts/vunify.old.sh +++ b/util-vserver/scripts/vunify.old.sh @@ -33,6 +33,13 @@ # administrators can't upgrade package as they see fit, since the # files are immutable. On the other end, just unifying glibc is probably # a win. +: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo "Can not find util-vserver installation; aborting..." + exit 1 +} +. "$UTIL_VSERVER_VARS" + if [ $# = 0 ] ; then echo vunify [ --undo ] ref-vserver vservers -- packages else @@ -61,7 +68,7 @@ else echo No package specified >&2 exit 1 else - if [ ! -d /vservers/$ref/. ] ; then + if [ ! -d $VROOTDIR/$ref/. ] ; then echo No vserver $ref >&2 exit 1 else @@ -73,7 +80,7 @@ else echo Extracting list of file to unify in $tmpfile for pkg in $* do - /vservers/$ref/bin/rpm --root /vservers/$ref -ql --dump $pkg | \ + $VROOTDIR/$ref/bin/rpm --root $VROOTDIR/$ref -ql --dump $pkg | \ while read path size mtime md5 \ mode owner group isconfig isdoc rdev symlink do @@ -88,22 +95,22 @@ else echo Unifying server $serv cat $tmpfile | while read file do - if [ ! -d /vservers/$ref/$file -a ! -L /vservers/$ref/$file ] ; then - ln -f /vservers/$ref/$file /vservers/$serv/$file + if [ ! -d $VROOTDIR/$ref/$file -a ! -L $VROOTDIR/$ref/$file ] ; then + ln -f $VROOTDIR/$ref/$file $VROOTDIR/$serv/$file fi done cat $tmpfile | while read file do - chattr +i /vservers/$ref/$file + chattr +i $VROOTDIR/$ref/$file done else echo Differencing server $serv cat $tmpfile | while read file do - chattr -i /vservers/$ref/$file - if [ ! -d /vservers/$ref/$file ] ; then - rm -f /vservers/$serv/$file - cp -a /vservers/$ref/$file /vservers/$serv/$file + chattr -i $VROOTDIR/$ref/$file + if [ ! -d $VROOTDIR/$ref/$file ] ; then + rm -f $VROOTDIR/$serv/$file + cp -a $VROOTDIR/$ref/$file $VROOTDIR/$serv/$file fi done fi