[packages/VirtualBox] vboxautostart: ui fixes, avoid subshells

glen glen at pld-linux.org
Wed Mar 5 11:20:20 CET 2014


commit 601fb33011b2c84b101ca7a692d6719854416a0a
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Wed Mar 5 12:20:07 2014 +0200

    vboxautostart: ui fixes, avoid subshells

 vboxautostart.init | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/vboxautostart.init b/vboxautostart.init
index 5e5c181..f9ce4cb 100755
--- a/vboxautostart.init
+++ b/vboxautostart.init
@@ -21,6 +21,7 @@ VBOXAUTOSTART=@INSTALL_DIR@/VBoxAutostart
 start_daemon() {
 	local user="$1"
 	shift
+	show "VMs for user '%s'" "$user"
 	daemon --user $user "$@"
 }
 
@@ -34,15 +35,16 @@ start() {
 	[ -z "$VBOXAUTOSTART_DB" ] && exit 0
 	[ -z "$VBOXAUTOSTART_CONFIG" ] && exit 0
 
-	msg_starting "VirtualBox VMs configured for autostart"
+	msg_starting "VirtualBox VMs configured for autostart"; busy; echo
 
-	local user PARAMS="--background --start --config $VBOXAUTOSTART_CONFIG"
+	local file user PARAMS="--background --start --config $VBOXAUTOSTART_CONFIG"
 
 	# prevent inheriting this setting to VBoxSVC
 	unset VBOX_RELEASE_LOG_DEST
 
-	for user in `ls $VBOXAUTOSTART_DB/*.start 2>/dev/null`; do
-		user=$(basename $user | sed -ne "s/\(.*\).start/\1/p")
+	for file in $VBOXAUTOSTART_DB/*.start; do
+		test -f "$file" || continue
+		user=${file##*/}; user=${user%.start}
 		start_daemon $user $VBOXAUTOSTART $PARAMS
 	done
 
@@ -59,15 +61,16 @@ stop() {
 	[ -z "$VBOXAUTOSTART_CONFIG" ] && exit 0
 
 	# Stop daemons.
-	msg_stopping "VirtualBox Autostart"
+	msg_stopping "VirtualBox Autostart"; busy; echo
 
-	local user PARAMS="--stop --config $VBOXAUTOSTART_CONFIG"
+	local file user PARAMS="--stop --config $VBOXAUTOSTART_CONFIG"
 
 	# prevent inheriting this setting to VBoxSVC
 	unset VBOX_RELEASE_LOG_DEST
 
-	for user in `ls $VBOXAUTOSTART_DB/*.stop 2>/dev/null`; do
-		user=$(basename $user | sed -ne "s/\(.*\).stop/\1/p")
+	for file in $VBOXAUTOSTART_DB/*.stop; do
+		test -f "$file" || continue
+		user=${file##*/}; user=${user%.stop}
 		start_daemon $user $VBOXAUTOSTART $PARAMS
 	done
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/VirtualBox.git/commitdiff/601fb33011b2c84b101ca7a692d6719854416a0a



More information about the pld-cvs-commit mailing list