Blame SOURCES/0018-Prefer-more-portable-test-1-constructs.patch

d41074
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a85e8e
From: Colin Watson <cjwatson@ubuntu.com>
a85e8e
Date: Fri, 17 Jan 2014 15:24:50 +0000
d41074
Subject: [PATCH] Prefer more portable test(1) constructs
a85e8e
a85e8e
* util/grub.d/00_header.in (make_timeout): Use && rather than test
a85e8e
-a.
a85e8e
* util/grub.d/10_windows.in: Likewise.
a85e8e
* util/grub.d/10_netbsd.in (netbsd_load_fs_module): Use || rather
a85e8e
than test -o.
a85e8e
* util/grub.d/30_os-prober.in: Use && rather than test -a, and ||
a85e8e
rather than test -o.
a85e8e
---
a85e8e
 ChangeLog                   | 12 +++++++++++-
a85e8e
 util/grub.d/00_header.in    |  2 +-
a85e8e
 util/grub.d/10_netbsd.in    |  2 +-
a85e8e
 util/grub.d/10_windows.in   |  4 ++--
a85e8e
 util/grub.d/30_os-prober.in |  4 ++--
a85e8e
 5 files changed, 17 insertions(+), 7 deletions(-)
a85e8e
a85e8e
diff --git a/ChangeLog b/ChangeLog
d41074
index 6613b4ee52b..c8e95a6b98d 100644
a85e8e
--- a/ChangeLog
a85e8e
+++ b/ChangeLog
a85e8e
@@ -1,4 +1,14 @@
a85e8e
-2014-01-17  Colin Watson  <cjwatson@debian.org>
a85e8e
+2014-01-17  Colin Watson  <cjwatson@ubuntu.com>
a85e8e
+
a85e8e
+	* util/grub.d/00_header.in (make_timeout): Use && rather than test
a85e8e
+	-a.
a85e8e
+	* util/grub.d/10_windows.in: Likewise.
a85e8e
+	* util/grub.d/10_netbsd.in (netbsd_load_fs_module): Use || rather
a85e8e
+	than test -o.
a85e8e
+	* util/grub.d/30_os-prober.in: Use && rather than test -a, and ||
a85e8e
+	rather than test -o.
a85e8e
+
a85e8e
+2014-01-17  Colin Watson  <cjwatson@ubuntu.com>
a85e8e
 
a85e8e
 	* grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove
a85e8e
 	redundant preprocessor conditional.
a85e8e
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
d41074
index 0c82f231574..ce2ec819d8c 100644
a85e8e
--- a/util/grub.d/00_header.in
a85e8e
+++ b/util/grub.d/00_header.in
a85e8e
@@ -285,7 +285,7 @@ make_timeout ()
a85e8e
     if [ "x${3}" != "x" ] ; then
a85e8e
 	timeout="${2}"
a85e8e
 	style="${3}"
a85e8e
-    elif [ "x${1}" != "x" -a "x${1}" != "x0" ] ; then
a85e8e
+    elif [ "x${1}" != "x" ] && [ "x${1}" != "x0" ] ; then
a85e8e
 	# Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
a85e8e
 	timeout="${1}"
a85e8e
 	if [ "x${2}" != "x0" ] ; then
a85e8e
diff --git a/util/grub.d/10_netbsd.in b/util/grub.d/10_netbsd.in
d41074
index 29a0e41a9a5..9988a42bc50 100644
a85e8e
--- a/util/grub.d/10_netbsd.in
a85e8e
+++ b/util/grub.d/10_netbsd.in
a85e8e
@@ -69,7 +69,7 @@ netbsd_load_fs_module ()
a85e8e
   kversion=$(zcat -f "${kernel}" | strings | sed -n -e '/^@(#)NetBSD/ { s/^@(#)NetBSD \([0-9\.]*\) .*$/\1/g ; p ; q ; }')
a85e8e
   kmodule="/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod"
a85e8e
 
a85e8e
-  if test -z "$karch" -o -z "$kversion" -o ! -f "${kmodule}"; then
a85e8e
+  if test -z "$karch" || test -z "$kversion" || test ! -f "${kmodule}"; then
a85e8e
     return
a85e8e
   fi
a85e8e
 
a85e8e
diff --git a/util/grub.d/10_windows.in b/util/grub.d/10_windows.in
d41074
index 9025914f6cf..48bd955464b 100644
a85e8e
--- a/util/grub.d/10_windows.in
a85e8e
+++ b/util/grub.d/10_windows.in
a85e8e
@@ -66,11 +66,11 @@ for drv in $drives ; do
a85e8e
   osid=
a85e8e
 
a85e8e
   # Check for Vista bootmgr.
a85e8e
-  if [ -f "$dir"/bootmgr -a -f "$dir"/boot/bcd ] ; then
a85e8e
+  if [ -f "$dir"/bootmgr ] && [ -f "$dir"/boot/bcd ] ; then
a85e8e
     OS="$(gettext "Windows Vista/7 (loader)")"
a85e8e
     osid=bootmgr
a85e8e
   # Check for NTLDR.
a85e8e
-  elif [ -f "$dir"/ntldr -a -f "$dir"/ntdetect.com -a -f "$dir"/boot.ini ] ; then
a85e8e
+  elif [ -f "$dir"/ntldr ] && [ -f "$dir"/ntdetect.com ] && [ -f "$dir"/boot.ini ] ; then
a85e8e
     OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="$(gettext "Windows NT/2000/XP (loader)")"
a85e8e
     osid=ntldr
a85e8e
     needmap=t
a85e8e
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
d41074
index 0470e66853d..7cf8487d63a 100644
a85e8e
--- a/util/grub.d/30_os-prober.in
a85e8e
+++ b/util/grub.d/30_os-prober.in
a85e8e
@@ -30,7 +30,7 @@ if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
a85e8e
   exit 0
a85e8e
 fi
a85e8e
 
a85e8e
-if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
a85e8e
+if [ -z "`which os-prober 2> /dev/null`" ] || [ -z "`which linux-boot-prober 2> /dev/null`" ] ; then
a85e8e
   # missing os-prober and/or linux-boot-prober
a85e8e
   exit 0
a85e8e
 fi
a85e8e
@@ -119,7 +119,7 @@ for OS in ${OSPROBED} ; do
a85e8e
       EXPUUID="${EXPUUID}@${DEVICE#*@}"
a85e8e
   fi
a85e8e
 
a85e8e
-  if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" -a "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
a85e8e
+  if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
a85e8e
     echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
a85e8e
     continue
a85e8e
   fi