nalika / rpms / grub2

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