Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flatcar-postinst: Control target filename of extracted OEM payload #36

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions flatcar-postinst
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ sysext_download() {
local name="$1" # Payload name
local target="$2" # Path to write the payload to, writing does not need to be atomic because the caller later does an atomic move
local from="$3" # Either path to XML dump or the constant "release-server"
local target_tmpdir=""
local extracted_filename="${name/%.gz/.raw}"
local target_tmpdir=
local extracted_filename=
local ARG=()
local loader=
local ret
SUCCESS=false
extracted_filename=$(basename "${target}")
target_tmpdir="$(dirname "${target}")/ue-rs/"
set +e
(
Expand All @@ -69,12 +70,12 @@ sysext_download() {
elif [ "${from}" = "bincache-server" ]; then
ARG=("-u" "https://bincache.flatcar-linux.net/images/${FLATCAR_BOARD/-usr}/${NEXT_VERSION}/${name}")
else
ARG=("-i" "${from}" -m "${name}")
ARG=("-i" "${from}" -m "*${name}" -t)
fi
# Using "${INSTALL_MNT}" here is ok because it was verified first by update-engine
loader=$(ls "${INSTALL_MNT}"/lib64/ld-linux-*.so.* | head -n 1)
# A simple LD_LIBRARY_PATH is not enough if the loader is too old
"${loader}" --library-path "${INSTALL_MNT}"/lib64 "${INSTALL_MNT}"/bin/download_sysext -p /usr/share/update_engine/update-payload-key.pub.pem -o "${target_tmpdir}" "${ARG[@]}"
"${loader}" --library-path "${INSTALL_MNT}"/lib64 "${INSTALL_MNT}"/bin/download_sysext -p /usr/share/update_engine/update-payload-key.pub.pem -o "${target_tmpdir}" -n "${extracted_filename}" "${ARG[@]}"
mv "${target_tmpdir}/${extracted_filename}" "${target}"
)
ret=$?
Expand Down