diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:36 +0000 |
commit | 70de5d4041249c1a0f597714398cc245f59495c6 (patch) | |
tree | ff491e31b95b662ca6c481ac49d1ca8a94c0226b /modules.d/90livenet | |
parent | Adding debian version 060+5-8. (diff) | |
download | dracut-70de5d4041249c1a0f597714398cc245f59495c6.tar.xz dracut-70de5d4041249c1a0f597714398cc245f59495c6.zip |
Merging upstream version 102.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/90livenet')
-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 |