nalika / rpms / grub2

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