mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-09 01:18:35 +03:00
508a8b61ac
In #3205, we introduced a check to skip re-generating the GRUB config if we detect that static configs are in used by looking at bootupd's state. Unfortunately this check is incomplete and does not account for present but null entries in the JSON state file. A proper fix would be to parse the JSON but this requires a larger code change. Fixes: https://github.com/ostreedev/ostree/issues/3295 Fixes: https://github.com/ostreedev/ostree/pull/3205
37 lines
1.4 KiB
Bash
Executable File
37 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
set -xeuo pipefail
|
|
|
|
. ${KOLA_EXT_DATA}/libinsttest.sh
|
|
|
|
require_writable_sysroot
|
|
prepare_tmpdir
|
|
|
|
bootupd_state=/boot/bootupd-state.json
|
|
mount -o remount,rw /boot
|
|
if grep -qFe "\"static-configs\"" "${bootupd_state}"; then
|
|
echo "Host is using static configs already, overriding this"
|
|
jq --compact-output '.["static-configs"] = null' < "${bootupd_state}" > "${bootupd_state}".new
|
|
mv "${bootupd_state}.new" "${bootupd_state}"
|
|
fi
|
|
|
|
# Print the current value for reference, it's "none" on FCOS derivatives
|
|
ostree config get sysroot.bootloader || true
|
|
ostree config set sysroot.bootloader auto
|
|
|
|
ostree admin deploy --stage "${host_commit}"
|
|
systemctl stop ostree-finalize-staged.service
|
|
used_bootloader=$(journalctl -u ostree-finalize-staged -o json MESSAGE_ID=dd440e3e549083b63d0efc7dc15255f1 | tail -1 | jq -r .OSTREE_BOOTLOADER)
|
|
# We're verifying the legacy default now
|
|
assert_streq "${used_bootloader}" "grub2"
|
|
ostree admin undeploy 0
|
|
|
|
# Now synthesize a bootupd config which uses static configs
|
|
jq '. + {"static-configs": {}}' < "${bootupd_state}" > "${bootupd_state}".new
|
|
mv "${bootupd_state}.new" "${bootupd_state}"
|
|
ostree admin deploy --stage "${host_commit}"
|
|
systemctl stop ostree-finalize-staged.service
|
|
used_bootloader=$(journalctl -u ostree-finalize-staged -o json MESSAGE_ID=dd440e3e549083b63d0efc7dc15255f1 | tail -1 | jq -r .OSTREE_BOOTLOADER)
|
|
assert_streq "${used_bootloader}" "none"
|
|
|
|
echo "ok bootupd static"
|