beautysh: re-format

beautysh is enabled in the openbmc-build-scripts on Bash/Zsh/POSIX-sh
files to have a consistent formatting.  Re-run the formatter on the
whole repository.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I38048dcd55f2db51bcc87b33ea0748a6cfdcca68
diff --git a/tools/dreport.d/dreport b/tools/dreport.d/dreport
index 3009b80..b390674 100755
--- a/tools/dreport.d/dreport
+++ b/tools/dreport.d/dreport
@@ -1,6 +1,6 @@
 #! /bin/bash
 
-help=$"
+help=$(cat << EOF
         dreport creates an archive(xz compressed) consisting of the following:
                 * Configuration information
                 * Debug information
@@ -33,7 +33,8 @@
         -V, --version         Output version information.
         -q, —-quiet           Only log fatal errors to stderr
         -h, —-help            Display this help and exit.
-"
+EOF
+)
 
 #CONSTANTS
 declare -rx TRUE=1
@@ -126,7 +127,7 @@
 
     #Executes plugins based on the type.
     for i in $plugin_path/* ; do
-       $i
+        $i
     done
 }
 
@@ -151,24 +152,24 @@
 function set_elog_pid()
 {
     additional_data=$(busctl get-property xyz.openbmc_project.Logging \
-                             $optional_path \
-                             xyz.openbmc_project.Logging.Entry \
-                             AdditionalData)
+            $optional_path \
+            xyz.openbmc_project.Logging.Entry \
+        AdditionalData)
 
     #read _PID data.
     if [ ! -z "$additional_data" ]; then
         pid=$(echo $additional_data | \
-                   awk -F _PID= '{ print ($2+0)}')
+            awk -F _PID= '{ print ($2+0)}')
     fi
 }
 
 # @brief Initial version of the summary log
-init_summary()
+function init_summary()
 {
-   log_summary "Name:          $name.tar.xz"
-   log_summary "Epochtime:     $EPOCHTIME"
-   log_summary "ID:            $dump_id"
-   log_summary "Type:          $dump_type"
+    log_summary "Name:          $name.tar.xz"
+    log_summary "Epochtime:     $EPOCHTIME"
+    log_summary "ID:            $dump_id"
+    log_summary "Type:          $dump_type"
 }
 
 # @brief Check the validity of user inputs and initialize global
@@ -199,22 +200,22 @@
     summary_log="$name_dir/$SUMMARY_LOG"
 
     #Type
-    if [[ ! ($dump_type = $TYPE_USER || \
-             $dump_type = $TYPE_CORE || \
-             $dump_type = $TYPE_ELOG || \
-             $dump_type = $TYPE_RAMOOPS || \
-             $dump_type = $TYPE_CHECKSTOP) ]]; then
-       log_error "Invalid -type, Only summary log is available"
-       dump_type=$SUMMARY_DUMP
+    if [[ $dump_type != $TYPE_USER ]] || \
+        [[ $dump_type != $TYPE_CORE ]] || \
+        [[ $dump_type != $TYPE_ELOG ]] || \
+        [[ $dump_type != $TYPE_RAMOOPS ]] || \
+        [[ $dump_type != $TYPE_CHECKSTOP ]]; then
+        log_error "Invalid -type, Only summary log is available"
+        dump_type=$SUMMARY_DUMP
     fi
 
     #Size
     #Check the input is integer.
     if [ "$dump_size" -eq "$dump_size" ] 2>/dev/null; then
-       #Converts in to bytes.
-       dump_size="$((dump_size * 1024))"
+        #Converts in to bytes.
+        dump_size="$((dump_size * 1024))"
     else
-       dump_size=$UNLIMITED
+        dump_size=$UNLIMITED
     fi
 
     return $SUCCESS
@@ -232,14 +233,14 @@
     #tar and compress the files.
     if [ -f "$HEADER_EXTENSION" ]; then
         tar -Jcf "$name_dir.tar.xz" -C \
-                 $(dirname "$name_dir") $(basename "$name_dir")
+            $(dirname "$name_dir") $(basename "$name_dir")
         echo "Adding Dump Header :"$HEADER_EXTENSION
         ("$HEADER_EXTENSION")
         cat "$name_dir.tar.xz" | tee -a "/tmp/dumpheader_$EPOCHTIME" > /dev/null
         mv "/tmp/dumpheader_$EPOCHTIME" "$name_dir.tar.xz"
     else
         tar -Jcf "$name_dir.tar.xz" -C \
-                 $(dirname "$name_dir") $(basename "$name_dir")
+            $(dirname "$name_dir") $(basename "$name_dir")
     fi
 
     if [ $? -ne 0 ]; then
@@ -254,7 +255,7 @@
     echo $($TIME_STAMP) "Report is available in $dump_dir"
 
     if [ "$TMP_DIR" == "$dump_dir" ] || [ "$TMP_DIR/" == "$dump_dir" ]; then
-       return $SUCCESS
+        return $SUCCESS
     fi
 
     #copy the compressed tar file into the destination
@@ -298,8 +299,8 @@
 }
 
 TEMP=`getopt -o n:d:i:t:s:p:vVqh \
-      --long name:,dir:,dumpid:,type:,size:,path:,verbose,version,quiet,help \
-      -- "$@"`
+    --long name:,dir:,dumpid:,type:,size:,path:,verbose,version,quiet,help \
+    -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -314,37 +315,37 @@
     case $key in
         -n|--name)
             name=$2
-            shift 2;;
+            shift 2 ;;
         -d|--dir)
             dump_dir=$2
-            shift 2;;
+            shift 2 ;;
         -i|--dumpid)
             dump_id=$2
-            shift 2;;
+            shift 2 ;;
         -t|--type)
             dump_type=$2
-            shift 2;;
+            shift 2 ;;
         -s|--size)
             dump_size=$2
-            shift 2;;
+            shift 2 ;;
         -p|--path)
             optional_path=$2
-            shift 2;;
+            shift 2 ;;
         -v|—-verbose)
             verbose=$TRUE
-            shift;;
+            shift ;;
         -V|--version)
-            shift;;
+            shift ;;
         -q|—-quiet)
             quiet=$TRUE
-            shift;;
+            shift ;;
         -h|--help)
             echo "$help"
-            exit;;
+            exit ;;
         *) # unknown option
             log_error "Unknown argument: $1"
             log_info "$help"
-            exit 1;;
+            exit 1 ;;
     esac
 done
 
diff --git a/tools/dreport.d/ibm.d/gendumpheader b/tools/dreport.d/ibm.d/gendumpheader
index b1de37e..cc49177 100755
--- a/tools/dreport.d/ibm.d/gendumpheader
+++ b/tools/dreport.d/ibm.d/gendumpheader
@@ -24,19 +24,19 @@
 declare -x FILE="/tmp/dumpheader_$EPOCHTIME"
 declare -x dumpSize=$(ls -al $name_dir.tar.xz | awk '{print $5}')
 declare -x modelNo=$(busctl get-property $INVENTORY_MANAGER $INVENTORY_PATH \
-$INVENTORY_ASSET_INT Model | cut -d " " -f 2 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
+    $INVENTORY_ASSET_INT Model | cut -d " " -f 2 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
 
 declare -x serialNo=$(busctl get-property $INVENTORY_MANAGER $INVENTORY_PATH \
-$INVENTORY_ASSET_INT SerialNumber | cut -d " " -f 2 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
+    $INVENTORY_ASSET_INT SerialNumber | cut -d " " -f 2 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
 
 declare -x dDay=$(date -d @$EPOCHTIME +'%Y%m%d%H%M%S')
 
 declare -x bmcSerialNo=$(busctl call $INVENTORY_MANAGER $INVENTORY_BMC_BOARD \
-org.freedesktop.DBus.Properties Get ss $INVENTORY_ASSET_INT \
-SerialNumber | cut -d " " -f 3 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
+        org.freedesktop.DBus.Properties Get ss $INVENTORY_ASSET_INT \
+    SerialNumber | cut -d " " -f 3 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
 
 #Function to add NULL
-function add_null () {
+function add_null() {
     local a=$1
     printf '%*s' $a | tr ' ' "\0" >> $FILE
 }
@@ -44,7 +44,7 @@
 #Function to is to convert the EPOCHTIME collected
 #from dreport into hex values and write the same in
 #header.
-function dump_time () {
+function dump_time() {
     x=${#dDay}
     msize=`expr $x / 2`
     msize=`expr $SIZE_8 - $msize`
@@ -56,7 +56,7 @@
 }
 
 #Function to fetch the size of the dump
-function dump_size () {
+function dump_size() {
     #Adding 516 bytes as the total dump size is dump tar size
     #plus the dump header entry in this case
     #dump_header and dump_entry
@@ -77,7 +77,7 @@
 }
 
 #Function to set dump id to 8 bytes format
-function get_dump_id () {
+function get_dump_id() {
     x=${#dump_id}
     nulltoadd=`expr $SIZE_8 - $x`
     printf '%*s' $nulltoadd | tr ' ' "0" >> $FILE
@@ -85,7 +85,7 @@
 }
 
 #Function to get the bmc serial number
-function getbmc_serial () {
+function getbmc_serial() {
     x=${#bmcSerialNo}
     nulltoadd=`expr $SIZE_12 - $x`
     printf $bmcSerialNo >> $FILE
@@ -107,7 +107,7 @@
 #Separator         1            .
 #Time stamp        14           Form should be yyyymmddhhmmss
 #Null Terminator   1            0x00
-function dump_file_entry () {
+function dump_file_entry() {
     printf "FILE    " >> $FILE
     add_null 1
     printf '\x40' >> $FILE #Virtual file directory entry size
@@ -134,7 +134,7 @@
 #Reserved          2            NULL
 #Dump Size         8            Dump size in hex + dump header
 #Optional Section  16           BMCDUMP
-function dump_section_entry () {
+function dump_section_entry() {
     printf "SECTION " >> $FILE
     add_null 1
     printf '\x30' >> $FILE #Section entry size
@@ -177,7 +177,7 @@
 #Dump requestor type
 #Dump Req ID
 #Dump Req user ID
-function dump_header () {
+function dump_header() {
     printf "BMC DUMP" >> $FILE
     dump_time
     add_null 4 #Dump Identifier
@@ -207,7 +207,7 @@
 #BMC Dump Valid     1            0x01
 #No of Dump Entry   2            Number of Dump Entry
 #
-function dump_entry () {
+function dump_entry() {
     printf '\x01' >> $FILE #Dump entry version
     printf '\x01' >> $FILE #Dump valid
     add_null 1
@@ -215,7 +215,7 @@
 }
 
 #main function
-function gen_header_package () {
+function gen_header_package() {
     dump_file_entry
     dump_section_entry
     dump_header
diff --git a/tools/dreport.d/include.d/functions b/tools/dreport.d/include.d/functions
index d3aff63..b62b471 100755
--- a/tools/dreport.d/include.d/functions
+++ b/tools/dreport.d/include.d/functions
@@ -88,7 +88,7 @@
     #get the file or directory size
     if [[ -d $source ]] && [[ -n $source ]]; then
         tar -cf "$source.tar" -C \
-                 $(dirname "$source") $(basename "$source")
+            $(dirname "$source") $(basename "$source")
         size=$(stat -c%s "$source.tar")
         rm "$source.tar"
     else
@@ -99,7 +99,7 @@
         #Exceed the allowed limit,
         #tar and compress the files and check the size
         tar -Jcf "$name_dir.tar.xz" -C \
-                  $(dirname "$name_dir") $(basename "$name_dir")
+            $(dirname "$name_dir") $(basename "$name_dir")
         size=$(stat -c%s "$name_dir.tar.xz")
         if [ $size -gt $dump_size ]; then
             #Remove the the specific data from the name_dir and continue
@@ -118,10 +118,10 @@
 # @param error message
 function log_error()
 {
-   echo $($TIME_STAMP) "ERROR: $*" >> $dreport_log
-   if ((quiet != TRUE)); then
-      echo $($TIME_STAMP) "ERROR: $*" >&2
-   fi
+    echo $($TIME_STAMP) "ERROR: $*" >> $dreport_log
+    if ((quiet != TRUE)); then
+        echo $($TIME_STAMP) "ERROR: $*" >&2
+    fi
 }
 
 # @brief log warning message
diff --git a/tools/dreport.d/openpower.d/plugins.d/dumpfilelist b/tools/dreport.d/openpower.d/plugins.d/dumpfilelist
index b6720d8..805a93e 100644
--- a/tools/dreport.d/openpower.d/plugins.d/dumpfilelist
+++ b/tools/dreport.d/openpower.d/plugins.d/dumpfilelist
@@ -15,7 +15,7 @@
                 /xyz/openbmc_project/dump \
                 org.freedesktop.DBus.ObjectManager \
                 GetManagedObjects"
-if ! add_cmd_output "$command" "$file_name" "$desc"; 
+if ! add_cmd_output "$command" "$file_name" "$desc";
 then
     #bmc dumps
     dir="/var/lib/phosphor-debug-collector/dumps/"
diff --git a/tools/dreport.d/plugins.d/elogall b/tools/dreport.d/plugins.d/elogall
index 0d500f6..33fd98e 100644
--- a/tools/dreport.d/plugins.d/elogall
+++ b/tools/dreport.d/plugins.d/elogall
@@ -9,8 +9,8 @@
 desc="elog"
 
 entries=$(busctl --list --no-pager tree \
-                 xyz.openbmc_project.Logging | grep \
-                 '/xyz/openbmc_project/logging/entry/')
+        xyz.openbmc_project.Logging | grep \
+    '/xyz/openbmc_project/logging/entry/')
 
 #check for elog entries.
 if [ -z "$entries" ]; then
diff --git a/tools/dreport.d/plugins.d/emconfig b/tools/dreport.d/plugins.d/emconfig
index 75e3d0c..5e01ca6 100644
--- a/tools/dreport.d/plugins.d/emconfig
+++ b/tools/dreport.d/plugins.d/emconfig
@@ -10,6 +10,6 @@
 file_name="em-system.json"
 
 if [ -e "/var/configuration/system.json" ]; then
-  command="cat /var/configuration/system.json"
-  add_cmd_output "$command" "$file_name" "$desc"
+    command="cat /var/configuration/system.json"
+    add_cmd_output "$command" "$file_name" "$desc"
 fi
diff --git a/tools/dreport.d/plugins.d/fanctldump b/tools/dreport.d/plugins.d/fanctldump
index 003c7c1..590b9ed 100644
--- a/tools/dreport.d/plugins.d/fanctldump
+++ b/tools/dreport.d/plugins.d/fanctldump
@@ -12,10 +12,10 @@
 # collect data only if fanctl is present
 if [ -e "/usr/bin/fanctl" ]; then
 
-  command="rm -f /tmp/fan_control_dump.json; /usr/bin/fanctl dump; \
+    command="rm -f /tmp/fan_control_dump.json; /usr/bin/fanctl dump; \
            cat /tmp/fan_control_dump.json"
 
-  add_cmd_output "$command" "$file_name" "$desc"
-  rm -f /tmp/fan_control_dump.json
+    add_cmd_output "$command" "$file_name" "$desc"
+    rm -f /tmp/fan_control_dump.json
 
 fi
diff --git a/tools/dreport.d/plugins.d/fanmondump b/tools/dreport.d/plugins.d/fanmondump
index f0906b9..0e34eef 100755
--- a/tools/dreport.d/plugins.d/fanmondump
+++ b/tools/dreport.d/plugins.d/fanmondump
@@ -7,7 +7,7 @@
 . $DREPORT_INCLUDE/functions
 
 if [ ! -e "/usr/bin/phosphor-fan-monitor" ]; then
-  exit 0
+    exit 0
 fi
 
 file_name="/tmp/fan_monitor_dump.json"
diff --git a/tools/dreport.d/plugins.d/hostlogger b/tools/dreport.d/plugins.d/hostlogger
index 1832453..506c5a3 100644
--- a/tools/dreport.d/plugins.d/hostlogger
+++ b/tools/dreport.d/plugins.d/hostlogger
@@ -10,16 +10,16 @@
 LOGS_PATH="/var/lib/obmc/hostlogs"
 
 if [[ -d ${LOGS_PATH} ]]; then
-  # Manual flush of the log buffer for all service instances
-  INSTANCES="$(systemctl list-units --type=service --state=running --full | \
+    # Manual flush of the log buffer for all service instances
+    INSTANCES="$(systemctl list-units --type=service --state=running --full | \
                awk '/hostlogger@/{print $1}')"
-  for SVC in ${INSTANCES}; do
-    log_info "Flush ${SVC}..."
-    if ! systemctl kill --signal SIGUSR1 ${SVC}; then
-      log_warning "Unable to flush ${SVC}"
-    fi
-  done
+    for SVC in ${INSTANCES}; do
+        log_info "Flush ${SVC}..."
+        if ! systemctl kill --signal SIGUSR1 ${SVC}; then
+            log_warning "Unable to flush ${SVC}"
+        fi
+    done
 
-  # Copy log directory
-  add_copy_file "${LOGS_PATH}" "${DESCRIPTION}"
+    # Copy log directory
+    add_copy_file "${LOGS_PATH}" "${DESCRIPTION}"
 fi
diff --git a/tools/dreport.d/plugins.d/inventory b/tools/dreport.d/plugins.d/inventory
index 75873b2..a9013b5 100644
--- a/tools/dreport.d/plugins.d/inventory
+++ b/tools/dreport.d/plugins.d/inventory
@@ -17,7 +17,7 @@
 
 file_name="inventory.log"
 
-if ! add_cmd_output "$command" "$file_name" "$desc"; 
+if ! add_cmd_output "$command" "$file_name" "$desc";
 then
     inventory_dir="/var/lib/phosphor-inventory-manager"
     if [ -d "$inventory_dir" ]; then
diff --git a/tools/dreport.d/plugins.d/ledgroup b/tools/dreport.d/plugins.d/ledgroup
index de7faaf..135da37 100644
--- a/tools/dreport.d/plugins.d/ledgroup
+++ b/tools/dreport.d/plugins.d/ledgroup
@@ -21,6 +21,6 @@
 then
     dir_name="/var/lib/phosphor-led-manager/"
     if [ -d "$dir_name" ]; then
-          add_copy_file "$dir_name" "$desc"
+        add_copy_file "$dir_name" "$desc"
     fi
 fi
diff --git a/tools/dreport.d/plugins.d/pldmflightrecorder b/tools/dreport.d/plugins.d/pldmflightrecorder
index 5b9b094..8e22fa6 100644
--- a/tools/dreport.d/plugins.d/pldmflightrecorder
+++ b/tools/dreport.d/plugins.d/pldmflightrecorder
@@ -10,14 +10,14 @@
 
 # collect data only if pldmd is enabled
 if [ -e "/usr/bin/pldmd" ]; then
-  command="rm -rf /tmp/pldm_flight_recorder; killall -s SIGUSR1 pldmd; \
+    command="rm -rf /tmp/pldm_flight_recorder; killall -s SIGUSR1 pldmd; \
            sleep 5; cat /tmp/pldm_flight_recorder"
 
-  file_name="pldmflightrecorder.log"
+    file_name="pldmflightrecorder.log"
 
-  add_cmd_output "$command" "$file_name" "$desc"
+    add_cmd_output "$command" "$file_name" "$desc"
 
-  rm -rf /tmp/pldm_flight_recorder
+    rm -rf /tmp/pldm_flight_recorder
 else
-  log_warning "skipping pldm flight recorder:  pldmd is not enabled"
+    log_warning "skipping pldm flight recorder:  pldmd is not enabled"
 fi