Paste number 145313: Proposal: in default grub entry, first try loading grub.cfg from disk

Paste number 145313: Proposal: in default grub entry, first try loading grub.cfg from disk
Pasted by: mark_weaver
When:5 years, 4 months ago
Share:Tweet this! | http://paste.lisp.org/+344H
Channel:None
Paste contents:
Raw Source | XML | Display As
From dca6133ec850450de3f723f6c3db9b52edd27ef7 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Wed, 21 Jan 2015 22:53:02 -0500
Subject: [PATCH] grub.cfg: In default entry, first try to load grub.cfg from
 disk

If grub.cfg is not present in /boot/grub/grub.cfg or /grub/grub.cfg on
the first partition, fall back to the previous behavior.
---
 resources/grub/config/menuentries/common.cfg | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/resources/grub/config/menuentries/common.cfg b/resources/grub/config/menuentries/common.cfg
index eebfbc2..1b08f87 100644
--- a/resources/grub/config/menuentries/common.cfg
+++ b/resources/grub/config/menuentries/common.cfg
@@ -1,8 +1,14 @@
 menuentry 'Load Operating System' {
 	set root='ahci0,msdos1'
-	linux  /vmlinuz root=/dev/sda1 rw
-	if [ -f "/initrd.img" ] ; then
-		initrd /initrd.img
+	if [ -f "/boot/grub/grub.cfg" ] ; then
+		configfile /boot/grub/grub.cfg
+	elif [ -f "/grub/grub.cfg" ] ; then
+		configfile /grub/grub.cfg
+	else
+		linux  /vmlinuz root=/dev/sda1 rw
+		if [ -f "/initrd.img" ] ; then
+			initrd /initrd.img
+		fi
 	fi
 }
 menuentry 'Parse ISOLINUX menu (USB)' {
-- 
2.2.1

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.