]> code.delx.au - refind/blobdiff - refind-install
Fixed bugs in mkrlconf and refind-install that could cause kernel
[refind] / refind-install
index b399c7f822790b1b5d27fda598ac3e0e21ab5801..f0fc2b22ace0c795927101e13adc905a3971d8d5 100755 (executable)
@@ -201,8 +201,8 @@ ReadYesNo() {
 CheckForFiles() {
    # Note: $ThisDir points to real (not symlinked) script home on Linux,
    # enabling creating a symlink in /usr/sbin (or wherever); but on OS X,
-   # "readlink" doesn't do the right thing, so the script must not be a
-   # symlink under OS X.
+   # "readlink" doesn't do the same thing as under Linux, so the script
+   # must not be a symlink under OS X.
    case "$OSTYPE" in
       darwin*)
            ThisDir="$( cd -P "${BASH_SOURCE%/*}" && pwd )"
@@ -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....