Skip to content

Commit

Permalink
Set GRUB_DEFAULT_OVERRIDE to saved for RHEL-clones
Browse files Browse the repository at this point in the history
  • Loading branch information
asciiprod committed Aug 7, 2024
1 parent 1ee998c commit 81031b3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions almalinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ generate_config_grub() {

sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"$grub_cmdline_linux\"/" "$FOLD/hdd/etc/default/grub"

if ((IMG_VERSION > 85)) && ((IMG_VERSION <= 92)) && [[ -z "$GRUB_DEFAULT_OVERRIDE" ]]; then
GRUB_DEFAULT_OVERRIDE='saved'
fi

if [[ -n "$GRUB_DEFAULT_OVERRIDE" ]]; then sed -i "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=$GRUB_DEFAULT_OVERRIDE/" "$FOLD/hdd/etc/default/grub"; fi

rm -f "$FOLD/hdd/boot/grub2/grub.cfg"
if [ "$UEFI" -eq 1 ]; then
execute_chroot_command "grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg 2>&1"; declare -i EXITCODE="$?"
Expand Down
6 changes: 6 additions & 0 deletions centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ generate_config_grub() {

sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"$grub_cmdline_linux\"/" "$FOLD/hdd/etc/default/grub"

if ((IMG_VERSION > 80)) && ((IMG_VERSION <= 90)) && ((IMG_VERSION != 610)) && [[ -z "$GRUB_DEFAULT_OVERRIDE" ]]; then
GRUB_DEFAULT_OVERRIDE='saved'
fi

if [[ -n "$GRUB_DEFAULT_OVERRIDE" ]]; then sed -i "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=$GRUB_DEFAULT_OVERRIDE/" "$FOLD/hdd/etc/default/grub"; fi

rm -f "$FOLD/hdd/boot/grub2/grub.cfg"
if [ "$UEFI" -eq 1 ]; then
execute_chroot_command "grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg 2>&1"; declare -i EXITCODE="$?"
Expand Down
6 changes: 6 additions & 0 deletions rockylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ generate_config_grub() {

sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"$grub_cmdline_linux\"/" "$FOLD/hdd/etc/default/grub"

if ((IMG_VERSION > 85)) && ((IMG_VERSION <= 92)) && [[ -z "$GRUB_DEFAULT_OVERRIDE" ]]; then
GRUB_DEFAULT_OVERRIDE='saved'
fi

if [[ -n "$GRUB_DEFAULT_OVERRIDE" ]]; then sed -i "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=$GRUB_DEFAULT_OVERRIDE/" "$FOLD/hdd/etc/default/grub"; fi

rm -f "$FOLD/hdd/boot/grub2/grub.cfg"
if [ "$UEFI" -eq 1 ]; then
execute_chroot_command "grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg 2>&1"; declare -i EXITCODE="$?"
Expand Down

0 comments on commit 81031b3

Please sign in to comment.