|
|
24fce8 |
From 2d19bc931b0b2a70abc18f6d15dddbf547cafd94 Mon Sep 17 00:00:00 2001
|
|
|
24fce8 |
From: Robert Marshall <rmarshall@redhat.com>
|
|
|
24fce8 |
Date: Thu, 22 Dec 2016 17:40:52 -0500
|
|
|
24fce8 |
Subject: [PATCH 36/55] Add multi-entry removal test (#1285601)
|
|
|
24fce8 |
|
|
|
24fce8 |
Test what happens to the default entry set in the grub environment after
|
|
|
24fce8 |
removing the first two boot entries.
|
|
|
24fce8 |
|
|
|
24fce8 |
Related: rhbz#1285601
|
|
|
24fce8 |
---
|
|
|
24fce8 |
test.sh | 7 ++
|
|
|
24fce8 |
test/grub2-support_files/grubenv.4 | 3 +
|
|
|
24fce8 |
test/grub2.19 | 112 +++++++++++++++++++++++++++++
|
|
|
24fce8 |
test/results/remove/g2.19 | 88 +++++++++++++++++++++++
|
|
|
24fce8 |
4 files changed, 210 insertions(+)
|
|
|
24fce8 |
create mode 100644 test/grub2-support_files/grubenv.4
|
|
|
24fce8 |
create mode 100644 test/grub2.19
|
|
|
24fce8 |
create mode 100644 test/results/remove/g2.19
|
|
|
24fce8 |
|
|
|
24fce8 |
diff --git a/test.sh b/test.sh
|
|
|
24fce8 |
index fb7cd2381d5..1ef9eca535d 100755
|
|
|
24fce8 |
--- a/test.sh
|
|
|
24fce8 |
+++ b/test.sh
|
|
|
24fce8 |
@@ -565,6 +565,13 @@ if [ "$testgrub2" == "y" ]; then
|
|
|
24fce8 |
--copy-default --title 'Red Hat Enterprise Linux Server' \
|
|
|
24fce8 |
--args=root=/dev/mapper/foo--
|
|
|
24fce8 |
|
|
|
24fce8 |
+ grub2Test grub2.19 remove/g2.19 --env grubenv.4 \
|
|
|
24fce8 |
+ --remove-kernel=/boot/vmlinuz-2.6.38.2-9.fc15.x86_64 \
|
|
|
24fce8 |
+ --boot-filesystem=/boot/
|
|
|
24fce8 |
+ commandTest "saved_default output" \
|
|
|
24fce8 |
+ "grub2-editenv test/grub2-support_files/env_temp list" \
|
|
|
24fce8 |
+ "saved_entry=Linux, with Fedora 2.6.38.8-32.fc15.x86_64"
|
|
|
24fce8 |
+
|
|
|
24fce8 |
# copy a stanza and add arguments as well, while using --set-index=
|
|
|
24fce8 |
testing="GRUB2 add stanza and new args with --set-index="
|
|
|
24fce8 |
grub2Test grub2.18 add/g2-1.18 --env grubenv.3 \
|
|
|
24fce8 |
diff --git a/test/grub2-support_files/grubenv.4 b/test/grub2-support_files/grubenv.4
|
|
|
24fce8 |
new file mode 100644
|
|
|
24fce8 |
index 00000000000..13116382feb
|
|
|
24fce8 |
--- /dev/null
|
|
|
24fce8 |
+++ b/test/grub2-support_files/grubenv.4
|
|
|
24fce8 |
@@ -0,0 +1,3 @@
|
|
|
24fce8 |
+# GRUB Environment Block
|
|
|
24fce8 |
+saved_entry=Linux, with Fedora 2.6.38.8-32.fc15.x86_64
|
|
|
24fce8 |
+################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
|
|
|
24fce8 |
diff --git a/test/grub2.19 b/test/grub2.19
|
|
|
24fce8 |
new file mode 100644
|
|
|
24fce8 |
index 00000000000..be07b3ea6b3
|
|
|
24fce8 |
--- /dev/null
|
|
|
24fce8 |
+++ b/test/grub2.19
|
|
|
24fce8 |
@@ -0,0 +1,112 @@
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+# DO NOT EDIT THIS FILE
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+# It is automatically generated by grub2-mkconfig using templates
|
|
|
24fce8 |
+# from /etc/grub.d and settings from /etc/default/grub
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/00_header ###
|
|
|
24fce8 |
+if [ -s $prefix/grubenv ]; then
|
|
|
24fce8 |
+ load_env
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+if [ "${next_entry}" ] ; then
|
|
|
24fce8 |
+ set default="${next_entry}"
|
|
|
24fce8 |
+ set next_entry=
|
|
|
24fce8 |
+ save_env next_entry
|
|
|
24fce8 |
+ set boot_once=true
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ set default="${saved_entry}"
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ x"${feature_menuentry_id}" = xy ]; then
|
|
|
24fce8 |
+ menuentry_id_option="--id"
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ menuentry_id_option=""
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+export menuentry_id_option
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ "${prev_saved_entry}" ]; then
|
|
|
24fce8 |
+ set saved_entry="${prev_saved_entry}"
|
|
|
24fce8 |
+ save_env saved_entry
|
|
|
24fce8 |
+ set prev_saved_entry=
|
|
|
24fce8 |
+ save_env prev_saved_entry
|
|
|
24fce8 |
+ set boot_once=true
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+function savedefault {
|
|
|
24fce8 |
+ if [ -z "${boot_once}" ]; then
|
|
|
24fce8 |
+ saved_entry="${chosen}"
|
|
|
24fce8 |
+ save_env saved_entry
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+function load_video {
|
|
|
24fce8 |
+ insmod vbe
|
|
|
24fce8 |
+ insmod vga
|
|
|
24fce8 |
+ insmod video_bochs
|
|
|
24fce8 |
+ insmod video_cirrus
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+set timeout=5
|
|
|
24fce8 |
+### END /etc/grub.d/00_header ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/10_linux ###
|
|
|
24fce8 |
+menuentry 'First Title To Remove' --class gnu-linux --class gnu --class os {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ set gfxpayload=keep
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod ext2
|
|
|
24fce8 |
+ set root='(hd0,msdos1)'
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
24fce8 |
+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...'
|
|
|
24fce8 |
+ linux /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
24fce8 |
+ echo 'Loading initial ramdisk ...'
|
|
|
24fce8 |
+ initrd /initramfs-2.6.38.2-9.fc15.x86_64.img
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+menuentry 'Second Title To Remove' --class gnu-linux --class gnu --class os {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ set gfxpayload=keep
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod ext2
|
|
|
24fce8 |
+ set root='(hd0,msdos1)'
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
24fce8 |
+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...'
|
|
|
24fce8 |
+ linux /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
24fce8 |
+ echo 'Loading initial ramdisk ...'
|
|
|
24fce8 |
+ initrd /initramfs-2.6.38.2-9.fc15.x86_64.img
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+menuentry 'Linux, with Fedora 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ set gfxpayload=keep
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod ext2
|
|
|
24fce8 |
+ set root='(hd0,msdos1)'
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
24fce8 |
+ echo 'Loading Fedora 2.6.38.8-32.fc15.x86_64 ...'
|
|
|
24fce8 |
+ linux /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
24fce8 |
+ echo 'Loading initial ramdisk ...'
|
|
|
24fce8 |
+ initrd /initramfs-2.6.38.8-32.fc15.x86_64.img
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+### END /etc/grub.d/10_linux ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/20_linux_xen ###
|
|
|
24fce8 |
+### END /etc/grub.d/20_linux_xen ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/30_os-prober ###
|
|
|
24fce8 |
+### END /etc/grub.d/30_os-prober ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/40_custom ###
|
|
|
24fce8 |
+# This file provides an easy way to add custom menu entries. Simply type the
|
|
|
24fce8 |
+# menu entries you want to add after this comment. Be careful not to change
|
|
|
24fce8 |
+# the 'exec tail' line above.
|
|
|
24fce8 |
+### END /etc/grub.d/40_custom ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/41_custom ###
|
|
|
24fce8 |
+if [ -f $prefix/custom.cfg ]; then
|
|
|
24fce8 |
+ source $prefix/custom.cfg;
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+### END /etc/grub.d/41_custom ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/90_persistent ###
|
|
|
24fce8 |
+### END /etc/grub.d/90_persistent ###
|
|
|
24fce8 |
diff --git a/test/results/remove/g2.19 b/test/results/remove/g2.19
|
|
|
24fce8 |
new file mode 100644
|
|
|
24fce8 |
index 00000000000..f65edd5ac29
|
|
|
24fce8 |
--- /dev/null
|
|
|
24fce8 |
+++ b/test/results/remove/g2.19
|
|
|
24fce8 |
@@ -0,0 +1,88 @@
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+# DO NOT EDIT THIS FILE
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+# It is automatically generated by grub2-mkconfig using templates
|
|
|
24fce8 |
+# from /etc/grub.d and settings from /etc/default/grub
|
|
|
24fce8 |
+#
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/00_header ###
|
|
|
24fce8 |
+if [ -s $prefix/grubenv ]; then
|
|
|
24fce8 |
+ load_env
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+if [ "${next_entry}" ] ; then
|
|
|
24fce8 |
+ set default="${next_entry}"
|
|
|
24fce8 |
+ set next_entry=
|
|
|
24fce8 |
+ save_env next_entry
|
|
|
24fce8 |
+ set boot_once=true
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ set default="${saved_entry}"
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ x"${feature_menuentry_id}" = xy ]; then
|
|
|
24fce8 |
+ menuentry_id_option="--id"
|
|
|
24fce8 |
+else
|
|
|
24fce8 |
+ menuentry_id_option=""
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+export menuentry_id_option
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+if [ "${prev_saved_entry}" ]; then
|
|
|
24fce8 |
+ set saved_entry="${prev_saved_entry}"
|
|
|
24fce8 |
+ save_env saved_entry
|
|
|
24fce8 |
+ set prev_saved_entry=
|
|
|
24fce8 |
+ save_env prev_saved_entry
|
|
|
24fce8 |
+ set boot_once=true
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+function savedefault {
|
|
|
24fce8 |
+ if [ -z "${boot_once}" ]; then
|
|
|
24fce8 |
+ saved_entry="${chosen}"
|
|
|
24fce8 |
+ save_env saved_entry
|
|
|
24fce8 |
+ fi
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+function load_video {
|
|
|
24fce8 |
+ insmod vbe
|
|
|
24fce8 |
+ insmod vga
|
|
|
24fce8 |
+ insmod video_bochs
|
|
|
24fce8 |
+ insmod video_cirrus
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+set timeout=5
|
|
|
24fce8 |
+### END /etc/grub.d/00_header ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/10_linux ###
|
|
|
24fce8 |
+menuentry 'Linux, with Fedora 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os {
|
|
|
24fce8 |
+ load_video
|
|
|
24fce8 |
+ set gfxpayload=keep
|
|
|
24fce8 |
+ insmod part_msdos
|
|
|
24fce8 |
+ insmod ext2
|
|
|
24fce8 |
+ set root='(hd0,msdos1)'
|
|
|
24fce8 |
+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed
|
|
|
24fce8 |
+ echo 'Loading Fedora 2.6.38.8-32.fc15.x86_64 ...'
|
|
|
24fce8 |
+ linux /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb
|
|
|
24fce8 |
+ echo 'Loading initial ramdisk ...'
|
|
|
24fce8 |
+ initrd /initramfs-2.6.38.8-32.fc15.x86_64.img
|
|
|
24fce8 |
+}
|
|
|
24fce8 |
+### END /etc/grub.d/10_linux ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/20_linux_xen ###
|
|
|
24fce8 |
+### END /etc/grub.d/20_linux_xen ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/30_os-prober ###
|
|
|
24fce8 |
+### END /etc/grub.d/30_os-prober ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/40_custom ###
|
|
|
24fce8 |
+# This file provides an easy way to add custom menu entries. Simply type the
|
|
|
24fce8 |
+# menu entries you want to add after this comment. Be careful not to change
|
|
|
24fce8 |
+# the 'exec tail' line above.
|
|
|
24fce8 |
+### END /etc/grub.d/40_custom ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/41_custom ###
|
|
|
24fce8 |
+if [ -f $prefix/custom.cfg ]; then
|
|
|
24fce8 |
+ source $prefix/custom.cfg;
|
|
|
24fce8 |
+fi
|
|
|
24fce8 |
+### END /etc/grub.d/41_custom ###
|
|
|
24fce8 |
+
|
|
|
24fce8 |
+### BEGIN /etc/grub.d/90_persistent ###
|
|
|
24fce8 |
+### END /etc/grub.d/90_persistent ###
|
|
|
24fce8 |
--
|
|
|
24fce8 |
2.17.1
|
|
|
24fce8 |
|