[Pkg-sysvinit-commits] r203 - sysvinit/trunk/debian/initscripts/etc/init.d

Thomas Hood jdthood-guest at costa.debian.org
Mon Nov 21 13:46:55 UTC 2005


Author: jdthood-guest
Date: 2005-11-21 13:46:54 +0000 (Mon, 21 Nov 2005)
New Revision: 203

Modified:
   sysvinit/trunk/debian/initscripts/etc/init.d/mountvirtfs
Log:
Fix #338736 and further clean

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/mountvirtfs
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/mountvirtfs	2005-11-21 12:40:22 UTC (rev 202)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/mountvirtfs	2005-11-21 13:46:54 UTC (rev 203)
@@ -42,28 +42,20 @@
 KERNEL=`uname -s`
 umask 022
 
+# $1: file system type
+# $2: alternative file system type (or empty string if none)
+# $3: mount point
+# $4 and up: extra mount program options
 domount () {
 
-	# Directory present ?
-	if [ ! -d $3 ]
-	then
-		return
-	fi
-
-	# Do we support this filesystem type ?
+	# Figure out filesystem type
 	TYPE=
 	if [ "$1" = proc ]
 	then
 		case "$KERNEL" in
-		  Linux|GNU)
-			TYPE=proc
-			;;
-		  *FreeBSD)
-			TYPE=linprocfs
-			;;
-		  *)
-			TYPE=procfs
-			;;
+			Linux|GNU) TYPE=proc ;;
+			*FreeBSD)  TYPE=linprocfs ;;
+			*)         TYPE=procfs ;;
 		esac
 	elif grep -E -qs "$1\$" /proc/filesystems
 	then
@@ -72,14 +64,19 @@
 	then
 		TYPE=$2
 	fi
-	if [ "$TYPE" = "" ]
+
+	if [ ! "$TYPE" ]
 	then
+		if [ "$2" ]
+		then
+			log_warning_msg "Filesystem types '$1' and '$2' are not supported. Skipping mount."
+		else
+			log_warning_msg "Filesystem type '$1' is not supported. Skipping mount."
+		fi
 		return
 	fi
 
-	#
 	# Get the options from /etc/fstab.
-	#
 	OPTS=
 	if [ -f /etc/fstab ]
 	then
@@ -108,30 +105,31 @@
 		exec 0<&9 9<&-
 	fi
 
-	# See if anything is mounted yet
+	if [ ! -d $3 ]
+	then
+		log_warning_msg "Mount point '$3' does not exist. Skipping mount."
+		return
+	fi
+
 	if ! mountpoint -q $3
 	then
-		# No, do it now
 		mount $MOUNT_N -t $TYPE $OPTS $4 $TYPE $3
 	else
-		# Need to update mtab only ?
-		if [ -n "$DO_MTAB" ] &&
-		   ! grep -E -sq "^([^ ]+) +$3 +" /etc/mtab
+		# Only need to update mtab?
+		if [ -n "$DO_MTAB" ] && ! grep -E -sq "^([^ ]+) +$3 +" /etc/mtab
 		then
 			mount -f -t $TYPE $OPTS $4 $TYPE $3
 		fi
 	fi
 }
+
 do_start () {
-	#
-	# If /etc/mtab is a symlink into /proc/ then we assume
-	# it is not writable.
-	#
 	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
@@ -148,11 +146,11 @@
 		:> /etc/mtab
 	fi
 	
-	if selinux_enabled && [ -x /sbin/restorecon ] && [ -r /etc/mtab ]; then
+	if selinux_enabled && [ -x /sbin/restorecon ] && [ -r /etc/mtab ]
+	then
 		/sbin/restorecon /etc/mtab
 	fi
 
-	# Mount standard /proc and /sys.
 	domount proc "" /proc
 	domount sysfs "" /sys
 




More information about the Pkg-sysvinit-commits mailing list