summaryrefslogtreecommitdiffstats
path: root/initramfs-init
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-03-17 15:39:50 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-03-17 15:39:50 +0000
commit60258b46d57c8ad4c8e68c0f324a7f25049f4620 (patch)
tree165a6d003f8e0f83f36f9eaf3e95d7c8db9c367c /initramfs-init
parenta5f1bed085aa7e3a2b5f3e8dfdbb4f40b7a1f7ac (diff)
downloadabuild-60258b46d57c8ad4c8e68c0f324a7f25049f4620.tar.bz2
abuild-60258b46d57c8ad4c8e68c0f324a7f25049f4620.tar.xz
initram: retry mount root incase its an usb device
Diffstat (limited to 'initramfs-init')
-rwxr-xr-xinitramfs-init19
1 files changed, 13 insertions, 6 deletions
diff --git a/initramfs-init b/initramfs-init
index 6b9fe4d..d35f5ae 100755
--- a/initramfs-init
+++ b/initramfs-init
@@ -53,6 +53,15 @@ find_ovl() {
echo "$ovl"
}
+retry_mount() {
+ # usb might need some time to settle so we retry a few times
+ for i in $(seq 0 19); do
+ mount $@ 2>&1 && return 0
+ sleep 1
+ done
+ return 1
+}
+
# gotta start from somewhere :)
echo "Alpine Init $VERSION"
@@ -116,7 +125,9 @@ eend 0
# check if root=... was set
if [ -n "$KOPT_root" ]; then
- mount $KOPT_root $NEWROOT
+ ebegin "Mounting root"
+ retry_mount $KOPT_root $NEWROOT 2>/dev/null
+ eend $?
cat /proc/mounts | while read DEV DIR TYPE OPTS ; do
if [ "$DIR" != "/" -a "$DIR" != "$NEWROOT" -a -d "$DIR" ]; then
mkdir -p $NEWROOT/$DIR
@@ -136,11 +147,7 @@ if [ -n "$ALPINE_DEV_FS" ]; then
mount_opts="-t $ALPINE_DEV_FS"
fi
-# usb might need some time to settle so we retry a few times
-for i in $(seq 0 19); do
- mount $mount_opts /dev/$ALPINE_DEV $ALPINE_MNT >/dev/null 2>&1 && break
- sleep 1
-done
+retry_mount $mount_opts /dev/$ALPINE_DEV $ALPINE_MNT >/dev/null 2>&1
eend $?
ebegin "Mounting loopback device for kernel modules"