diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-03-26 14:06:30 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-03-31 15:14:22 +0000 |
commit | 062c5d3aece2e308aa7fc03acab1b3b6dd4270b2 (patch) | |
tree | c9d4fe01605545a760a99999b663e9369afc0df0 /init | |
parent | a3ddeed683d765f5c7638c23ca3b95a9914a37b6 (diff) | |
download | initramfs-scripts-062c5d3aece2e308aa7fc03acab1b3b6dd4270b2.tar.gz |
Support rootwait (enabled by default)
Change-Id: Ie1cb0c136cb9bc2873d86bbc244dcacdcf85b65d
Diffstat (limited to 'init')
-rw-r--r-- | init | 68 |
1 files changed, 43 insertions, 25 deletions
@@ -9,6 +9,7 @@ set -- $(cat /proc/cmdline) # We don't want to leave mount points around umount /proc +rootwait=true # defaults to off in the kernel, I think it's more useful on for arg; do case "$arg" in root=LABEL=*) @@ -50,6 +51,12 @@ for arg; do fi rootfstype="${arg#rootdelay=}" ;; + rootwait) + rootwait=true + ;; + norootwait) + rootwait=false + ;; ro) ro=ro ;; @@ -75,33 +82,44 @@ EOF fi mount -n -t devtmpfs devtmpfs /dev -case "$root_type" in -disk) - mount -n -t "${rootfstype}" -o "${ro-rw}""$rootflags" "$root" /mnt - ;; -label) - disk="$(findfs LABEL="$root")" - if [ x"$disk" = x ]; then - echo disk with label $root not found - blkid - exit 1 - fi - mount -n -t "${rootfstype}" -o "${ro-rw}""$rootflags" "$disk" /mnt - ;; -uuid) - disk="$(findfs UUID="$root")" - if [ x"$disk" = x ]; then - echo disk with UUID $root not found - blkid +while true; do + case "$root_type" in + disk) + if mount -n -t "${rootfstype}" -o "${ro-rw}""$rootflags" "$root" /mnt; then + break + else + echo disk $root not found + blkid + fi + ;; + label) + disk="$(findfs LABEL="$root")" + if [ x"$disk" = x ]; then + echo disk with label $root not found + blkid + else + mount -n -t "${rootfstype}" -o "${ro-rw}""$rootflags" "$disk" /mnt && break + fi + ;; + uuid) + disk="$(findfs UUID="$root")" + if [ x"$disk" = x ]; then + echo disk with UUID $root not found + blkid + else + mount -n -t "${rootfstype}" -o "${ro-rw}""$rootflags" "$disk" /mnt && break + fi + ;; + '') + echo "Error, no root specified" exit 1 + ;; + esac + if "$rootwait"; then + echo Trying again in 0.5 seconds + sleep 0.5 fi - mount -n -t "${rootfstype}" -o "${ro-rw}""$rootflags" "$disk" /mnt - ;; -'') - echo "Error, no root specified" - exit 1 - ;; -esac +done umount -n /dev exec switch_root -c /dev/console /mnt "${init-/sbin/init}" |