From dc3b6d4b8c43eadfef2ba5a7e296e3a83d284921 Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Fri, 8 Mar 2024 11:52:12 +0000 Subject: [PATCH] shellscripts: fix the worse complaints from shellcheck These were errors, even if they were accidentally working Signed-off-by: Pau Ruiz Safont --- ocaml/libs/http-lib/client_server_test.sh | 2 ++ ocaml/message-switch/.coverage.sh | 34 ----------------------- ocaml/sdk-gen/windows-line-endings.sh | 9 +++--- ocaml/xenopsd/scripts/vif-real | 6 ++-- scripts/install-sdk-pool | 10 +++---- scripts/test-ha-sr2 | 2 +- scripts/xe-install-supplemental-pack | 2 +- 7 files changed, 17 insertions(+), 48 deletions(-) delete mode 100644 ocaml/message-switch/.coverage.sh diff --git a/ocaml/libs/http-lib/client_server_test.sh b/ocaml/libs/http-lib/client_server_test.sh index 6757878f963..601ed257f99 100644 --- a/ocaml/libs/http-lib/client_server_test.sh +++ b/ocaml/libs/http-lib/client_server_test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -eux trap 'kill $(jobs -p)' EXIT diff --git a/ocaml/message-switch/.coverage.sh b/ocaml/message-switch/.coverage.sh deleted file mode 100644 index 2c8f7be72b7..00000000000 --- a/ocaml/message-switch/.coverage.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -ex - -COVERAGE_DIR=.coverage -rm -rf $COVERAGE_DIR -mkdir -p $COVERAGE_DIR -pushd $COVERAGE_DIR -if [ -z "$KEEP" ]; then trap "popd; rm -rf $COVERAGE_DIR" EXIT; fi - -$(which cp) -r ../* . - -opam pin add bisect_ppx 1.3.3 -y -opam install ocveralls -y - -# install test deps -opam install message-switch-async cohttp-async -y - -export BISECT_ENABLE=YES -jbuilder runtest - -outs=($(find . | grep bisect.*.out)) -bisect-ppx-report -I $(dirname ${outs[1]}) -text report ${outs[@]} -bisect-ppx-report -I $(dirname ${outs[1]}) -summary-only -text summary ${outs[@]} -if [ -n "$HTML" ]; then bisect-ppx-report -I $(dirname ${outs[1]}) -html ../html-report ${outs[@]}; fi - -if [ -n "$TRAVIS" ]; then - echo "\$TRAVIS set; running ocveralls and sending to coveralls.io..." - ocveralls --prefix _build/default ${outs[@]} --send -else - echo "\$TRAVIS not set; displaying results of bisect-report..." - cat report - cat summary -fi diff --git a/ocaml/sdk-gen/windows-line-endings.sh b/ocaml/sdk-gen/windows-line-endings.sh index 0b11db3ba3a..f61801e1e83 100644 --- a/ocaml/sdk-gen/windows-line-endings.sh +++ b/ocaml/sdk-gen/windows-line-endings.sh @@ -1,18 +1,19 @@ +#!/bin/bash # # Copyright (c) Cloud Software Group, Inc. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: -# +# # 1) Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. -# +# # 2) Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials # provided with the distribution. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS diff --git a/ocaml/xenopsd/scripts/vif-real b/ocaml/xenopsd/scripts/vif-real index 848104ca76d..25662c9bf02 100755 --- a/ocaml/xenopsd/scripts/vif-real +++ b/ocaml/xenopsd/scripts/vif-real @@ -70,7 +70,7 @@ handle_promiscuous() if [ $? -eq 0 -a -n "${arg}" ] ; then case $NETWORK_MODE in bridge) - case "${arg}" in + case "${arg}" in true|on) echo 1 > /sys/class/net/${dev}/brport/promisc ;; *) echo 0 > /sys/class/net/${dev}/brport/promisc ;; esac @@ -198,7 +198,7 @@ PRIVATE=/xapi/${DOMUUID}/private/vif/${DEVID} HOTPLUG_STATUS="${XENBUS_PATH}/hotplug-status" HOTPLUG_ERROR="${XENBUS_PATH}/hotplug-error" -NETWORK_MODE=bridge +NETWORK_MODE=bridge if [ -e /sys/module/openvswitch ]; then NETWORK_MODE=openvswitch fi @@ -221,7 +221,7 @@ if [ -n "${UDEV_CALL}" ] && \ exit 0 fi -logger -t scripts-vif "Called as \"$@\" domid:$DOMID devid:$DEVID mode:$NETWORK_MODE" +logger -t scripts-vif "Called as \"$*\" domid:$DOMID devid:$DEVID mode:$NETWORK_MODE" case "${ACTION}" in online) if [ "${TYPE}" = "vif" ] ; then diff --git a/scripts/install-sdk-pool b/scripts/install-sdk-pool index 4cc5c6809ac..fedce55cfd4 100755 --- a/scripts/install-sdk-pool +++ b/scripts/install-sdk-pool @@ -49,7 +49,7 @@ echo "* starting VMS" echo " starting: template ${VMTEMPLATE}" ${XE} vm-start uuid=${VMTEMPLATE} -for vm in ${vms[@]} +for vm in "${vms[@]}" do VM=${vms[$i]} echo " starting: $vm" @@ -69,11 +69,11 @@ ${XEBIN} -s ${masterip} -p ${port} -u root -pw "xensource" ${NOSSL} \ host-license-add license-file="${license}" # get all ips and update a license to it -for vm in ${vms[@]} +for vm in "${vms[@]}" do ip=`${XE} vm-param-get --minimal uuid="${vm}" param-name=networks | awk '{print $2}'` echo " Applying license to ${vm} at IP (${ip})" - + ${XEBIN} -s ${ip} -p ${port} -u root -pw "xensource" ${NOSSL} \ host-license-add license-file="${license}" done @@ -82,13 +82,13 @@ sleep 40 echo "* Pooling all VMs to $masterip" -for vm in ${vms[@]} +for vm in "${vms[@]}" do ip=`${XE} vm-param-get --minimal uuid="${vm}" param-name=networks | awk '{print $2}'` echo " Pooling slave VM ${vm} to (${masterip})" ${XEBIN} -s ${ip} -p ${port} -u root -pw "xensource" ${NOSSL} \ pool-join master-address=${masterip} \ - master-username=root master-password=xensource master + master-username=root master-password=xensource master done diff --git a/scripts/test-ha-sr2 b/scripts/test-ha-sr2 index 2f35bf844ad..fc2f95980fe 100755 --- a/scripts/test-ha-sr2 +++ b/scripts/test-ha-sr2 @@ -72,7 +72,7 @@ echo -n "Waiting for Survival Rule 1: " wait_for_sr 1 echo OK -while [ /bin/true ]; do +while true; do # Block statefile everywhere remote_exec_all "iptables -I OUTPUT -p tcp --dport 3260 -j DROP" diff --git a/scripts/xe-install-supplemental-pack b/scripts/xe-install-supplemental-pack index 97f93a55188..3d830efdf9a 100755 --- a/scripts/xe-install-supplemental-pack +++ b/scripts/xe-install-supplemental-pack @@ -4,7 +4,7 @@ set -e die() { - echo $@ >&2 + echo "$@" >&2 exit 1 }