summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2011-04-08 17:45:14 +0200
committerThomas Bächler <thomas@archlinux.org>2011-04-08 17:52:05 +0200
commit7434a449dcae6f3d2a1473552073745121fc85ea (patch)
tree319050232fae64707048a4be8d9e8ebb47e54f53 /init
parent977583e34d21d59493fe71bf2f94bfe185673fa7 (diff)
downloadmkinitcpio-7434a449dcae6f3d2a1473552073745121fc85ea.tar.gz
mkinitcpio-7434a449dcae6f3d2a1473552073745121fc85ea.tar.xz
init: Unify/improve mount --move handling
- Loop over dev, sys, proc instead of repeating the same command. - If the target directory does not exist, umount instead of moving.
Diffstat (limited to 'init')
-rw-r--r--init10
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} "$@"