wok-current rev 10901
busybox/init: softraid retries
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jul 20 13:18:13 2011 +0200 (2011-07-20) |
parents | 8e0af5f8e73f |
children | 61cd3f3b6673 |
files | busybox/stuff/init |
line diff
1.1 --- a/busybox/stuff/init Fri Jul 15 12:10:53 2011 +0200 1.2 +++ b/busybox/stuff/init Wed Jul 20 13:18:13 2011 +0200 1.3 @@ -75,9 +75,10 @@ 1.4 1.5 mount -t proc proc /proc 1.6 mount -t sysfs sysfs /sys 1.7 +echo -n "Switching / to " 1.8 if grep -q dmraid= /proc/cmdline; then 1.9 root="$(sed 's/.*dmraid=\([^ ]*\).*/\1/' < /proc/cmdline)" 1.10 - echo -n "Switching / to dmraid $root..." 1.11 + echo -n "dmraid $root..." 1.12 dmraid -s | grep ^type | awk '{ print $3 }' | load_raid 1.13 case "$root" in 1.14 /dev/*);; 1.15 @@ -89,17 +90,21 @@ 1.16 fi 1.17 if grep -q softraid= /proc/cmdline; then 1.18 root="$(sed 's/.*softraid=\([^ ]*\).*/\1/' < /proc/cmdline)" 1.19 - echo -n "Switching / to softraid $root..." 1.20 + echo -n "softraid $root..." 1.21 mdadm --examine --scan --config=partitions > /etc/mdadm.conf 1.22 grep -qs " $root " /etc/mdadm.conf || 1.23 root=$(awk '/dev.md/ { print $2; exit }' < /etc/mdadm.conf) 1.24 grep level=raid /etc/mdadm.conf | load_raid 1.25 - mdadm --assemble --scan 1.26 + for i in 1 2 3 4 5 6 7 8 9; do 1.27 + sleep $i 1.28 + mdadm --assemble --scan 1.29 + grep -qs ': active' /proc/mdstat && break 1.30 + done 1.31 lvmsetup 1.32 mount_mapper /etc/mdadm.conf 1.33 fi 1.34 if lvmsetup; then 1.35 - echo -n "Switching / to lvm $root..." 1.36 + echo -n "lvm $root..." 1.37 mount_mapper 1.38 fi 1.39 if grep -q mount= /proc/cmdline; then 1.40 @@ -118,7 +123,7 @@ 1.41 fi 1.42 if grep -q loopfs= /proc/cmdline; then 1.43 loopfs="$(sed 's/.*loopfs=\([^ ]*\).*/\1/' < /proc/cmdline)" 1.44 - echo -n "Switching / to loop $loopfs..." 1.45 + echo -n "loop $loopfs..." 1.46 losetup /dev/loop0 /mnt/$loopfs 1.47 mount /dev/loop0 /mnt 2> /dev/null 1.48 fi 1.49 @@ -134,7 +139,7 @@ 1.50 exec chroot /mnt$subroot /sbin/init 1.51 fi 1.52 fi 1.53 -echo -n "Switching / to tmpfs..." 1.54 +echo -n "tmpfs..." 1.55 size="$(grep rootfssize= < /proc/cmdline | \ 1.56 sed 's/.*rootfssize=\([0-9]*[kmg%]\).*/-o size=\1/')" 1.57 free=$(busybox free | busybox awk '/Mem:/ { print int(($4*100)/$3) }')