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

Thomas Hood jdthood-guest at costa.debian.org
Wed Jan 11 12:21:53 UTC 2006


Author: jdthood-guest
Date: 2006-01-11 12:21:52 +0000 (Wed, 11 Jan 2006)
New Revision: 582

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/initscripts/etc/init.d/mountdevsubfs
   sysvinit/trunk/debian/initscripts/etc/init.d/mountvirtfs
   sysvinit/trunk/debian/initscripts/lib/init/mount-functions.sh
Log:
Complete the mountdevsubfs split

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2006-01-11 11:38:55 UTC (rev 581)
+++ sysvinit/trunk/debian/changelog	2006-01-11 12:21:52 UTC (rev 582)
@@ -1,4 +1,4 @@
-sysvinit (2.86.ds1-10~8) experimental; urgency=low 
+sysvinit (2.86.ds1-10~9) experimental; urgency=low 
 
   [ Thomas Hood ]
   * rcS(5): Reword
@@ -10,6 +10,7 @@
     + Use ':', not the deprecated '.' between owner and group names
       in chown commands
     + Use '-o root' with install
+  * Complete the split of mountdevsubfs out of mountvirtfs
 
   [ Ubuntu backports by T.H. ]
   * During shutdown and reboot take the progress bar from 100 to 0

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/mountdevsubfs
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/mountdevsubfs	2006-01-11 11:38:55 UTC (rev 581)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/mountdevsubfs	2006-01-11 12:21:52 UTC (rev 582)
@@ -13,7 +13,7 @@
 # Script needs to be robust and continue when parts fail,
 # so we're NOT setting the "-e" option.
 
-PATH=/bin:/sbin
+PATH=/lib/init:/bin:/sbin
 TTYGRP=5
 TTYMODE=620
 [ -f /etc/default/devpts ] && . /etc/default/devpts

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/mountvirtfs
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/mountvirtfs	2006-01-11 11:38:55 UTC (rev 581)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/mountvirtfs	2006-01-11 12:21:52 UTC (rev 582)
@@ -20,50 +20,7 @@
 
 umask 022
 
-selinux_enabled () {
-	which selinuxenabled >/dev/null 2>&1 && selinuxenabled
-}
-
 do_start () {
-	#
-	# Initialize mtab
-	#
-	DO_MTAB=
-	MOUNT_N=-n
-	MTAB_PATH="$(readlink -f /etc/mtab || :)"
-	case "$MTAB_PATH" in
-	  /proc/*)
-		# Assume that /proc/ is not writable
-		;;
-	  /*)
-		# Only update mtab if it is writable
-		if touch "$MTAB_PATH" >/dev/null 2>&1
-		then
-			DO_MTAB=Yes
-			MOUNT_N=
-		fi
-		;;
-	  "")
-		[ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)"
-		if [ "$MTAB_PATH" ]
-		then
-			log_failure_msg "Cannot initialize ${MTAB_PATH}."
-		else
-			log_failure_msg "Cannot initialize /etc/mtab."
-		fi
-		;;
-	  *)
-		log_failure_msg "Illegal mtab location '${MTAB_PATH}'."
-		;;
-	esac
-	if [ "$DO_MTAB" ] && [ ! -f /etc/mtab ]
-	then
-		:> /etc/mtab
-	fi
-	if selinux_enabled && which restorecon >/dev/null 2>&1 && [ -r /etc/mtab ]
-	then
-		restorecon /etc/mtab
-	fi
 
 	#
 	# Mount proc filesystem on /proc

Modified: sysvinit/trunk/debian/initscripts/lib/init/mount-functions.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/lib/init/mount-functions.sh	2006-01-11 11:38:55 UTC (rev 581)
+++ sysvinit/trunk/debian/initscripts/lib/init/mount-functions.sh	2006-01-11 12:21:52 UTC (rev 582)
@@ -1,11 +1,13 @@
 #
 # Functions used by several mount* scripts in initscripts package
 #
-
+# Sourcer must set PATH and include /lib/init in it because
+# domount() uses the custom readlink program
+#
 # Sourcer must also source /lib/lsb/init-functions.sh
 
 # $1: directory
-initfunc_is_empty_dir() {
+is_empty_dir() {
 	for FILE in $1/* $1/.*
 	do
 		case "$FILE" in
@@ -18,11 +20,55 @@
 }
 
 
+selinux_enabled () {
+	which selinuxenabled >/dev/null 2>&1 && selinuxenabled
+}
+
+
 # $1: file system type
 # $2: alternative file system type (or empty string if none)
 # $3: mount point
-# $4 and up: extra mount program options
+# $4... : extra mount program options
 domount () {
+	DO_MTAB=""
+	MTAB_PATH="$(readlink -f /etc/mtab || :)"
+	case "$MTAB_PATH" in
+	  /proc/*)
+		# Assume that /proc/ is not writable
+		;;
+	  /*)
+		# Only update mtab if it is writable
+		if touch "$MTAB_PATH" >/dev/null 2>&1
+		then
+			DO_MTAB=y
+		fi
+		;;
+	  "")
+		[ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)"
+		if [ "$MTAB_PATH" ]
+		then
+			log_failure_msg "Cannot initialize ${MTAB_PATH}."
+		else
+			log_failure_msg "Cannot initialize /etc/mtab."
+		fi
+		;;
+	  *)
+		log_failure_msg "Illegal mtab location '${MTAB_PATH}'."
+		;;
+	esac
+
+	#
+	# Initialize mtab file if necessary
+	#
+	if [ "$DO_MTAB" ] && [ ! -f /etc/mtab ]
+	then
+		:> /etc/mtab
+	fi
+	if selinux_enabled && which restorecon >/dev/null 2>&1 && [ -r /etc/mtab ]
+	then
+		restorecon /etc/mtab
+	fi
+
 	MTPT="$3"
 	KERNEL="$(uname -s)"
 	# Figure out filesystem type
@@ -88,14 +134,22 @@
 	# We give file system type as device name
 	if mountpoint -q "$MTPT"
 	then
-		# Only need to update mtab?
+		# Already mounted
+		# Just update mtab, if possible and necessary
 		if [ "$DO_MTAB" ] && ! grep -E -sq "^([^ ]+) +$MTPT +" /etc/mtab
 		then
 			mount -f -t $FSTYPE $OPTS $4 $FSTYPE $MTPT
 		fi
 	else
-		initfunc_is_empty_dir "$MTPT" >/dev/null 2>&1 || log_warning_msg "Files under mount point '$MTPT' will be hidden."
-		mount $MOUNT_N -t $FSTYPE $OPTS $4 $FSTYPE $MTPT
+		# Not already mounted
+		is_empty_dir "$MTPT" >/dev/null 2>&1 || log_warning_msg "Files under mount point '$MTPT' will be hidden."
+		# Mount it, updating mtab if possible
+		if [ "$DO_MTAB" ]
+		then
+			mount -t $FSTYPE $OPTS $4 $FSTYPE $MTPT
+		else
+			mount -n -t $FSTYPE $OPTS $4 $FSTYPE $MTPT
+		fi
 	fi
 }
 




More information about the Pkg-sysvinit-commits mailing list