]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Avoid use of non-portable echo -n in grub-mkconfig
authorAndrei Borzenkov <arvidjaar@gmail.com>
Sun, 7 Dec 2014 11:56:17 +0000 (14:56 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sun, 7 Dec 2014 11:56:17 +0000 (14:56 +0300)
util/grub-mkconfig_lib.in(version_test_gt): "echo -n" is not really needed,
final newline is stripped by command substitution.

util/grub.d/10_kfreebsd.in, util/grub.d/10_linux.in,
util/grub.d/20_linux_xen.in: change how list is built, to avoid echo -n
completely.

util/grub.d/30_os-prober.in: add spaces to printed line directly

Closes 43668.

ChangeLog
util/grub-mkconfig_lib.in
util/grub.d/10_kfreebsd.in
util/grub.d/10_linux.in
util/grub.d/20_linux_xen.in
util/grub.d/30_os-prober.in

index e5c9fd3462a25e098462ccf7af22eedbad4f86c0..b23f0698d6249c4ff3d0efc6f04e199ff7512b4c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-12-07  Andrei Borzenkov  <arvidjaar@gmail.com>
+
+       * util/grub-mkconfig_lib.in (version_test_gt): Remove redundant
+       non-portable '-n' echo option.
+       * util/grub.d/10_kfreebsd.in: Change how list is built to avoid
+       non-portable 'echo -n.
+       * util/grub.d/10_linux.in: Likewise (closes 43668).
+       * util/grub.d/20_linux_xen.in: Likewise.
+       * util/grub.d/30_os-prober.in: Print spaces directly to avoid
+       non-portable 'echo -n'.
+
 2014-12-07  Curtis Larsen <larsen@dixie.edu>
 
        * grub-core/net/tcp.c (grub_net_recv_tcp_packet): Fix double
index 14fadbcbbbdf1436cbd7f412e918e6b0351d81c0..29ef865d4f55798c2b5135e91c1ee6dbe37f4db2 100644 (file)
@@ -246,8 +246,8 @@ version_test_gt ()
   fi
   case "$version_test_gt_a:$version_test_gt_b" in
     *.old:*.old) ;;
-    *.old:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
-    *:*.old) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
+    *.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
+    *:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
   esac
   version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
   return "$?"
index ba7175bd712302738d148a4edf36cfa0d09c7e3f..65f6c32a09d9240875bb73961b3fb10de7d9db2e 100644 (file)
@@ -143,9 +143,12 @@ EOF
 EOF
 }
 
-list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do
-        if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
-      done`
+list=
+for i in /boot/kfreebsd-* /boot/kernel/kernel ; do
+  if grub_file_is_not_garbage "$i" ; then
+    list="$list $i"
+  fi
+done
 prepare_boot_cache=
 boot_device_id=
 title_correction_code=
index d2e2a8fd37706f64ded528c7eaaca7f219d0fe91..a2a84dce4e09f1de5caed6be8395f6b3cf21e6d7 100644 (file)
@@ -147,13 +147,15 @@ EOF
 machine=`uname -m`
 case "x$machine" in
     xi?86 | xx86_64)
-       list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
-                  if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
-              done` ;;
+       list=
+       for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+           if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+       done ;;
     *) 
-       list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
-                  if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
-            done` ;;
+       list=
+       for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+                  if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+       done ;;
 esac
 
 case "$machine" in
index 2e777584cd7f0ce5fdfd2481a24045868bb5304d..de34c8d73100a2ecf072a2d5f5cf232bb4a8b08b 100644 (file)
@@ -137,7 +137,8 @@ EOF
 EOF
 }
 
-linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
+linux_list=
+for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
     if grub_file_is_not_garbage "$i"; then
        basename=$(basename $i)
        version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
@@ -149,9 +150,9 @@ linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
                break
            fi
        done
-        if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then echo -n "$i " ; fi
+        if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then linux_list="$linux_list $i" ; fi
     fi
-    done`
+done
 if [ "x${linux_list}" = "x" ] ; then
     exit 0
 fi
@@ -165,9 +166,10 @@ file_is_not_sym () {
     esac
 }
 
-xen_list=`for i in /boot/xen*; do
-        if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then echo -n "$i " ; fi
-      done`
+xen_list=
+for i in /boot/xen*; do
+    if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then xen_list="$xen_list $i" ; fi
+done
 prepare_boot_cache=
 boot_device_id=
 
index 6f38c82a554eb2e43650ebc28bb3d1f711d5f38e..4ee6015659fd41b4b7ae7c82ca7e1cd5917cd206 100644 (file)
@@ -322,9 +322,8 @@ EOF
 EOF
     ;;
     *)
-      echo -n "  "
       # TRANSLATORS: %s is replaced by OS name.
-      gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2
+      gettext_printf "%s is not yet supported by grub-mkconfig.\n" "  ${LONGNAME}" >&2
     ;;
   esac
 done