nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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