dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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