[arch-projects] [mkinitcpio] [RFC 1/2] init: Unify/improve mount --move handling
Thomas Bächler
thomas at archlinux.org
Fri Apr 8 12:02:59 EDT 2011
- Loop over dev, sys, proc instead of repeating the same command.
- If the target directory does not exist, umount instead of moving.
---
init | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/init b/init
index f242dc1..d030f5f 100644
--- a/init
+++ b/init
@@ -151,7 +151,11 @@ if [ -n "${udevpid}" ]; then
done
fi
-mount --move /proc /new_root/proc
-mount --move /sys /new_root/sys
-mount --move /dev /new_root/dev
+for d in proc sys dev; do
+ if [ -d /new_root/${d} ]; then
+ /bin/mount --move /${d} /new_root/${d}
+ else
+ /bin/umount /${d}
+ fi
+done
exec /sbin/switch_root -c /dev/console /new_root ${init} "$@"
--
1.7.4.2
More information about the arch-projects
mailing list