Package: grub-pc
Version: 2.04-20
Severity: minor
Tags: patch

Dear Maintainer,

upgrade-from-grub-legacy has a /bin/bash shebang but doesn't use it,
almost at all. Please see diff to make it into /bin/sh, below.

Best,
наб

-- Package-specific info:

*********************** BEGIN /proc/mounts

-- System Information:
Debian Release: 11.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-16-amd64 (SMP w/24 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_FIRMWARE_WORKAROUND, 
TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages grub-pc depends on:
ii  debconf [debconf-2.0]  1.5.77
ii  grub-common            2.04-20
ii  grub-pc-bin            2.04-20
ii  grub2-common           2.04-20
ii  ucf                    3.0043

grub-pc recommends no packages.

grub-pc suggests no packages.

-- debconf information excluded
--- grub2-2.06-orig/debian/legacy/upgrade-from-grub-legacy	2022-06-10 11:15:11.000000000 +0200
+++ grub2-2.06/debian/legacy/upgrade-from-grub-legacy	2022-08-21 18:53:04.011918812 +0200
@@ -1,7 +1,7 @@
-#!/bin/bash -e
+#!/bin/sh -e
 
-if test ! -f /boot/grub/core.img ; then
-  echo -e "\ncore.img doesn't exist, trying to create it.\n" >&2
+if ! [ -f /boot/grub/core.img ]; then
+  printf '%s\n' "" "core.img doesn't exist, trying to create it." "" >&2
   grub-install --no-floppy --grub-setup=/bin/true "(hd0)" > /dev/null
 fi
 
@@ -13,8 +13,8 @@
   UPGRADE_FROM_GRUB_LEGACY=1 \
   /var/lib/dpkg/info/grub-pc.postinst configure dummy-version
 
-if test ! -f /boot/grub/grub.cfg ; then
-  echo -e "\nCalling update-grub to generate grub.cfg\n" >&2
+if ! [ -f /boot/grub/grub.cfg ]; then
+  printf '%s\n' "" "Calling update-grub to generate grub.cfg" "" >&2
   update-grub || cat << EOF
 Failed to generate /boot/grub/grub.cfg but GRUB2 has been already installed to
 your MBR.
@@ -27,10 +27,18 @@
 
 # These never contain any valuable information, and they aren't useful for
 # boot anymore, since we just overwrote MBR/PBR.
-rm -f /boot/grub/{{xfs,reiserfs,e2fs,fat,jfs,minix}_stage1_5,stage{1,2}}
+#
 # Remove marker file used to indicate that grub-install was run rather than
 # this script.  Since stage2 has been removed, we don't need this any more.
-rm -f /boot/grub/grub2-installed
+rm -f /boot/grub/xfs_stage1_5 \
+      /boot/grub/reiserfs_stage1_5 \
+      /boot/grub/e2fs_stage1_5 \
+      /boot/grub/fat_stage1_5 \
+      /boot/grub/jfs_stage1_5 \
+      /boot/grub/minix_stage1_5 \
+      /boot/grub/stage1 \
+      /boot/grub/stage2 \
+      /boot/grub/grub2-installed
 
 cat << EOF
 

Attachment: signature.asc
Description: PGP signature

Reply via email to