diff --git a/modules.d/90livenet/livenetroot.sh b/modules.d/90livenet/livenetroot.sh index 92ad805bed..5d176ddba8 100755 --- a/modules.d/90livenet/livenetroot.sh +++ b/modules.d/90livenet/livenetroot.sh @@ -16,6 +16,26 @@ netroot="$2" liveurl="${netroot#livenet:}" info "fetching $liveurl" +if getargbool 0 'rd.writable.fsimg'; then + + minmem=$(getarg rd.minmem.liverw) + minmem=${minmem:-1024} + + memsize=$(($(sed -n 's/MemTotal: *\([[:digit:]]*\).*/\1/p' /proc/meminfo) / 1024)) + imgsize=$(($(curl -sI "$liveurl" | sed -n 's/Content-Length: *\([[:digit:]]*\).*/\1/p') / (1024 * 1024))) + + if [ $((memsize - imgsize)) -lt $minmem ]; then + sed -i "N;/and attach it to a bug report./s/echo$/echo\n\ + echo \n\ + echo 'Warning!!!'\n\ + echo 'The memory size of your system is too small for this live image.'\n\ + echo 'Expect killed processes due to out of memory conditions.'\n\ + echo \n/" /usr/bin/dracut-emergency + + emergency_shell + fi +fi + imgfile= #retry until the imgfile is populated with data or the max retries i=1