Skip to content

Instantly share code, notes, and snippets.

@blizzardengle
Last active February 8, 2022 22:36
Show Gist options
  • Save blizzardengle/fdf9f0733d2ad1f8d31bf4ffccab0b39 to your computer and use it in GitHub Desktop.
Save blizzardengle/fdf9f0733d2ad1f8d31bf4ffccab0b39 to your computer and use it in GitHub Desktop.
Update the GPT partition UUID in the GRUB configuration when using EFI images of OpenWrt.
opkg update
opkg install lsblk
BOOT="$(sed -n -e "/\s\/boot\s.*$/{s///p;q}" /etc/mtab)"
DISK="${BOOT%%[0-9]*}"
PART="$((${BOOT##*[^0-9]}+1))"
ROOT="${DISK}${PART}"
UUID="$(lsblk -n -o PARTUUID ${ROOT})"
sed -i -r -e "s|(PARTUUID=)\S+|\1${UUID}|g" /boot/grub/grub.cfg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment