packages: udev/start_udev - revert last change, =?UTF-8?Q?=20?=${TMPDIR:-/tmp} is on a rea...

baggins baggins at pld-linux.org
Thu Mar 29 18:06:14 CEST 2012


Author: baggins                      Date: Thu Mar 29 16:06:14 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- revert last change, ${TMPDIR:-/tmp} is on a read only / at the time of boot
  http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2012-March/022561.html

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

---- Diffs:

================================================================
Index: packages/udev/start_udev
diff -u packages/udev/start_udev:1.47 packages/udev/start_udev:1.48
--- packages/udev/start_udev:1.47	Sun Mar 18 20:06:41 2012
+++ packages/udev/start_udev	Thu Mar 29 18:06:08 2012
@@ -62,18 +62,6 @@
 	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
@@ -82,18 +70,30 @@
 
 # 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 + $? ))
 
-	# relocate submounts
-	for dir in $(get_dev_mounts); do
-		mount -n --move $udev_root/$dir $devdir/$dir
-		ret=$(( $ret + $? ))
-	done
+	if grep -qF "none $udev_root/pts " /proc/mounts; then
+		PTSDIR=$(mktemp -d ${TMPDIR:-/tmp}/tmpXXXXXX)
+		mount --move $udev_root/pts "$PTSDIR"
+	fi
 
-	mount -n --move $devdir $udev_root
+	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
+
+	ret=$(( $ret + $? ))
 }
 
 kill_udevd > "$udev_root/null" 2>&1
================================================================

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



More information about the pld-cvs-commit mailing list