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

Thomas Hood jdthood-guest at costa.debian.org
Thu Mar 16 19:47:34 UTC 2006


Author: jdthood-guest
Date: 2006-03-16 19:47:33 +0000 (Thu, 16 Mar 2006)
New Revision: 772

Modified:
   sysvinit/trunk/debian/initscripts/etc/init.d/umountfs
Log:
Eliminate subshell now that we aren't using the sort program any more.

Here is the diff with space changes ignored.

Index: umountfs
===================================================================
--- umountfs    (revision 771)
+++ umountfs    (working copy)
@@ -57,8 +57,8 @@


 do_stop () {
-       cat /proc/mounts |
-       (
+       exec 9<&0 </proc/mounts
+
                REG_MTPTS=""
                TMPFS_MTPTS=""
                while read DEV MTPT FSTYPE REST
@@ -81,6 +81,8 @@
                        esac
                done

+       exec 0<&9 9<&-
+
                #
                # Make sure tmpfs file systems are umounted before turning off
                # swap, to avoid running out of memory if the tmpfs filesystems
@@ -149,7 +151,6 @@
                                fi
                        fi
                fi
-       )
 }



Modified: sysvinit/trunk/debian/initscripts/etc/init.d/umountfs
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/umountfs	2006-03-16 19:37:41 UTC (rev 771)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/umountfs	2006-03-16 19:47:33 UTC (rev 772)
@@ -57,99 +57,100 @@
 
 
 do_stop () {
-	cat /proc/mounts | 
-	(
-		REG_MTPTS=""
-		TMPFS_MTPTS=""
-		while read DEV MTPT FSTYPE REST
-		do
-			case "$MTPT" in
-			  /|/proc|/dev|/.dev|/dev/pts|/dev/shm|/proc/*|/sys)
-				continue
-				;;
-			esac
-			case "$FSTYPE" in 
-			  proc|procfs|linprocfs|devfs|sysfs|usbfs|usbdevfs|devpts)
-				continue
-				;;
-			  tmpfs)
-				TMPFS_MTPTS="$TMPFS_MTPTS $MTPT"
-				;;
-			  *)
-				REG_MTPTS="$REG_MTPTS $MTPT"
-				;;
-			esac
-		done
+	exec 9<&0 </proc/mounts
+
+	REG_MTPTS=""
+	TMPFS_MTPTS=""
+	while read DEV MTPT FSTYPE REST
+	do
+		case "$MTPT" in
+		  /|/proc|/dev|/.dev|/dev/pts|/dev/shm|/proc/*|/sys)
+			continue
+			;;
+		esac
+		case "$FSTYPE" in 
+		  proc|procfs|linprocfs|devfs|sysfs|usbfs|usbdevfs|devpts)
+			continue
+			;;
+		  tmpfs)
+			TMPFS_MTPTS="$TMPFS_MTPTS $MTPT"
+			;;
+		  *)
+			REG_MTPTS="$REG_MTPTS $MTPT"
+			;;
+		esac
+	done
+
+	exec 0<&9 9<&-
 	
-		#
-		# Make sure tmpfs file systems are umounted before turning off
-		# swap, to avoid running out of memory if the tmpfs filesystems
-		# use a lot of space.
-		#
-		if [ "$TMPFS_MTPTS" ]
+	#
+	# Make sure tmpfs file systems are umounted before turning off
+	# swap, to avoid running out of memory if the tmpfs filesystems
+	# use a lot of space.
+	#
+	if [ "$TMPFS_MTPTS" ]
+	then
+		if [ "$VERBOSE" = no ]
 		then
-			if [ "$VERBOSE" = no ]
+			log_action_begin_msg "Unmounting temporary filesystems"
+			umount $TMPFS_MTPTS
+			log_action_end_msg $?
+		else
+			log_action_msg "Will now unmount temporary filesystems"
+			umount -v $TMPFS_MTPTS
+			ES=$?
+			if [ "$ES" = 0 ]
 			then
-				log_action_begin_msg "Unmounting temporary filesystems"
-				umount $TMPFS_MTPTS
-				log_action_end_msg $?
+				log_success_msg "Done unmounting temporary filesystems."
 			else
-				log_action_msg "Will now unmount temporary filesystems"
-				umount -v $TMPFS_MTPTS
-				ES=$?
-				if [ "$ES" = 0 ]
-				then
-					log_success_msg "Done unmounting temporary filesystems."
-				else
-					log_failure_msg "Unmounting temporary filesystems failed with error code ${ES}."
-				fi
+				log_failure_msg "Unmounting temporary filesystems failed with error code ${ES}."
 			fi
 		fi
+	fi
 
-		#
-		# Deactivate swap
-		#
+	#
+	# Deactivate swap
+	#
+	if [ "$VERBOSE" = no ]
+	then
+		log_action_begin_msg "Deactivating swap"
+		swapoff -a >/dev/null
+		log_action_end_msg $?
+	else
+		log_action_msg "Will now deactivate swap"
+		swapoff -a -v
+		ES=$?
+		if [ "$ES" = 0 ]
+		then
+			log_success_msg "Done deactivating swap."
+		else
+			log_failure_msg "Swap deactivation failed with error code ${ES}."
+		fi
+	fi
+
+	#
+	# Unmount local filesystems
+	#
+	if [ "$REG_MTPTS" ]
+	then
+		REG_MTPTS="$(pioodl $REG_MTPTS)"
 		if [ "$VERBOSE" = no ]
 		then
-			log_action_begin_msg "Deactivating swap"
-			swapoff -a >/dev/null
+			log_action_begin_msg "Unmounting local filesystems"
+			umount -f -r -d $REG_MTPTS
 			log_action_end_msg $?
 		else
-			log_action_msg "Will now deactivate swap"
-			swapoff -a -v
+			log_action_msg "Will now unmount local filesystems"
+			umount -f -v -r -d $REG_MTPTS
 			ES=$?
 			if [ "$ES" = 0 ]
 			then
-				log_success_msg "Done deactivating swap."
+				log_success_msg "Done unmounting local filesystems."
 			else
-				log_failure_msg "Swap deactivation failed with error code ${ES}."
+				log_failure_msg "Unmounting local filesystems failed with error code ${ES}."
 			fi
 		fi
-
-		#
-		# Unmount local filesystems
-		#
-		if [ "$REG_MTPTS" ]
-		then
-			REG_MTPTS="$(pioodl $REG_MTPTS)"
-			if [ "$VERBOSE" = no ]
-			then
-				log_action_begin_msg "Unmounting local filesystems"
-				umount -f -r -d $REG_MTPTS
-				log_action_end_msg $?
-			else
-				log_action_msg "Will now unmount local filesystems"
-				umount -f -v -r -d $REG_MTPTS
-				ES=$?
-				if [ "$ES" = 0 ]
-				then
-					log_success_msg "Done unmounting local filesystems."
-				else
-					log_failure_msg "Unmounting local filesystems failed with error code ${ES}."
-				fi
-			fi
-		fi
-	)
+	fi
 }
 
 case "$1" in




More information about the Pkg-sysvinit-commits mailing list