Urlencode asset keys during dracut boot

- Fixes: #1610

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-01-30 11:05:27 -07:00
parent 987a3fd621
commit 5bc82f97cc
4 changed files with 26 additions and 21 deletions

View File

@@ -3,18 +3,25 @@
info "Mounting tmpfs at $NEWROOT"
mount -t tmpfs -o mpol=interleave ${wwinit_tmpfs_size_option} tmpfs "$NEWROOT"
for archive in "${wwinit_image}" "${wwinit_system}" "${wwinit_runtime}"
for stage in "image" "system" "runtime"
do
if [ -n "${archive}" ]
info "Loading stage: ${stage}"
# Load runtime overlay from a static privledged port.
# Others use default settings.
localport=""
if [[ "${stage}" == "runtime" ]]
then
info "Loading ${archive}"
# Load runtime overlay from a static privledged port.
# Others use default settings.
localport=""
if [[ "${archive}" == "${wwinit_runtime}" ]]
then
localport="--local-port 1-1023"
fi
(curl --retry 60 --retry-delay 1 --silent ${localport} -L "${archive}" | gzip -d | cpio -im --directory="${NEWROOT}") || die "Unable to load ${archive}"
localport="--local-port 1-1023"
fi
(
curl --location --silent --get ${localport} \
--retry 60 --retry-delay 1 \
--data-urlencode "assetkey=${wwinit_assetkey}" \
--data-urlencode "uuid=${wwinit_uuid}" \
--data-urlencode "stage=${stage}" \
--data-urlencode "compress=gz" \
"${wwinit_uri}" \
| gzip -d \
| cpio -im --directory="${NEWROOT}"
) || die "Unable to load stage: ${stage}"
done