eval $2=\$_vgst_tmp
}
+function vshelper.initStopSync
+{
+ local _iss_sync_dir=$($_MKTEMPDIR vshelper-stop-sync.XXXXXX) || {
+ warning $"Failed to generate directory for vshelper sync"
+ exit 1
+ }
+ $_MKFIFO -m700 "$_iss_sync_dir/pipe"
+
+ eval "$1"=\$_iss_sync_dir
+ VSHELPER_STOP_SYNC="$_iss_sync_dir/pipe"
+ export VSHELPER_STOP_SYNC
+}
+
+function vshelper.waitForStopSync
+{
+ local sync_dir=$1
+ cat "$sync_dir/pipe" &> /dev/null
+ rm -fr "$sync_dir"
+}
+
+function vshelper.doStopSync
+{
+ test ! -p "$VSHELPER_STOP_SYNC" || echo stopped > "$VSHELPER_STOP_SYNC"
+}
function _rpmFake.getCapFlags
{
"${INITCMD_STOP[@]}" || fail=1
fi
+vshelper.doStopSync
+
waitForSync "$VSERVER_DIR" "$sync_fifo" "$vwait_statdir"
vshelper.doDestroy "$VSERVER_DIR" "$S_CONTEXT"
case "$ACTION" in
(restart)
logging $"Restarting vserver '$VSERVER'"
- spawn killContext "$XID"
- execute $_VSERVER --defaulttty "$VSERVER" restart
+
+ local sync_dir
+ vshelper.initStopSync sync_dir
+
+ spawn $_VSERVER --defaulttty "$VSERVER" restart &
+
+ disown %%
+ vshelper.waitForStopSync "$sync_dir"
;;
(halt|poweroff)
logging $"Stopping vserver '$VSERVER'"
- spawn killContext "$XID"
- execute $_VSERVER --defaulttty "$VSERVER" stop
+
+ local sync_dir
+ vshelper.initStopSync sync_dir
+
+ spawn $_VSERVER --defaulttty "$VSERVER" stop &
+
+ disown %%
+ vshelper.waitForStopSync "$sync_dir"
;;
(swsusp)
## TODO: any senseful action here? Perhaps shutdown scheduler for it?