diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:37 +0000 |
commit | 734d725d62d2cbe4445524448de024e3b9e7f4b3 (patch) | |
tree | 88d8385f24a0efda248b3480fe39037b85e76552 /modules.d/90livenet | |
parent | Releasing progress-linux version 060+5-8~progress7.99u1. (diff) | |
download | dracut-734d725d62d2cbe4445524448de024e3b9e7f4b3.tar.xz dracut-734d725d62d2cbe4445524448de024e3b9e7f4b3.zip |
Merging upstream version 102.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | modules.d/90livenet/livenetroot.sh | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/modules.d/90livenet/livenetroot.sh b/modules.d/90livenet/livenetroot.sh index 66dd41b..34f91ff 100755 --- a/modules.d/90livenet/livenetroot.sh +++ b/modules.d/90livenet/livenetroot.sh @@ -17,10 +17,21 @@ liveurl="${netroot#livenet:}" info "fetching $liveurl" if getargbool 0 'rd.writable.fsimg'; then + imgheader=$(curl -sIL "$liveurl") - imgsize=$(($(curl -sIL "$liveurl" | sed -n 's/Content-Length: *\([[:digit:]]*\).*/\1/p') / (1024 * 1024))) - - check_live_ram $imgsize + # shellcheck disable=SC2181 + ret=$? + if [ $ret != 0 ]; then + warn "failed to get live image header: error $ret" + else + imgheaderlen=$(echo "$imgheader" | sed -n 's/[cC]ontent-[lL]ength: *\([[:digit:]]*\).*/\1/p') + if [ -z "$imgheaderlen" ]; then + warn "failed to get 'Content-Length' header from live image" + else + imgsize=$((imgheaderlen / (1024 * 1024))) + check_live_ram $imgsize + fi + fi fi imgfile= @@ -30,8 +41,9 @@ while [ "$i" -le "$RETRIES" ]; do imgfile=$(fetch_url "$liveurl") # shellcheck disable=SC2181 - if [ $? != 0 ]; then - warn "failed to download live image: error $?" + ret=$? + if [ $ret != 0 ]; then + warn "failed to download live image: error $ret" imgfile= fi |