diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-05-02 12:42:08 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-05-02 12:42:08 +0000 |
commit | 6d3cfd40793fe2206974d7fa5f852efec023fdff (patch) | |
tree | c2984145725110d24827f859e044239c0c8a73c4 /initramfs-init.in | |
parent | 244770683dc79fc8126e37f748c7d1b6ed36aae6 (diff) | |
download | mkinitfs-6d3cfd40793fe2206974d7fa5f852efec023fdff.tar.bz2 mkinitfs-6d3cfd40793fe2206974d7fa5f852efec023fdff.tar.xz |
init: factorize out OVL_DEV_IS_NETWORK variable
instead, check if OVL_DEV is an URI
Diffstat (limited to 'initramfs-init.in')
-rwxr-xr-x | initramfs-init.in | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/initramfs-init.in b/initramfs-init.in index febff3a..f958cce 100755 --- a/initramfs-init.in +++ b/initramfs-init.in @@ -421,13 +421,18 @@ fi # /dev/blah:ext3 # http://.../blah.apkovl.tar.gz -if [ -n "$KOPT_ovl_dev" ] ; then - OVL_DEV=${KOPT_ovl_dev%%:*} - OVL_DEV_FS=${KOPT_ovl_dev##*:} - if [ "$OVL_DEV_FS" = "$OVL_DEV" ]; then - unset OVL_DEV_FS - fi -fi +case "$KOPT_ovl_dev" in + '') ;; + http://*|https://*|ftp://*) + OVL_DEV="$KOPT_ovl_dev" + ;; + *:*) + OVL_DEV="${KOPT_ovl_dev%%:*}" + OVL_DEV_FS="${KOPT_ovl_dev##*:}" + ;; + *) OVL_DEV="${KOPT_ovl_dev}" + ;; +esac case "$ALPINE_DEV" in UUID=*|LABEL=*) ;; @@ -439,15 +444,6 @@ case "$ALPINE_DEV" in *) ALPINE_DEV=/dev/$ALPINE_DEV ;; esac -case "$OVL_DEV" in - http|https) - OVL_DEV_FS="$OVL_DEV" - OVL_DEV="$KOPT_ovl_dev" - OVL_DEV_IS_NETWORK=y - ;; - *) ;; -esac - # The following values are supported: # alpine_repo=auto -- default, search for .boot_repository # alpine_repo=http://... -- network repository @@ -568,11 +564,15 @@ if [ -n "$KOPT_root_size" ]; then fi mount -t tmpfs $root_opts tmpfs $sysroot -if [ -n "$OVL_DEV_IS_NETWORK" ]; then - ovl=/tmp/boot.apkovl.tar.gz - wget -O "$ovl" "$OVL_DEV" -else - if [ -n "$OVL_DEV" ]; then +case "$OVL_DEV" in + '') + find_ovl_dev + ;; + http://*|https://*|ftp://*) + ovl=/tmp/boot.apkovl.tar.gz + wget -O "$ovl" "$OVL_DEV" || ovl= + ;; + *) mkdir -p /media/$OVL_DEV unset mount_opts if [ -n "$OVL_DEV_FS" ]; then @@ -582,10 +582,9 @@ else retry_mount -o ro $mount_opts /dev/$OVL_DEV /media/$OVL_DEV \ >/dev/null 2>&1 ovl=$(find_ovl /media/$OVL_DEV) - else - find_ovl_dev - fi -fi + ;; +esac + if ! [ -f "$ovl" ]; then ovl=$(find_ovl $ALPINE_MNT) fi |