From fd1f01f299b6e4e5d6963d61a72ad09578cd4e77 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sun, 8 Apr 2012 21:31:37 +0200 Subject: [PATCH 1/5] Support for Grub 2 --- ChangeLog | 3 +++ gen_bootloader.sh | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0e6d697..d34cfec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ # Distributed under the GPL v2 # $Id$ + 08 Apr 2012; Mike Auty gen_bootloader.sh: + Support for Grub 2 + 08 Apr 2012; Sebastian Pipping gen_initramfs.sh, genkernel.conf: Add "fastest" to supported initrd compressions diff --git a/gen_bootloader.sh b/gen_bootloader.sh index 79531d4..1debfe9 100755 --- a/gen_bootloader.sh +++ b/gen_bootloader.sh @@ -5,6 +5,9 @@ set_bootloader() { grub) set_bootloader_grub ;; + grub2) + set_bootloader_grub2 + ;; *) print_warning "Bootloader ${BOOTLOADER} is not currently supported" ;; @@ -28,6 +31,24 @@ set_bootloader_grub_read_device_map() { echo "${TEMP}/grub.map" } +set_bootloader_grub2() { + local GRUB_CONF + if [ -e "${BOOTDIR}/grub2/grub.cfg" ] + then + GRUB_CONF="${BOOTDIR}/grub2/grub.cfg" + elif [ -e "${BOOTDIR}/grub/grub.cfg" ] + then + GRUB_CONF="${BOOTDIR}/grub/grub.cfg" + else + print_error 1 "Error! Grub2 configuration file does not exist, please ensure grub2 is correctly setup first." + return 0 + fi + + print_info 1 "You can customize Grub2 parameters in /etc/defaults/grub." + print_info 1 "Running grub-mkconfig to create ${GRUB_CONF}..." + grub-mkconfig -o ${GRUB_CONF} +} + set_bootloader_grub() { local GRUB_CONF="${BOOTDIR}/grub/grub.conf" From 175270768e9c4e5d9c74b51f9e6ebdcd9070439f Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 8 Apr 2012 21:41:19 +0200 Subject: [PATCH 2/5] Reduce code duplication in set_bootloader_grub --- gen_bootloader.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/gen_bootloader.sh b/gen_bootloader.sh index 1debfe9..d14b313 100755 --- a/gen_bootloader.sh +++ b/gen_bootloader.sh @@ -33,20 +33,24 @@ set_bootloader_grub_read_device_map() { set_bootloader_grub2() { local GRUB_CONF - if [ -e "${BOOTDIR}/grub2/grub.cfg" ] - then - GRUB_CONF="${BOOTDIR}/grub2/grub.cfg" - elif [ -e "${BOOTDIR}/grub/grub.cfg" ] - then - GRUB_CONF="${BOOTDIR}/grub/grub.cfg" - else + for candidate in \ + "${BOOTDIR}/grub2/grub.cfg" \ + "${BOOTDIR}/grub/grub.cfg" \ + ; do + if [[ -e "${candidate}" ]]; then + GRUB_CONF=${candidate} + break + fi + done + + if [[ -z "${GRUB_CONF}" ]]; then print_error 1 "Error! Grub2 configuration file does not exist, please ensure grub2 is correctly setup first." - return 0 + return 0 fi print_info 1 "You can customize Grub2 parameters in /etc/defaults/grub." print_info 1 "Running grub-mkconfig to create ${GRUB_CONF}..." - grub-mkconfig -o ${GRUB_CONF} + grub-mkconfig -o "${GRUB_CONF}" } set_bootloader_grub() { From 89ec359dbc21be79f03067c9cfa54cdad9db416d Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 9 Apr 2012 00:07:17 +0200 Subject: [PATCH 3/5] grub-mkconfig -> grub2-mkconfig --- gen_bootloader.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gen_bootloader.sh b/gen_bootloader.sh index d14b313..ad846cf 100755 --- a/gen_bootloader.sh +++ b/gen_bootloader.sh @@ -49,8 +49,8 @@ set_bootloader_grub2() { fi print_info 1 "You can customize Grub2 parameters in /etc/defaults/grub." - print_info 1 "Running grub-mkconfig to create ${GRUB_CONF}..." - grub-mkconfig -o "${GRUB_CONF}" + print_info 1 "Running grub2-mkconfig to create ${GRUB_CONF}..." + grub2-mkconfig -o "${GRUB_CONF}" } set_bootloader_grub() { From ae9d882a3e456814c4d8935181bac3328926c929 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 9 Apr 2012 00:07:35 +0200 Subject: [PATCH 4/5] /etc/defaults/grub -> /etc/default/grub --- gen_bootloader.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen_bootloader.sh b/gen_bootloader.sh index ad846cf..5c05e64 100755 --- a/gen_bootloader.sh +++ b/gen_bootloader.sh @@ -48,7 +48,7 @@ set_bootloader_grub2() { return 0 fi - print_info 1 "You can customize Grub2 parameters in /etc/defaults/grub." + print_info 1 "You can customize Grub2 parameters in /etc/default/grub." print_info 1 "Running grub2-mkconfig to create ${GRUB_CONF}..." grub2-mkconfig -o "${GRUB_CONF}" } From 970824ef5d605e6e3108b52e6645a3a204111e3d Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 9 Apr 2012 00:11:24 +0200 Subject: [PATCH 5/5] Mention Tomasz Wasiak in change log --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d34cfec..025d286 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,7 +6,7 @@ # $Id$ 08 Apr 2012; Mike Auty gen_bootloader.sh: - Support for Grub 2 + Support for Grub 2, adjustements by Tomasz Wasiak 08 Apr 2012; Sebastian Pipping gen_initramfs.sh, genkernel.conf: