#! /bin/sh /usr/share/dpatch/dpatch-run
## 19_start-vserver_stop_fix.dpatch by Micah Anderson <Micah Anderson <micah@debian.org>>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fixes start-vservers --all --stop not actually stopping all vservers, just marked ones

@DPATCH@
diff -urNad trunk~/scripts/start-vservers trunk/scripts/start-vservers
--- trunk~/scripts/start-vservers	2006-03-20 08:16:45.000000000 -0500
+++ trunk/scripts/start-vservers	2006-04-16 00:20:46.000000000 -0400
@@ -88,6 +88,7 @@ eval set -- "$tmp"
 declare -a tmp_vservers=()
 declare -r TAB=$(echo -en "\t")
 OPTION_MARK=
+OPTION_MARK_ANY=1
 OPTION_PARALLEL=99
 OPTION_DEBUG=
 NOOPTION_DEBUG=1
@@ -104,7 +105,7 @@ while true; do
 	(--help)    	showHelp    $0 ;;
 	(--version) 	showVersion $0 ;;
 	(-c)		CONFDIR=$2;     shift;;
-	(-m)		OPTION_MARK=$2; shift;;
+	(-m)		OPTION_MARK=$2; OPTION_MARK_ANY=; shift;;
 	(-j)		OPTION_PARALLEL=$2; shift;;
 	(--start)	OPTION_FLAVOR=start;;
 	(--stop)	OPTION_FLAVOR=stop;;
@@ -129,6 +130,7 @@ while test $i -gt 0; do
     let --i
     d=$__CONFDIR/${vservers[$i]}/apps/init
     f=$d/mark
+    { test -n "$OPTION_MARK_ANY"; } || \
     { test -n "$OPTION_MARK" -a -r "$f" && grep -qx "$OPTION_MARK" "$f"; } || \
     { test -z "$OPTION_MARK" && test ! -e "$f"; } || \
     unset vservers[$i]
