SOURCES: kbd.init - use lockfiles to avoid restarted with runlevel...

glen glen at pld-linux.org
Sun Sep 17 16:00:31 CEST 2006


Author: glen                         Date: Sun Sep 17 14:00:31 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use lockfiles to avoid restarted with runlevel changes

---- Files affected:
SOURCES:
   kbd.init (1.26 -> 1.27) 

---- Diffs:

================================================================
Index: SOURCES/kbd.init
diff -u SOURCES/kbd.init:1.26 SOURCES/kbd.init:1.27
--- SOURCES/kbd.init:1.26	Fri Apr 28 13:12:45 2006
+++ SOURCES/kbd.init	Sun Sep 17 16:00:26 2006
@@ -25,10 +25,9 @@
 	exit 0
 fi
 
-case "$1" in
-  start|restart|reload|force-reload)
-	. /etc/sysconfig/console
+. /etc/sysconfig/console
 
+start() {
 	# Checking if we have framebuffer enabled
 	if [ -f /proc/fb ]; then
 		# /proc shows as files with size=0, this is workaround
@@ -48,7 +47,7 @@
 	# save old tty number
 	tty=`/usr/bin/tty | sed $pattern`
 	if [ "$tty" = "/dev/console" ]; then
-	    	tty=1
+		tty=1
 	fi
 
 	if [ -n "$CONSOLEFONT" -a -x /sbin/setsysfont ]; then
@@ -82,7 +81,7 @@
 
 			/usr/bin/switchto $tty
 		else
-		    	$CMD
+			$CMD
 		fi
 		ok
 	fi
@@ -123,11 +122,24 @@
 		/usr/bin/open -c $cons -s -w -- /usr/bin/setterm $setterm_option
 	done
 	/usr/bin/switchto $tty
-	
+}
+
+case "$1" in
+  start)
+	if [ ! -f /var/lock/subsys/console ]; then
+		start
+		touch /var/lock/subsys/console
+	fi
+	;;
+  restart|reload|force-reload)
+  	start
+	touch /var/lock/subsys/console
 	;;
   stop)
-	. /etc/sysconfig/console
-	run_cmd "Setting terminals to default values" /usr/bin/setterm -default
+	if [ -f /var/lock/subsys/console ]; then
+		run_cmd "Setting terminals to default values" /usr/bin/setterm -default
+		rm -f /var/lock/subsys/console
+	fi
 	;;
   status)
 	/usr/bin/setleds
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/kbd.init?r1=1.26&r2=1.27&f=u



More information about the pld-cvs-commit mailing list