Bug#476536: grub-pc: allow update-grub to do not generate single-user entry if not desired

Kiko Piris menorqui at pirispons.net
Thu Apr 17 11:49:33 UTC 2008


Package: grub-pc
Version: 1.96+20080413-1
Severity: wishlist
Tags: patch


The attached patch allows to set a variable (GRUB_NOSINGLE_LINUX) in
/etc/default/grub so that single-user menu entries are not generated if
undesired.

Thanks.



-- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/root / ext3 rw,noatime,nodiratime,data=ordered 0 0
/dev/root /dev/.static/dev ext3 rw,data=ordered 0 0
/dev/hda1 /boot ext3 rw,nosuid,nodev,noexec,noatime,nodiratime,data=ordered 0 0
/dev/hda8 /home reiserfs rw,nosuid,nodev,noatime,nodiratime 0 0
/dev/hda7 /usr ext3 rw,nodev,noatime,nodiratime,data=ordered 0 0
/dev/hda6 /var ext3 rw,nosuid,nodev,noatime,nodiratime,data=ordered 0 0
/dev/hda5 /tmp ext3 rw,nosuid,nodev,noatime,nodiratime,data=ordered 0 0
/dev/hda9 /mnt/home/data xfs rw,nosuid,nodev,noatime,nodiratime,ikeep,noquota 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd0)	/dev/hda
*********************** END /boot/grub/device.map

*********************** BEGIN /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,3)
if font (hd0,7)/share/grub/unicode.pff ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  terminal gfxterm
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, linux 2.6.25" {
	linux	(hd0,1)/vmlinuz-2.6.25 root=/dev/hda3 ro elevator=cfq
}
menuentry "Debian GNU/Linux, linux 2.6.24.4" {
	linux	(hd0,1)/vmlinuz-2.6.24.4 root=/dev/hda3 ro elevator=cfq
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	linux	(hd0,1)/memtest86+.bin
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
*********************** END /boot/grub/grub.cfg

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.24.4
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages grub-pc depends on:
ii  debconf [debconf-2.0]    1.5.20          Debian configuration management sy
ii  grub-common              1.96+20080413-1 GRand Unified Bootloader, version 
ii  libc6                    2.7-10          GNU C Library: Shared libraries
ii  liblzo1                  1.08-3          data compression library (old vers
ii  libncurses5              5.6+20080405-1  Shared libraries for terminal hand

Versions of packages grub-pc recommends:
pn  os-prober                     <none>     (no description available)

-- debconf information:
  grub-pc/linux_cmdline: fillme
  grub-pc/chainload_from_menu.lst: true
-------------- next part --------------
diff -puNr grub-pc~/etc/default/grub grub-pc/etc/default/grub
--- grub-pc~/etc/default/grub	2008-02-28 17:42:18.000000000 +0100
+++ grub-pc/etc/default/grub	2008-04-17 13:47:30.000000000 +0200
@@ -4,3 +4,4 @@ GRUB_DEFAULT=0
 GRUB_TIMEOUT=5
 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
 GRUB_CMDLINE_LINUX=
+GRUB_NOSINGLE_LINUX="false"
diff -puNr grub-pc~/etc/grub.d/10_linux grub-pc/etc/grub.d/10_linux
--- grub-pc~/etc/grub.d/10_linux	2008-04-13 15:39:50.000000000 +0200
+++ grub-pc/etc/grub.d/10_linux	2008-04-17 13:47:26.000000000 +0200
@@ -116,18 +116,20 @@ EOF
 }
 EOF
 
-  cat << EOF
+  if [ "$GRUB_NOSINGLE_LINUX" != "true" ] ; then
+    cat << EOF
 menuentry "${OS}, linux ${version} (single-user mode)" {
 	linux	${grub_dirname}/${basename} root=${GRUB_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
 EOF
-  if test -n "${initrd}" ; then
-    cat << EOF
+    if test -n "${initrd}" ; then
+      cat << EOF
 	initrd	${grub_dirname}/${initrd}
 EOF
-  fi
-  cat << EOF
+    fi
+    cat << EOF
 }
 EOF
+  fi
 
   list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
 done
diff -puNr grub-pc~/usr/sbin/update-grub grub-pc/usr/sbin/update-grub
--- grub-pc~/usr/sbin/update-grub	2008-04-13 15:39:50.000000000 +0200
+++ grub-pc/usr/sbin/update-grub	2008-04-17 13:47:28.000000000 +0200
@@ -158,7 +158,7 @@ esac
 export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH GRUB_PRELOAD_MODULES
 
 # These are optional, user-defined variables.
-export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
+export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_NOSINGLE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
 
 exec > ${grub_cfg}.new
 chmod 444 ${grub_cfg}.new


More information about the Pkg-grub-devel mailing list