[COMMON] Fix some bashisms 22/122122/3
authorGuillaume Lambert <guillaume.lambert@orange.com>
Mon, 8 Mar 2021 20:38:31 +0000 (21:38 +0100)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Thu, 24 Jun 2021 13:46:51 +0000 (13:46 +0000)
pointed out by checkbashisms:
- variable name HOSTNAME
- source instead of .
- sleep with suffix
- string increments

And migrate a few shebangs to /bin/sh

Issue-ID: OOM-2643
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: I653c14454a3232b5a349ca1564ece53ddc94289d

12 files changed:
docs/master_nfs_node.sh
docs/openstack-k8s-controlnode.sh
docs/openstack-k8s-workernode.sh
docs/openstack-nfs-server.sh
kubernetes/helm/plugins/deploy/deploy.sh
kubernetes/helm/plugins/undeploy/undeploy.sh
kubernetes/robot/demo-k8s.sh
kubernetes/robot/ete-k8s.sh
kubernetes/robot/eteHelm-k8s.sh
kubernetes/sdnc/components/sdnc-prom/resources/bin/ensureSdncActive.sh
kubernetes/sdnc/components/sdnc-prom/resources/bin/ensureSdncStandby.sh
kubernetes/sdnc/resources/geo/bin/switchVoting.sh

index 4a7a8db..32574c9 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 usage () {
   echo "Usage:"
@@ -23,7 +23,7 @@ sudo chown nobody:nogroup /dockerdata-nfs/
 #Update the /etc/exports
 NFS_EXP=""
 for i in $@; do
-  NFS_EXP+="$i(rw,sync,no_root_squash,no_subtree_check) "
+  NFS_EXP="${NFS_EXP}$i(rw,sync,no_root_squash,no_subtree_check) "
 done
 echo "/dockerdata-nfs "$NFS_EXP | sudo tee -a /etc/exports
 
index cd219aa..d1515a7 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 DOCKER_VERSION=18.09.5
 
@@ -18,10 +18,10 @@ systemctl daemon-reload
 systemctl restart docker
 apt-mark hold docker-ce
 
-IP_ADDR=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'`
-HOSTNAME=`hostname`
+IP_ADDR=$(ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}')
+HOST_NAME=$(hostname)
 
-echo "$IP_ADDR $HOSTNAME" >> /etc/hosts
+echo "$IP_ADDR $HOST_NAME" >> /etc/hosts
 
 docker login -u docker -p docker nexus3.onap.org:10001
 
index 3f32d05..8b1b9e4 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 DOCKER_VERSION=18.09.5
 
@@ -18,10 +18,10 @@ systemctl daemon-reload
 systemctl restart docker
 apt-mark hold docker-ce
 
-IP_ADDR=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'`
-HOSTNAME=`hostname`
+IP_ADDR=$(ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}')
+HOST_NAME=$(hostname)
 
-echo "$IP_ADDR $HOSTNAME" >> /etc/hosts
+echo "$IP_ADDR $HOST_NAME" >> /etc/hosts
 
 docker login -u docker -p docker nexus3.onap.org:10001
 
index 1db04ea..395d04f 100644 (file)
@@ -1,11 +1,11 @@
-#!/bin/bash
+#!/bin/sh
 
 apt-get update
 
-IP_ADDR=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'`
-HOSTNAME=`hostname`
+IP_ADDR=$(ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}')
+HOST_NAME=$(hostname)
 
-echo "$IP_ADDR $HOSTNAME" >> /etc/hosts
+echo "$IP_ADDR $HOST_NAME" >> /etc/hosts
 
 sudo apt-get install make -y
 
index ce8e802..4fec398 100755 (executable)
@@ -251,7 +251,7 @@ deploy() {
       fi
          if [ "$DELAY" = "true" ]; then
                echo sleep 3m
-               sleep 3m
+               sleep 180
          fi
     else
       array=($(echo "$ALL_HELM_RELEASES" | grep "${RELEASE}-${subchart}"))
index 790f84f..35fc4ca 100755 (executable)
@@ -49,4 +49,4 @@ case "${1:-"help"}" in
     ;;
 esac
 
-exit 0
\ No newline at end of file
+exit 0
index 099f80c..5e4e216 100755 (executable)
@@ -222,7 +222,7 @@ ETEHOME=/var/opt/ONAP
 
 if [ $execscript ]; then
    for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
-      [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
+      [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && . "$DIR/$SCRIPTDIR/$script"
    done
 fi
 
index 15d07fb..01cf092 100755 (executable)
@@ -78,7 +78,7 @@ ETEHOME=/var/opt/ONAP
 
 if [ "${!#}" = "execscript" ]; then
    for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
-      [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
+      [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && . "$DIR/$SCRIPTDIR/$script"
    done
 fi
 
index d5e2fa4..8b74da7 100755 (executable)
@@ -46,7 +46,7 @@ ETEHOME=/var/opt/ONAP
 
 if [ "${!#}" = "execscript" ]; then
    for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
-      [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
+      [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && . "$DIR/$SCRIPTDIR/$script"
    done
 fi
 
index feb6662..099103c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
-{{/*
 
+{{/*
 # Copyright © 2018 Amdocs
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
index 9485833..05a1701 100755 (executable)
@@ -1,6 +1,6 @@
-#!/bin/bash
-{{/*
+#!/bin/sh
 
+{{/*
 # Copyright © 2018 Amdocs
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
index 65b7626..a276854 100755 (executable)
@@ -1,6 +1,6 @@
-#!/bin/bash
-{{/*
+#!/bin/sh
 
+{{/*
 # Copyright © 2018 Amdocs
 #
 # Licensed under the Apache License, Version 2.0 (the "License");