packages: udev/start_udev - revert reverting

glen glen at pld-linux.org
Fri Mar 30 00:36:21 CEST 2012


Author: glen                         Date: Thu Mar 29 22:36:21 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- revert reverting

---- Files affected:
packages/udev:
   start_udev (1.48 -> 1.49) 

---- Diffs:

================================================================
Index: packages/udev/start_udev
diff -u packages/udev/start_udev:1.48 packages/udev/start_udev:1.49
--- packages/udev/start_udev:1.48	Thu Mar 29 18:06:08 2012
+++ packages/udev/start_udev	Fri Mar 30 00:36:16 2012
@@ -62,6 +62,18 @@
 	echo "" > /proc/sys/kernel/hotplug
 }
 
+# find subdirs mounted under $udev_root
+get_dev_mounts() {
+	awk -vudev_root="$udev_root/" '
+	BEGIN {
+	  len = length(udev_root);
+	}
+
+	substr($2, 1, len) == udev_root {
+	  print substr($2, len + 1)
+	}' /proc/mounts
+}
+
 export ACTION=add
 prog=udev
 ret=0
@@ -70,30 +82,18 @@
 
 # mount the devtmpfs on $udev_root, if not already done
 awk "\$2 == \"$udev_root\" && \$3 == \"devtmpfs\" { exit 1 }" /proc/mounts && {
+	# mount to temporary location to be able to move submounts, if any
+	devdir=$(mktemp -d ${TMPDIR:-/tmp}/tmpXXXXXX)
+	mount -n -o mode=0755 -t devtmpfs devtmpfs "$devdir"
+	ret=$(( $ret + $? ))
 
-	if grep -qF "none $udev_root/pts " /proc/mounts; then
-		PTSDIR=$(mktemp -d ${TMPDIR:-/tmp}/tmpXXXXXX)
-		mount --move $udev_root/pts "$PTSDIR"
-	fi
-
-	if grep -qF "none $udev_root/shm " /proc/mounts; then
-		SHMDIR=$(mktemp -d ${TMPDIR:-/tmp}/tmpXXXXXX)
-		mount --move $udev_root/shm "$SHMDIR"
-	fi
-
-	mount -n -o mode=0755 -t devtmpfs devtmpfs "$udev_root"
-	mkdir -m 0755 $udev_root/pts
-	mkdir -m 0755 $udev_root/shm
-	if [ -n "$PTSDIR" ]; then
-		mount --move "$PTSDIR" $udev_root/pts
-		rmdir "$PTSDIR"
-	fi
-	if [ -n "$SHMDIR" ]; then
-		mount --move "$SHMDIR" $udev_root/shm
-		rmdir "$SHMDIR"
-	fi
+	# relocate submounts
+	for dir in $(get_dev_mounts); do
+		mount -n --move $udev_root/$dir $devdir/$dir
+		ret=$(( $ret + $? ))
+	done
 
-	ret=$(( $ret + $? ))
+	mount -n --move $devdir $udev_root
 }
 
 kill_udevd > "$udev_root/null" 2>&1
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/packages/udev/start_udev?r1=1.48&r2=1.49



More information about the pld-cvs-commit mailing list