[Pkg-sysvinit-commits] r1705 - in sysvinit/trunk/debian: . initscripts/etc/init.d

Petter Reinholdtsen pere at alioth.debian.org
Thu Sep 3 15:19:56 UTC 2009


Author: pere
Date: 2009-09-03 15:19:56 +0000 (Thu, 03 Sep 2009)
New Revision: 1705

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/initscripts/etc/init.d/bootlogs
   sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh
   sysvinit/trunk/debian/initscripts/etc/init.d/hostname.sh
   sysvinit/trunk/debian/initscripts/etc/init.d/rmnologin
   sysvinit/trunk/debian/initscripts/etc/init.d/urandom
Log:
Implement status argument for scripts init.d/checkroot.sh,
init.d/hostname.sh, init.d/rmnologin and init.d/urandom.  Fix
typo in status handling in init.d/bootlogs.


Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2009-09-03 15:17:55 UTC (rev 1704)
+++ sysvinit/trunk/debian/changelog	2009-09-03 15:19:56 UTC (rev 1705)
@@ -100,7 +100,8 @@
     scripts on removal to follow policy and keep lintian happy, even
     though removing initscripts will leave the system unbootable.
     Update lintian overrides to reflect this.
-  * Implement status argument to init.d/bootlogs.
+  * Implement status argument to init.d/bootlogs, init.d/checkroot.sh,
+    init.d/hostname.sh, init.d/rmnologin and init.d/urandom.
 
  -- Kel Modderman <kel at otaku42.de>  Wed, 02 Sep 2009 02:03:12 +1000
 

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/bootlogs
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/bootlogs	2009-09-03 15:17:55 UTC (rev 1704)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/bootlogs	2009-09-03 15:19:56 UTC (rev 1705)
@@ -65,6 +65,7 @@
 	;;
   status)
 	do_status
+	exit $?
 	;;
   *)
 	echo "Usage: bootmisc.sh [start|stop]" >&2

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh	2009-09-03 15:17:55 UTC (rev 1704)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh	2009-09-03 15:19:56 UTC (rev 1705)
@@ -399,6 +399,28 @@
 	rm -f /lib/init/rw/rootdev
 }
 
+do_status () {
+	# If / is read-write or swap is enabled, this script have done
+	# its job.
+	rootrw=false
+	swapon=false
+	if [ -f /etc/mtab ] ; then
+	    if grep " / " /etc/mtab |grep -q rw ; then
+		rootrw=true
+	    fi
+	fi
+	if [ -f /proc/swaps ] ; then
+	    if [ "$(cat /proc/swaps |grep -v ^Filename)" ] ; then
+		swapon=true
+	    fi
+	fi
+	if [ true = "$rootrw" ] || [ true = "$swapon" ] ; then
+		return 0
+	else
+		return 4
+	fi
+}
+
 case "$1" in
   start|"")
 	do_start
@@ -410,6 +432,10 @@
   stop)
 	# No-op
 	;;
+  status)
+	do_status
+	exit $?
+	;;
   *)
 	echo "Usage: checkroot.sh [start|stop]" >&2
 	exit 3

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/hostname.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/hostname.sh	2009-09-03 15:17:55 UTC (rev 1704)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/hostname.sh	2009-09-03 15:19:56 UTC (rev 1705)
@@ -35,6 +35,15 @@
 	exit $ES
 }
 
+do_status () {
+	HOSTNAME=$(hostname)
+	if [ "$HOSTNAME" ] ; then
+		return 0
+	else
+		return 4
+	fi
+}
+
 case "$1" in
   start|"")
 	do_start
@@ -46,8 +55,14 @@
   stop)
 	# No-op
 	;;
+  status)
+	do_status
+	echo $?
+	;;
   *)
 	echo "Usage: hostname.sh [start|stop]" >&2
 	exit 3
 	;;
 esac
+
+:

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/rmnologin
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/rmnologin	2009-09-03 15:17:55 UTC (rev 1704)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/rmnologin	2009-09-03 15:19:56 UTC (rev 1705)
@@ -27,6 +27,14 @@
 	esac
 }
 
+do_status () {
+	if [ ! -f /var/lib/initscripts/nologin ] ; then
+		return 0
+	else
+		return 4
+	fi
+}
+
 case "$1" in
   start)
 	do_start
@@ -38,6 +46,10 @@
   stop)
 	# No-op
 	;;
+  status)
+	do_status
+	echo $?
+	;;
   *)
 	echo "Usage: $0 start|stop" >&2
 	exit 3

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/urandom
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/urandom	2009-09-03 15:17:55 UTC (rev 1704)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/urandom	2009-09-03 15:19:56 UTC (rev 1705)
@@ -20,6 +20,14 @@
 
 . /lib/lsb/init-functions
 
+do_status () {
+	if [ -f $SAVEDFILE ] ; then
+		return 0
+	else
+		return 4
+	fi
+}
+
 case "$1" in
   start|"")
 	[ "$VERBOSE" = no ] || log_action_begin_msg "Initializing random number generator"
@@ -37,6 +45,7 @@
 		cat "$SAVEDFILE" >/dev/urandom
 	fi
 	rm -f $SAVEDFILE
+	# Hm, why is the saved pool re-created at boot? [pere 2009-09-03]
 	umask 077
 	dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
 	ES=$?
@@ -52,6 +61,10 @@
 	ES=$?
 	[ "$VERBOSE" = no ] || log_action_end_msg $ES
 	;;
+  status)
+	do_status
+	exit $?
+	;;
   restart|reload|force-reload)
 	echo "Error: argument '$1' not supported" >&2
 	exit 3




More information about the Pkg-sysvinit-commits mailing list