[Pkg-sysvinit-commits] r965 - in sysvinit/trunk/debian: . initscripts/lib/init

Petter Reinholdtsen pere at costa.debian.org
Sat Sep 23 16:57:34 UTC 2006


Author: pere
Date: 2006-09-23 16:57:33 +0000 (Sat, 23 Sep 2006)
New Revision: 965

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/initscripts/lib/init/mount-functions.sh
Log:
  * Rewrite post_mountall() function to avoid mounting /var/run/ and
    /var/lock/ on top of themselves when RAMRUN or RAMLOCK is enabled.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2006-09-23 13:36:04 UTC (rev 964)
+++ sysvinit/trunk/debian/changelog	2006-09-23 16:57:33 UTC (rev 965)
@@ -8,6 +8,8 @@
   * Add defaults/tmpfs option RW_SIZE to control the size of
     /lib/init/rw/, and change mountkernfs.sh to use TMPFS_SIZE too if
     it is set.
+  * Rewrite post_mountall() function to avoid mounting /var/run/ and
+    /var/lock/ on top of themselves when RAMRUN or RAMLOCK is enabled.
 
  -- Petter Reinholdtsen <pere at localhost>  Fri, 22 Sep 2006 23:26:33 +0200
 

Modified: sysvinit/trunk/debian/initscripts/lib/init/mount-functions.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/lib/init/mount-functions.sh	2006-09-23 13:36:04 UTC (rev 964)
+++ sysvinit/trunk/debian/initscripts/lib/init/mount-functions.sh	2006-09-23 16:57:33 UTC (rev 965)
@@ -136,22 +136,30 @@
 }
 
 #
-# Restore /var/run and /var/lock mountpoints
+# Restore /var/run and /var/lock mountpoints if something was mounted
+# as /var/.  Avoid mounting them back over themselves if nothing was
+# mounted as /var/ by checking if /var/run/ and /var/lock/ are still
+# mount points.  Enabling RAMRUN and RAMLOCK while listing /var/run or
+# /var/lock in /etc/fstab is not supported.
 #
 post_mountall ()
 {
-	# Move the mountpoints back.  Fortunately mount seems to not care
-	# if these are the same thing (ie. /var didn't get changed) so we
-	# do this regardless
 	if [ yes = "$RAMRUN" ] ; then
 		[ -d /var/run ] || mkdir /var/run
-		mount -n --move /lib/init/rw/var.run /var/run
+		if mountpoint -q /var/run ; then
+			umount /lib/init/rw/var.run
+		else
+			mount -n --move /lib/init/rw/var.run /var/run
+		fi
 		rmdir /lib/init/rw/var.run
 	fi
 	if [ yes = "$RAMLOCK" ] ; then
 		[ -d /var/lock ] || mkdir /var/lock
-		mount -n --move /lib/init/rw/var.lock /var/lock
+		if mountpoint -q /var/lock ; then
+			umount /lib/init/rw/var.lock
+		else
+			mount -n --move /lib/init/rw/var.lock /var/lock
+		fi
 		rmdir /lib/init/rw/var.lock
 	fi
-	
 }




More information about the Pkg-sysvinit-commits mailing list