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