Debian Bug report logs - #667610
Please allow for bypassing the autoconfiguration of grub2

Package: grub2; Maintainer for grub2 is GRUB Maintainers <[email protected]>; Source for grub2 is src:grub2 (PTS, buildd, popcon).

Reported by: Wouter Verhelst <[email protected]>

Date: Thu, 5 Apr 2012 10:27:01 UTC

Severity: wishlist

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], GRUB Maintainers <[email protected]>:
Bug#667610; Package grub2. (Thu, 05 Apr 2012 10:27:05 GMT) (full text, mbox, link).


Acknowledgement sent to Wouter Verhelst <[email protected]>:
New Bug report received and forwarded. Copy sent to GRUB Maintainers <[email protected]>. (Thu, 05 Apr 2012 10:27:05 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: Wouter Verhelst <[email protected]>
To: [email protected]
Subject: Please allow for bypassing the autoconfiguration of grub2
Date: Thu, 5 Apr 2012 11:55:44 +0200
Package: grub2
Severity: wishlist

Hi,

I'm currently working on a script for a customer to generate a
customized image for them to use on their embedded devices. The output
of this script will be a CompactFlash device, ready to be put in their
device (an Atom-based board). This script must run fully noninteractive,
so has DEBCONF_FRONTEND=noninteractive.

One of the things the script must do is install a boot loader, in casu
grub2. However, this fails because grub2 assumes that it must at all
times be installed to a boot record if it's installed somewhere, and
will fail to install properly if that isn't true. Now while it can be
useful to have a bootloader be automatically configured upon
installation, it's fairly annoying if I have to resort to ugly tricks to
make the postinst script believe it doesn't have to do anything.
Instead, I'd prefer it if it were possible to just tell it to not do
anything, so that I can do this myself.

A proposed patch (not tested, but gets the idea across):

diff -ruN grub2-1.99.orig/debian/postinst.in grub2-1.99/debian/postinst.in
--- grub2-1.99.orig/debian/postinst.in	2012-04-05 11:33:26.638928567 +0200
+++ grub2-1.99/debian/postinst.in	2012-04-05 11:45:43.746939629 +0200
@@ -291,6 +291,11 @@
   configure)
     . /usr/share/debconf/confmodule
 
+    db_get grub2/configure_grub || true
+    if [ "$RET" = "false" ]; then
+      exit 0
+    fi
+
     if dpkg --compare-versions "$2" lt-nl 1.99-1; then
       # Force dpkg to replace this directory with a symlink.
       if [ ! -L /usr/share/doc/@PACKAGE@ ] && [ -d /usr/share/doc/@PACKAGE@ ]; then
diff -ruN grub2-1.99.orig/debian/templates.in grub2-1.99/debian/templates.in
--- grub2-1.99.orig/debian/templates.in	2012-04-05 11:47:12.058940963 +0200
+++ grub2-1.99/debian/templates.in	2012-04-05 11:46:53.330940571 +0200
@@ -43,3 +43,11 @@
  .
  If you do not understand this message, or if there are no custom
  boot menu entries, you can ignore this message.
+
+Template: grub2/configure_grub
+Type: boolean
+Default: true
+Description: not shown
+ This template is not shown. However, you can preseed it to false to
+ skip the autoconfiguration of grub2, in case you want to bypass it or
+ replace it with a local scheme.

Since we only db_get the value and don't db_input it, it's never shown
to a user, and the default value shouldn't result in any changes. As
such, this should be non-intrusive for the common case, while allowing
people to bypass the autoconfiguration entirely if they don't need it,
as in my case.

Thanks,

-- 
The volume of a pizza of thickness a and radius z can be described by
the following formula:

pi zz a




Information forwarded to [email protected], GRUB Maintainers <[email protected]>:
Bug#667610; Package grub2. (Thu, 05 Apr 2012 11:09:03 GMT) (full text, mbox, link).


Acknowledgement sent to Colin Watson <[email protected]>:
Extra info received and forwarded to list. Copy sent to GRUB Maintainers <[email protected]>. (Thu, 05 Apr 2012 11:09:03 GMT) (full text, mbox, link).


Message #10 received at [email protected] (full text, mbox, reply):

From: Colin Watson <[email protected]>
To: Wouter Verhelst <[email protected]>, [email protected]
Subject: Re: Bug#667610: Please allow for bypassing the autoconfiguration of grub2
Date: Thu, 5 Apr 2012 12:05:34 +0100
On Thu, Apr 05, 2012 at 11:55:44AM +0200, Wouter Verhelst wrote:
> I'm currently working on a script for a customer to generate a
> customized image for them to use on their embedded devices. The output
> of this script will be a CompactFlash device, ready to be put in their
> device (an Atom-based board). This script must run fully noninteractive,
> so has DEBCONF_FRONTEND=noninteractive.
> 
> One of the things the script must do is install a boot loader, in casu
> grub2. However, this fails because grub2 assumes that it must at all
> times be installed to a boot record if it's installed somewhere, and
> will fail to install properly if that isn't true.

Why not install grub-pc-bin (etc.) instead?  I am very strongly averse
to further complicating the postinst, which is already nightmarishly
complicated; I designed the -bin packages to support this kind of thing.

Cheers,

-- 
Colin Watson                                       [[email protected]]




Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Fri May 16 09:34:31 2025; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.