File 0013-Fix-bashisms-in-scripts.patch of Package sblim-sfcb

From 20b3937ac0b15647ffe3368e573db46f56384b2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Tue, 28 Nov 2017 10:33:18 +0100
Subject: [PATCH 13/25] Fix bashisms in scripts

From Wed Nov 19 23:37:00 UTC 2014 - Led <ledest@gmail.com>
---
 sfcbrepos.sh.in   | 18 +++++++++---------
 sfcbstage.sh.in   |  8 ++++----
 sfcbunstage.sh.in |  8 ++++----
 sfcbuuid.sh.in    |  6 +++---
 xmltest           | 26 +++++++++++++++-----------
 5 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/sfcbrepos.sh.in b/sfcbrepos.sh.in
index 71a6c38413db..176b4e34d51f 100644
--- a/sfcbrepos.sh.in
+++ b/sfcbrepos.sh.in
@@ -53,15 +53,15 @@ done
 if [ "$help" = "1" ]
 then
     usage
-    echo -e "\t-h display help message"
-    echo -e "\t-f force repository creation"
-    echo -e "\t-i do not migrate instances from previous repository (default=do migrate)"
-    echo -e "\t-X create repository in non-native format as specifed by argument"
-    echo -e "\t-s specify staging directory [@localstatedir@/lib/sfcb/stage]"
-    echo -e "\t-r specify repository directory [@localstatedir@/lib/sfcb/registration]"
-    echo -e "\t-c specify directory containing CIM Schema MOFs [@datadir@/sfcb/CIM]"
-    echo -e "\t-t create tiny class repository by omitting inheritance information"
-    echo -e "\t-z compress repository with gzip"
+    echo "	-h display help message"
+    echo "	-f force repository creation"
+    echo "	-i do not migrate instances from previous repository (default=do migrate)"
+    echo "	-X create repository in non-native format as specifed by argument"
+    echo "	-s specify staging directory [@localstatedir@/lib/sfcb/stage]"
+    echo "	-r specify repository directory [@localstatedir@/lib/sfcb/registration]"
+    echo "	-c specify directory containing CIM Schema MOFs [@datadir@/sfcb/CIM]"
+    echo "	-t create tiny class repository by omitting inheritance information"
+    echo "	-z compress repository with gzip"
     echo
     echo "Use to create sfcb provider registration and class repository."
     exit 0
diff --git a/sfcbstage.sh.in b/sfcbstage.sh.in
index a63bbe24e92e..c10f6b588d0f 100644
--- a/sfcbstage.sh.in
+++ b/sfcbstage.sh.in
@@ -40,10 +40,10 @@ done
 if [ "$help" = "1" ]
 then
     usage
-    echo -e "\t-h display help message"
-    echo -e "\t-n specify CIM namespace [root/cimv2]"
-    echo -e "\t-s specify staging directory [@localstatedir@/lib/sfcb/stage]"
-    echo -e "\t-r specify sfcb registration file"
+    echo "	-h display help message"
+    echo "	-n specify CIM namespace [root/cimv2]"
+    echo "	-s specify staging directory [@localstatedir@/lib/sfcb/stage]"
+    echo "	-r specify sfcb registration file"
     echo
     echo Use this command to copy registration files to the sfcb staging area.
     exit 0
diff --git a/sfcbunstage.sh.in b/sfcbunstage.sh.in
index bceb345dd6c6..87b9b243b838 100644
--- a/sfcbunstage.sh.in
+++ b/sfcbunstage.sh.in
@@ -41,10 +41,10 @@ done
 if [ "$help" = "1" ]
 then
     usage
-    echo -e "\t-h display help message"
-    echo -e "\t-n specify CIM namespace [root/cimv2]"
-    echo -e "\t-s specify staging directory [@localstatedir@/lib/sfcb/stage]"
-    echo -e "\t-r specify sfcb registration file "
+    echo "	-h display help message"
+    echo "	-n specify CIM namespace [root/cimv2]"
+    echo "	-s specify staging directory [@localstatedir@/lib/sfcb/stage]"
+    echo "	-r specify sfcb registration file "
     echo
     echo Use this command to remove registration files from the sfcb staging area.
     exit 0
diff --git a/sfcbuuid.sh.in b/sfcbuuid.sh.in
index d3d25455fbbc..5d3e3ecbc92e 100644
--- a/sfcbuuid.sh.in
+++ b/sfcbuuid.sh.in
@@ -38,9 +38,9 @@ done
 if [ "$help" = "1" ]
 then
     usage
-    echo -e "\t-h display help message"
-    echo -e "\t-f force uuid file creation"
-    echo -e "\t-u specify uuid file name [@localstatedir@/lib/sfcb/uuid]"
+    echo "	-h display help message"
+    echo "	-f force uuid file creation"
+    echo "	-u specify uuid file name [@localstatedir@/lib/sfcb/uuid]"
     echo
     echo "Use to create a universally unique identifier for sfcb."
     exit 0
diff --git a/xmltest b/xmltest
index 49c47e8c0916..e316f8a34eb7 100755
--- a/xmltest
+++ b/xmltest
@@ -30,8 +30,8 @@ if ! which wbemcat > /dev/null; then
 fi
 
 # ----------------------------------------------------------------------------
-function _runxmltest {
-   typeset _TESTXML=$1
+_runxmltest() {
+   _TESTXML=$1
 
    _TEST=${_TESTXML%.xml}
    _TESTDIR=$( dirname $_TEST)
@@ -41,8 +41,9 @@ function _runxmltest {
    echo -n "Running test $_TESTXML ... "
 
    # Make sure we will be able to write the result file
-   if [[ ! -w $_TESTDIR ]]; then
-      echo "FAILED"; echo -e "\tCannot write to $_TESTDIR"
+   if [ ! -w $_TESTDIR ]; then
+      echo "FAILED"
+      echo "	Cannot write to $_TESTDIR"
       continue
    fi
 
@@ -52,21 +53,24 @@ function _runxmltest {
    # Send the test CIM-XML to the CIMOM and save the response, 
    # stripping off the http header
    wbemcat $_TESTXML | awk '/<\?xml.*/{xml=1} {if (xml) print}' > $_TESTRESULT
-   if [[ $? -ne 0 ]]; then
-      echo "FAILED"; echo -e "\twbemcat failed to send CIM-XML request"
+   if [ $? -ne 0 ]; then
+      echo "FAILED"
+      echo "	wbemcat failed to send CIM-XML request"
       _RC=1
       continue
    fi
 
    # If we dont yet have the expected result file, then save this response 
    # as the (new) expected result
-   if [[ ! -f $_TESTOK ]]; then
-      echo "OK"; echo -e "\tSaving response as $_TESTOK"
+   if [ ! -f $_TESTOK ]; then
+      echo "OK"
+      echo "	Saving response as $_TESTOK"
       mv $_TESTRESULT $_TESTOK
  
    # Compare the response XML against the expected XML for differences
    elif ! diff --brief $_TESTOK $_TESTRESULT > /dev/null; then
-      echo "FAILED"; echo -e "\tCheck $_TESTRESULT for errors"
+      echo "FAILED"
+      echo "	Check $_TESTRESULT for errors"
       _RC=1;
       continue
 
@@ -78,10 +82,10 @@ function _runxmltest {
 }
 # ----------------------------------------------------------------------------
 
-if [[ -f $1 ]]; then
+if [ -f $1 ]; then
    _runxmltest $1
 else
-   if [[ -d $1 ]]; then
+   if [ -d $1 ]; then
       _DIR=$1
    else
       _DIR=./
-- 
2.15.0

openSUSE Build Service is sponsored by