Skip to content
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
23 changes: 19 additions & 4 deletions contrib/packaging/switch-to-sdboot
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ set -xeuo pipefail
src=$1/out
shift

# Uninstall bootupd if present (we're switching to sd-boot managed differently)
if rpm -q bootupd &>/dev/null; then
rpm -e bootupd
rm -vrf /usr/lib/bootupd/updates
# systemd-boot (and, when sealed, the UKI) is signed and booted directly
# with our own Secure Boot key, so shim is never in the trust chain
# regardless of sealing. Uninstall bootupd (managed differently for
# sd-boot) and shim together so neither lingers in the image.
case "$(uname -m)" in
x86_64) shim_pkg=shim-x64 ;;
aarch64) shim_pkg=shim-aa64 ;;
*) shim_pkg="" ;;
esac

pkgs_to_remove=()
for pkg in bootupd "${shim_pkg}"; do
[ -n "${pkg}" ] || continue
rpm -q "${pkg}" &>/dev/null && pkgs_to_remove+=("${pkg}")
done

if [ "${#pkgs_to_remove[@]}" -gt 0 ]; then
rpm -e "${pkgs_to_remove[@]}"
fi
rm -vrf /usr/lib/bootupd/updates

# First install the unsigned systemd-boot RPM to get the package in place
rpm -Uvh --replacepkgs "${src}"/*.rpm
Expand Down
Loading