Skip to content

Instantly share code, notes, and snippets.

@jauderho
Last active May 22, 2024 18:55
Show Gist options
  • Save jauderho/de656fcb11a5342233ab5c5ca19c8dac to your computer and use it in GitHub Desktop.
Save jauderho/de656fcb11a5342233ab5c5ca19c8dac to your computer and use it in GitHub Desktop.
HOWTO: Upgrade to Alpine 3.20
#!/bin/ash
# There are some breaking changes to EFI upgrading from earlier versions of Alpine to 3.20
# The following should work based on the 3.20 changelog
# It should be run as root after upgrading to 3.20 BUT before rebooting. YMMV
# Links
# https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.20.0
# https://gitlab.alpinelinux.org/alpine/alpine-conf/-/blob/master/setup-disk.in#L320-324
# Set variables
ARCH=$(apk --print-arch)
efi_directory=$(awk '$2 ~ /boot/ && $3 ~ /fat|msdos/ { print $2 }' /proc/mounts)
case "$ARCH" in
x86_64) target=x86_64-efi ; fwa=x64 ;;
x86) target=i386-efi ; fwa=ia32 ;;
arm*) target=arm-efi ; fwa=arm ;;
aarch64) target=arm64-efi ; fwa=aa64 ;;
riscv64) target=riscv64-efi ; fwa=riscv64 ;;
loongarch64) target=loongarch64-efi ; fwa=loongarch64 ;;
esac
# Update EFI configs
grub-install --target=$target --efi-directory=$efi_directory --bootloader-id=alpine --boot-directory=/boot --no-nvram
install -D $efi_directory/EFI/alpine/grub$fwa.efi $efi_directory/EFI/boot/boot$fwa.efi
# reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment