X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver-build.functions;h=55ee0438185be95c9272f44d907b2b60c551369f;hb=54edc50b584ade4f323c16bec6ef6320f129e531;hp=c89c5ad9c3f7e1da3402cdd541f3cb494ee398ff;hpb=2f0464efba2a0571561ad0aaa864a42cbd731d4c;p=util-vserver.git diff --git a/scripts/vserver-build.functions b/scripts/vserver-build.functions index c89c5ad..55ee043 100644 --- a/scripts/vserver-build.functions +++ b/scripts/vserver-build.functions @@ -44,6 +44,8 @@ function makeDevEntry (f) touch "$dst" chmod $4 "$dst" ;; + (l) ln -s "$4" "$dst" + ;; (*) echo "Unknown dev-entry mode '$3'" >&2 false ;; @@ -203,6 +205,9 @@ exist already; please try to use '--force', or remove them manually." mkdir -p -m755 "$VDIR" $_SETATTR --~barrier "$VDIR" + $_SETATTR --barrier "$VDIR"/.. || colwarn $"\ +WARNING: could not set the barrier attribute on '$VDIR/..', + please set it manually." base._addGeneratedFile "$VDIR" mkdir -p -m755 "$SETUP_CONFDIR"/apps "$VDIR"/etc @@ -217,9 +222,11 @@ exist already; please try to use '--force', or remove them manually." 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 @@ -235,11 +242,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[@]}" } @@ -261,7 +282,7 @@ function base.setSuccess function startSleepingGuest { local guest="$1" - local timeout="$2" + local timeout="${2:-15}" $_VSERVER "$guest" start --rescue --rescue-init bash -c " exec > /dev/null exec 2> /dev/null @@ -275,5 +296,5 @@ function startSleepingGuest function stopSleepingGuest { local guest="$1" - $_VKILL --xid "$guest" -s INT -- 1 + $_VSERVER "$guest" stop --rescue-init }