Avoid use of non-portable echo -n in grub-mkconfig

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.
This commit is contained in:
Andrei Borzenkov 2014-12-07 14:56:17 +03:00
parent 06eadf5ebf
commit cdae5bf208
6 changed files with 36 additions and 19 deletions

View File

@ -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

View 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 "$?"

View 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=

View 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

View 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=

View 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