X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver-build.functions;h=5d6092df41f231b5ed81a96b08b9bc7b12f82009;hb=d644358f28547545a360401e4b3a5536dda53257;hp=7e26efdb4262e05c04001358e9645dcfefb6ca57;hpb=3c85c5195a01df54c16127f0c7e7f27a83acd4c3;p=util-vserver.git diff --git a/scripts/vserver-build.functions b/scripts/vserver-build.functions index 7e26efd..5d6092d 100644 --- a/scripts/vserver-build.functions +++ b/scripts/vserver-build.functions @@ -45,7 +45,6 @@ function makeDevEntry chmod $4 "$dst" ;; (l) ln -s "$4" "$dst" - test -z "$5" || chmod "$5" "$dst" ;; (*) echo "Unknown dev-entry mode '$3'" >&2 false @@ -156,6 +155,9 @@ function getDistribution if test -e /etc/fedora-release; then set -- $(cat /etc/fedora-release) DISTRIBUTION=fdr$4 + elif test -e /etc/mandrake-release; then + set -- $(cat /etc/mandrake-release) + DISTRIBUTION=mdv$4 elif test -e /etc/redhat-release; then set -- $(cat /etc/redhat-release) DISTRIBUTION=rh$5 @@ -200,7 +202,8 @@ function base._addGeneratedFile function base.initFilesystem { test -z "$1" || _renameVserverCfg - { isDirectoryEmpty "$VDIR" && test ! -e "$SETUP_CONFDIR"; } || colpanic $"\ + if test -n "$OPTION_SEMIFORCE"; then + { { test -n "$OPTION_SEMIFORCE" || isDirectoryEmpty "$VDIR" 1 } && test ! -e "$SETUP_CONFDIR"; } || colpanic $"\ vserver-topdirectory '$VDIR' and/or configuration at '$SETUP_CONFDIR' exist already; please try to use '--force', or remove them manually." @@ -223,9 +226,11 @@ WARNING: could not set the barrier attribute on '$VDIR/..', findAndCopy "$VDIR"/etc/hosts "$__CONFDIR"/.defaults/files/hosts "$__CONFDIR/.distributions/$DISTRIBUTION"/files/hosts \ "$__DISTRIBDIR/$DISTRIBUTION"/files/hosts "$__DISTRIBDIR"/defaults/files/hosts "" - for i in nsswitch.conf krb5.conf krb.conf krb.realms ldap.conf localtime resolv.conf; do + for i in nsswitch.conf krb5.conf krb.conf krb.realms ldap.conf localtime; do findAndCopy "$VDIR"/etc/$i "$__CONFDIR/.defaults/files/$i" "$__CONFDIR/.distributions/$DISTRIBUTION/files/$i" "" done + findAndCopy "$VDIR"/etc/resolv.conf "$__CONFDIR/.defaults/files/resolv.conf" \ + "$__CONFDIR/.distributions/$DISTRIBUTION/files/resolv.conf" /etc/resolv.conf "" } function base._initVariables @@ -241,11 +246,25 @@ function base._initVariables findFile BUILD_INITPOST "$__CONFDIR/.distributions/$DISTRIBUTION/initpost" "$__DISTRIBDIR/$DISTRIBUTION/initpost" "" } +declare -a __BASE_CLEANUP +function base.pushCleanup +{ + __BASE_CLEANUP=( "${__BASE_CLEANUP[@]}" "$*" ) +} + +function base.popCleanup +{ + unset __BASE_CLEANUP[$((${#__BASE_CLEANUP[@]} - 1))] +} + function base.__cleanup { - test -z "$OPTION_KEEP" || return 0 - test -z "$__BASE_SUCCESS" || return 0 + for cmd in "${__BASE_CLEANUP[@]}"; do + $cmd + done + test -z "$__BASE_SUCCESS" || return 0 + test -z "$OPTION_KEEP" || return 0 rm -rf "${__BASE_GENERATED_FILES[@]}" } @@ -272,11 +291,7 @@ function startSleepingGuest exec > /dev/null exec 2> /dev/null trap 'kill -s 9 -- -1; exit 0' INT - i=0 - while [ \$i -lt $timeout ]; do - sleep 1 - let ++i - done + sleep $timeout kill -s 15 -- -1 sleep 1 kill -s 9 -- -1"