SOURCES: VirtualBox.init - add subsys locking for %post scriptlet

glen glen at pld-linux.org
Sun Mar 2 17:36:05 CET 2008


Author: glen                         Date: Sun Mar  2 16:36:05 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- add subsys locking for %post scriptlet

---- Files affected:
SOURCES:
   VirtualBox.init (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: SOURCES/VirtualBox.init
diff -u SOURCES/VirtualBox.init:1.2 SOURCES/VirtualBox.init:1.3
--- SOURCES/VirtualBox.init:1.2	Tue Jan 29 19:10:30 2008
+++ SOURCES/VirtualBox.init	Sun Mar  2 17:36:00 2008
@@ -19,38 +19,43 @@
 [ -f /etc/sysconfig/virtualbox ] && . /etc/sysconfig/virtualbox
 
 start() {
-	modprobe -s $VBOX_MODULE
-	# set proper /dev/vboxdrv for systems with static dev
-	if ! [ -d /dev/.udev/ ]; then
-		show "Setting $VBOX_DEVICE entry"
-		busy
-		rm -f $VBOX_DEVICE
-		VBOX_MAJOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/devices)
-		if [ -n "$VBOX_MAJOR" ]; then
-			VBOX_MINOR=0
-		else
-			VBOX_MINOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/misc)
-			if [ -n "$VBOX_MINOR" ]; then
-				VBOX_MAJOR=$(awk '$2 == "misc" {print $1}' /proc/devices)
+	if [ ! -f /var/lock/subsys/virtualbox ]; then
+		modprobe -s $VBOX_MODULE
+		# set proper /dev/vboxdrv for systems with static dev
+		if ! [ -d /dev/.udev/ ]; then
+			show "Setting $VBOX_DEVICE entry"
+			busy
+			rm -f $VBOX_DEVICE
+			VBOX_MAJOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/devices)
+			if [ -n "$VBOX_MAJOR" ]; then
+				VBOX_MINOR=0
+			else
+				VBOX_MINOR=$(awk '$2 == "vboxdrv" {print $1}' /proc/misc)
+				if [ -n "$VBOX_MINOR" ]; then
+					VBOX_MAJOR=$(awk '$2 == "misc" {print $1}' /proc/devices)
+				fi
+			fi
+			if [ -z "$VBOX_MAJOR" ]; then
+				/sbin/rmmod $VBOX_MODULE
+				fail
+			elif ! mknod -m 0660 $VBOX_DEVICE c $VBOX_MAJOR $VBOX_MINOR; then
+				rmmod $VBOX_MODNAME
+				fail
+			elif ! chown root:vbox $VBOX_DEVICE; then
+				fail
+			else
+				ok
 			fi
 		fi
-		if [ -z "$VBOX_MAJOR" ]; then
-			/sbin/rmmod $VBOX_MODULE
-			fail
-		elif ! mknod -m 0660 $VBOX_DEVICE c $VBOX_MAJOR $VBOX_MINOR; then
-			rmmod $VBOX_MODNAME
-			fail
-		elif ! chown root:vbox $VBOX_DEVICE; then
-			fail
-		else
-			ok
-		fi
+
+		touch /var/lock/subsys/virtualbox
 	fi
 }
 
 stop() {
 	# NOTE: rmmod will wait if device is in use, so automatic rmmod probably not the best idea
 	/sbin/rmmod $VBOX_MODULE
+	rm -f /var/lock/subsys/virtualbox
 }
 
 RETVAL=0
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/VirtualBox.init?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list