X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvserver-build.functions;h=b12a5d5792e9b82d63f7dad61037cbd8597318a8;hb=d45518897217889e8571d94d4459ee12c4db56a0;hp=7b341f4bee73948d7625c2a0360b8bf60b7fddc7;hpb=8a97fac7807c482d0bcac1a4d8e75874d163d1e1;p=util-vserver.git diff --git a/util-vserver/scripts/vserver-build.functions b/util-vserver/scripts/vserver-build.functions index 7b341f4..b12a5d5 100644 --- a/util-vserver/scripts/vserver-build.functions +++ b/util-vserver/scripts/vserver-build.functions @@ -34,12 +34,12 @@ function makeDevEntry { local dst=$1/$2 case "$3" in - c|b) mknod -m$6 "$dst" $3 $4 $5;; - d) mkdir -p -m$4 "$dst";; - f) touch "$dst" + (c|b) mknod -m$6 "$dst" $3 $4 $5;; + (d) mkdir -p -m$4 "$dst";; + (f) touch "$dst" chmod $4 "$dst" ;; - *) echo "Unknown dev-entry mode '$3'" >&2 + (*) echo "Unknown dev-entry mode '$3'" >&2 false ;; esac @@ -57,8 +57,8 @@ function populateDirectory for file in "$i"/*; do test -e "$file" || continue case "$file" in - */CVS) test ! -d "$file" || continue;; - *.rpmsave|*.rpmnew|*.rpmorig) + (*/CVS) test ! -d "$file" || continue;; + (*.rpmsave|*.rpmnew|*.rpmorig) continue;; esac @@ -79,7 +79,7 @@ function _setRootDir done test -d "$ROOTDIR" || { - echo "Root-directory '$ROOTDIR' does not exist or is invalid" + echo "Root-directory '$ROOTDIR' does not exist or is invalid" >&2 exit 1 } } @@ -128,8 +128,9 @@ function getDistribution set -- $(cat /etc/debian_version) DISTRIBUTION=deb$1 else - echo "Can not determine distribution; please specify it manually" - echo "with the '-d' option" + echo \ +"Can not determine distribution; please specify it manually +with the '-d' option" >&2 exit 1 fi >&2 } @@ -139,12 +140,15 @@ function base.initFilesystem { test -z "$1" || _renameVserverCfg test ! -d "$VDIR" -a ! -d "$SETUP_CONFDIR" || { - echo "vserver-topdirectory and/or configuration exist already; " - echo "please try to use '--force', or remove them manually" + echo \ +"vserver-topdirectory and/or configuration exist already; +please try to use '--force', or remove them manually" >&2 exit 1 } >&2 - mkdir -p "$SETUP_CONFDIR"/apps "$VDIR"/{dev/pts,etc} "$SETUP_LOCKREVDIR" + mkdir -p -m755 "$VDIR" + chattr -t "$VDIR" + mkdir -p -m755 "$SETUP_CONFDIR"/apps "$VDIR"/{dev/pts,etc} "$SETUP_LOCKREVDIR" ln -s "$VDIR" "$SETUP_CONFDIR/vdir" @@ -153,6 +157,7 @@ function base.initFilesystem makeDevEntry "$VDIR"/dev $spec done <$_DEV_FILE + mkdir -p "$VDIR"/proc findAndCopy "$VDIR"/etc/hosts "$CONFDIR"/.defaults/files/hosts "$CONFDIR/.distributions/$DISTRIBUTION"/files/hosts \ "$DISTRIBDIR/$DISTRIBUTION"/files/hosts "$DISTRIBDIR"/defaults/files/hosts ""