SVN: rc-scripts/trunk/rc.d/init.d/allowlogin

glen glen at pld-linux.org
Wed Jul 21 10:23:10 CEST 2010


Author: glen
Date: Wed Jul 21 10:23:10 2010
New Revision: 11688

Modified:
   rc-scripts/trunk/rc.d/init.d/allowlogin
Log:
- functions, exit early if disabled

Modified: rc-scripts/trunk/rc.d/init.d/allowlogin
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/allowlogin	(original)
+++ rc-scripts/trunk/rc.d/init.d/allowlogin	Wed Jul 21 10:23:10 2010
@@ -6,25 +6,40 @@
 #
 # $Id$
 
+[ -f /etc/sysconfig/system ] && . /etc/sysconfig/system
+
+# exit early without loading big init.d functions
+case "$1" in
+start|restart|try-restart|reload|force-reload)
+	# Check value
+	case "$DELAY_LOGIN" in
+		yes|Yes|YES|true|True|TRUE|on|On|ON|Y|y|1)
+		;;
+	*)
+		exit 0
+		;;
+	esac
+esac
+
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	if is_yes "$DELAY_LOGIN" && [ -f /etc/nologin.boot ]; then
 		run_cmd "Allowing users to login" rm -f /etc/nologin /etc/nologin.boot
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	# /etc/nologin when shutting down system
 	if is_yes "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
 		nls "System shutdown in progress\n" > /etc/nologin
 		chmod 644 /etc/nologin
 		cp -fp /etc/nologin /etc/nologin.boot
 	fi
-	;;
-  status)
+}
+
+status() {
 	if is_yes "$DELAY_LOGIN"; then
 		nls "Delay login is enabled"
 	else
@@ -35,6 +50,18 @@
 	else
 		nls "Users are allowed to login right now"
 	fi
+}
+
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  status)
+	status
 	;;
   *)
 	msg_usage "$0 {start|stop|status}"


More information about the pld-cvs-commit mailing list