]> code.delx.au - refind/commitdiff
Fixed bugs in mkrlconf and refind-install that could cause kernel
authorsrs5694 <srs5694@users.sourceforge.net>
Sun, 22 Nov 2015 02:55:21 +0000 (21:55 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Sun, 22 Nov 2015 02:55:21 +0000 (21:55 -0500)
options to be omitted from refind_linux.conf

NEWS.txt
mkrlconf
refind-install

index 8ca9348146d2d254edf75446990b28fbc6e993d9..68893db64687d03bdedd8a118449cd94487076a0 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,20 @@
 0.10.1 (??/??/201?):
 --------------------
 
+- Fixed bugs in mkrlconf and in refind-install that could cause some kernel
+  options to be excluded from refind_linux.conf. There were two trouble
+  conditions:
+  - Previously, these scripts assumed that the first option in
+    /proc/cmdline was the kernel's filename, but this isn't always the
+    case. (In particular, when gummiboot launches the kernel, this is not
+    true. It might be an incorrect assumption in some other cases, too.)
+    The fix involves checking for likely signs of a kernel filename before
+    discarding this first option.
+  - These scripts cut the "initrd=*" option from /proc/cmdline, but the
+    call to "sed" was overzealous and cut until the end of input. This
+    usually worked, since the initrd= option was usually last on the line;
+    but if it wasn't, any options following initrd= would be lost.
+
 - Added "kernel*" as a matching pattern for Linux kernels, since this is
   what Gentoo uses by default.
 
index 031c82a6012af41e2e74f759eb64f67ba520814a..9855dec3c48a9d300f6188d57a29bdaeb78761dc 100755 (executable)
--- a/mkrlconf
+++ b/mkrlconf
@@ -45,7 +45,12 @@ if [[ ! -f $RLConfFile || $1 == "--force" ]] ; then
             RootFS=$Uuid
         fi
     fi
-    DefaultOptions=`cat /proc/cmdline | cut -d ' ' -f 2- | sed 's/$/ /' | sed 's/initrd=.* //g' | sed 's/ *$//'`
+    FirstCmdlineOption=`cat /proc/cmdline | cut -d ' ' -f 1`
+    if [[ "$FirstCmdlineOption" =~ (vmlinuz|bzImage|kernel) ]] ; then
+        DefaultOptions=`cat /proc/cmdline | cut -d ' ' -f 2- | sed 's/\S*initrd=\S*//g' | sed 's/ *$//' | sed 's/^ *//'`
+    else
+        DefaultOptions=`cat /proc/cmdline | sed 's/\S*initrd=\S*//g' | sed 's/ *$//' | sed 's/^ *//'`
+    fi
     echo "\"Boot with standard options\"  \"$DefaultOptions\"" > $RLConfFile
     echo "\"Boot to single-user mode\"    \"$DefaultOptions single\"" >> $RLConfFile
     echo "\"Boot with minimal options\"   \"ro root=$RootFS\"" >> $RLConfFile
index 2562d1ea0c52b74a7de91ebb121bae3a66214bd6..f0fc2b22ace0c795927101e13adc905a3971d8d5 100755 (executable)
@@ -1099,7 +1099,12 @@ GenerateRefindLinuxConf() {
          fi
       fi
       if [[ $RootDir == "/" ]] ; then
-         DefaultOptions=`cat /proc/cmdline | cut -d ' ' -f 2- | sed 's/$/ /' | sed 's/initrd=.* //g' | sed 's/ *$//'`
+         local FirstCmdlineOption=`cat /proc/cmdline | cut -d ' ' -f 1`
+         if [[ "$FirstCmdlineOption" =~ (vmlinuz|bzImage|kernel) ]] ; then
+            DefaultOptions=`cat /proc/cmdline | cut -d ' ' -f 2- | sed 's/\S*initrd=\S*//g' | sed 's/ *$//' | sed 's/^ *//'`
+         else
+            DefaultOptions=`cat /proc/cmdline | sed 's/\S*initrd=\S*//g' | sed 's/ *$//' | sed 's/^ *//'`
+         fi
       else
          if [[ -f "$RootDir/etc/default/grub" ]] ; then
             # We want the default options used by the distribution, stored here....