Refactor priveleged port use in dracut

- Use a port range
- Minor stylistic changes

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-07-05 11:35:34 -06:00
parent 70204649c0
commit 7e70e5a2bb

View File

@@ -8,8 +8,13 @@ do
if [ -n "${archive}" ]
then
info "Loading ${archive}"
#Load only runtime overlays from a static privledge port
[[ "$archive" == *"runtime"* ]] && localport="--local-port 986" || localport=""
(curl --silent $localport -L "${archive}" | gzip -d | cpio -im --directory="${NEWROOT}") || die "Unable to load ${archive}"
# Load runtime overlay from a static privledged port.
# Others use default settings.
localport=""
if [[ "$archive" == *"runtime"* ]]
then
localport="--local-port 1-1023"
fi
(curl --silent ${localport} -L "${archive}" | gzip -d | cpio -im --directory="${NEWROOT}") || die "Unable to load ${archive}"
fi
done