Support for Grub 2
authorMike Auty <ikelos@gentoo.org>
Sun, 8 Apr 2012 19:31:37 +0000 (21:31 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Sun, 8 Apr 2012 19:31:37 +0000 (21:31 +0200)
ChangeLog
gen_bootloader.sh

index 0e6d697d2e2020684046e5a1c84ea3b6d47adc70..d34cfec074fce2f5a82da01468a525c3dadfe622 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
 # Distributed under the GPL v2
 # $Id$
 
+  08 Apr 2012; Mike Auty <ikelos@gentoo.org> gen_bootloader.sh:
+  Support for Grub 2
+
   08 Apr 2012; Sebastian Pipping <sping@gentoo.org> gen_initramfs.sh,
   genkernel.conf:
   Add "fastest" to supported initrd compressions
index 79531d46b798796f5ecf8244db49db89a88d432c..1debfe99bf95e5b6c889f41b1ff31ff02747229b 100755 (executable)
@@ -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"