]> git.pld-linux.org Git - packages/systemd.git/commitdiff
- revert reverting
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 29 Mar 2012 22:36:16 +0000 (22:36 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    start_udev -> 1.49

start_udev

index ab451ab233c5029ec585008483d97fd8c82f2da6..5b03b4b2051ce363d4ca441cb47f09268a4c2b5b 100644 (file)
@@ -62,6 +62,18 @@ set_hotplug_handler() {
        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 @@ busy
 
 # 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
This page took 0.961813 seconds and 4 git commands to generate.