bootupd
bootupd copied to clipboard
Support for adopt --with-static-configs
It'd be nice to be able to convert Fedora ostree+Anaconda users to bootupd --with-static-configs.
Until this is implemented, one can just reinstall the bootloader (tested on EL 9.5)
cat > /usr/lib/systemd/system/bootloader-adopt.service <<'EOF'
[Unit]
Description=bootloader adopt
ConditionPathExists=!/boot/bootupd-state.json
Before=bootloader-update.service
[Service]
Type=oneshot
ExecStart=/usr/libexec/bootloader-adopt
RemainAfterExit=yes
# Keep this stuff in sync with SYSTEMD_ARGS_BOOTUPD in general
PrivateNetwork=yes
ProtectHome=yes
KillMode=mixed
MountFlags=slave
# inhibit locks are ignored by reboot/poweroff (need to use systemctl)
# so delay being killed as much as possible
KillSignal=SIGCONT
[Install]
WantedBy=multi-user.target
EOF
cat > /usr/libexec/bootloader-adopt <<'EOF'
#!/usr/bin/bash
set -euo pipefail
# We reinstall the bootloader as we also want to "adopt" grub.cfg
# https://github.com/coreos/bootupd/issues/578
PART=$(findmnt --noheadings --nofsroot --output SOURCE /boot)
echo "/boot partition = ${PART}"
DISK=$(lsblk --paths --noheadings --output PKNAME "${PART}")
echo "/boot disk = ${DISK}"
echo "Reinstalling bootloader using bootupd"
bootupctl backend install --auto --write-uuid --update-firmware --device "${DISK}" /
sync -f /boot
if [ -e /boot/efi ]; then
sync -f /boot/efi
fi
EOF
I think this is implemented in https://github.com/coreos/bootupd/pull/945