manual merge of the distrib/ part from a prerelease of 0.30.215
[util-vserver.git] / distrib / debian / initpost
index a5337c0..2acb7d0 100644 (file)
@@ -21,6 +21,7 @@
 cfgdir="$1"
 vdir="$cfgdir"/vdir
 . "$2"
+. "$_LIB_VSERVER_BUILD_FUNCTIONS"
 
 
 # vserver name
@@ -109,19 +110,7 @@ echo
 
 # start vserver before we can exec anything inside it
 $_VSERVER "$NAME" stop &>/dev/null || :
-$_VSERVER "$NAME" start --rescue --rescue-init bash -c '
-    exec  > /dev/null
-    exec 2> /dev/null
-
-    set -x
-    f=/tmp/startwait
-    trap "rm -f $f" EXIT
-    mkfifo $f
-    ( sleep 15; kill -s 9 -- -1 ) &
-    cat "$f"
-    kill -s 9 -- -1
-    wait
-'
+startSleepingGuest "$NAME" 30
 
 # run the configure commands from within the server
 export LANG=C LC_ALL=C
@@ -129,17 +118,25 @@ export LANG=C LC_ALL=C
 $_CHROOT_SH testfile /usr/sbin/locale-gen && \
     $_VSERVER "$NAME" exec /usr/sbin/locale-gen
 
-for i in bootlogd checkfs checkroot halt hwclock.sh ifupdown klogd \
-        libdevmapper1.02 makedev module-init-tools mountall.sh \
-        mountdevsubfs.sh mountnfs.sh mountkernfs.sh mountvirtfs \
-        networking reboot setserial single stop-bootlogd \
-        stop-bootlogd-single umountfs umountnfs.sh umountroot \
-        urandom; do
-    $_VSERVER "$NAME" exec update-rc.d -f "$i" remove
+have_halt=
+test "$(cat "$cfgdir"/apps/init/style 2>/dev/null)" != "plain" || \
+    have_halt=halt
+
+pushd etc/init.d &>/dev/null
+for i in *; do
+    case "$i" in
+      (sysklogd|syslog-ng|README|skeleton|sendsigs|single|rc|rc.local|rcS)
+       ;;
+      ($have_halt)
+       ;;
+      (*)
+       $_VSERVER "$NAME" exec update-rc.d -f "$i" remove
+       ;;
+    esac
 done
+popd &>/dev/null
 
 # stop the vserver
-$_VSERVER "$NAME" exec bash -c ': >/tmp/startwait' &>/dev/null || :
-$_VSERVER "$NAME" stop &>/dev/null || :
+stopSleepingGuest "$NAME" &>/dev/null || :
 
 popd &>/dev/null