diff --git a/package/gluon-alfred/files/usr/lib/autoupdater/abort.d/60gluon-alfred b/package/gluon-alfred/files/usr/lib/autoupdater/abort.d/60gluon-alfred index 621c09a0930966a9a28685e5b477c46f458fe540..504fff52f08b7cd83713cb25e473f9c0ae3fb664 100755 --- a/package/gluon-alfred/files/usr/lib/autoupdater/abort.d/60gluon-alfred +++ b/package/gluon-alfred/files/usr/lib/autoupdater/abort.d/60gluon-alfred @@ -1,6 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh - start_enabled alfred diff --git a/package/gluon-alfred/files/usr/lib/autoupdater/download.d/40gluon-alfred b/package/gluon-alfred/files/usr/lib/autoupdater/download.d/40gluon-alfred index 19427620d882b5a9a0863884193198a38389f2f9..eb465e16eb7f97bece653f05ecafcdc59e4c59dc 100755 --- a/package/gluon-alfred/files/usr/lib/autoupdater/download.d/40gluon-alfred +++ b/package/gluon-alfred/files/usr/lib/autoupdater/download.d/40gluon-alfred @@ -1,6 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh - stop alfred diff --git a/package/gluon-autoupdater/files/usr/lib/autoupdater/abort.d/90gluon-autoupdater b/package/gluon-autoupdater/files/usr/lib/autoupdater/abort.d/90gluon-autoupdater index 63a37cca8c569c636034f58248b365c0840b1ea9..783b59d5270e4430e0e00865f1f6848c1d70a166 100755 --- a/package/gluon-autoupdater/files/usr/lib/autoupdater/abort.d/90gluon-autoupdater +++ b/package/gluon-autoupdater/files/usr/lib/autoupdater/abort.d/90gluon-autoupdater @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh diff --git a/package/gluon-autoupdater/files/usr/lib/autoupdater/download.d/10gluon-autoupdater b/package/gluon-autoupdater/files/usr/lib/autoupdater/download.d/10gluon-autoupdater index 28197921f2b68c2f1e81e02147196befed10e17f..5f752558b53ac7d22758b6156a354a9dcf9e3525 100755 --- a/package/gluon-autoupdater/files/usr/lib/autoupdater/download.d/10gluon-autoupdater +++ b/package/gluon-autoupdater/files/usr/lib/autoupdater/download.d/10gluon-autoupdater @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh diff --git a/package/gluon-core/files/lib/gluon/label_mac.sh b/package/gluon-core/files/lib/gluon/label_mac.sh index 3479324bc65a1650314375306e2d48d933cda3e8..431efe98b90bef7f87263ca9334d8f44b06617f2 100755 --- a/package/gluon-core/files/lib/gluon/label_mac.sh +++ b/package/gluon-core/files/lib/gluon/label_mac.sh @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC1091 + . /lib/functions/system.sh get_mac_label diff --git a/package/gluon-core/files/lib/netifd/proto/gluon_mesh.sh b/package/gluon-core/files/lib/netifd/proto/gluon_mesh.sh index 52d6abec7d4e33a22e9a20ccc3c3838b29cef68f..fc3d3acf66f362fa1764d3750f2145134640c54d 100755 --- a/package/gluon-core/files/lib/netifd/proto/gluon_mesh.sh +++ b/package/gluon-core/files/lib/netifd/proto/gluon_mesh.sh @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC1091 + . /lib/functions.sh . ../netifd-proto.sh init_proto "$@" diff --git a/package/gluon-core/files/lib/netifd/proto/gluon_wired.sh b/package/gluon-core/files/lib/netifd/proto/gluon_wired.sh index d33c8a27415185fba11282774943a881576ec8d3..954fef97db6db91b1fdc62d0a3674c1e787c154e 100755 --- a/package/gluon-core/files/lib/netifd/proto/gluon_wired.sh +++ b/package/gluon-core/files/lib/netifd/proto/gluon_wired.sh @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC1091 + . /lib/functions.sh . ../netifd-proto.sh init_proto "$@" @@ -17,7 +19,8 @@ xor2() { } is_layer3_device () { - local addrlen="$(cat "/sys/class/net/$1/addr_len")" + local addrlen + addrlen="$(cat "/sys/class/net/$1/addr_len")" test "$addrlen" -eq 0 } @@ -34,7 +37,8 @@ interface_linklocal() { return fi - local macaddr="$(ubus call network.device status '{"name": "'"$1"'"}' | jsonfilter -e '@.macaddr')" + local macaddr + macaddr="$(ubus call network.device status '{"name": "'"$1"'"}' | jsonfilter -e '@.macaddr')" local oldIFS="$IFS"; IFS=':'; set -- $macaddr; IFS="$oldIFS" echo "fe80::$(xor2 "$1")$2:$3ff:fe$4:$5$6" diff --git a/package/gluon-ebtables-limit-arp/files/usr/lib/autoupdater/abort.d/15start-arp-limiter b/package/gluon-ebtables-limit-arp/files/usr/lib/autoupdater/abort.d/15start-arp-limiter index 982629c4fc563c0b109e5ccc04f7ad116b4e1dd6..5a022b3310b54acbe1bb35eee848a0cd387f7bd2 100755 --- a/package/gluon-ebtables-limit-arp/files/usr/lib/autoupdater/abort.d/15start-arp-limiter +++ b/package/gluon-ebtables-limit-arp/files/usr/lib/autoupdater/abort.d/15start-arp-limiter @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh # Start after network diff --git a/package/gluon-ebtables-limit-arp/files/usr/lib/autoupdater/upgrade.d/05stop-arp-limiter b/package/gluon-ebtables-limit-arp/files/usr/lib/autoupdater/upgrade.d/05stop-arp-limiter index f9fdbd5c462739e8ab3ae7722908cacc6b01f9c8..04e6b0a900a9016001ceb451c89e64fab8747c20 100755 --- a/package/gluon-ebtables-limit-arp/files/usr/lib/autoupdater/upgrade.d/05stop-arp-limiter +++ b/package/gluon-ebtables-limit-arp/files/usr/lib/autoupdater/upgrade.d/05stop-arp-limiter @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh # Stop before network diff --git a/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh b/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh index 91ea0d356794a1dfec4f5e2ffd2eb253dc15a6f8..feeacfd7dab01aac05ad3c3982eeba8986e49fd1 100755 --- a/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh +++ b/package/gluon-mesh-batman-adv/files/lib/netifd/proto/gluon_bat0.sh @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC1091,SC2034 + . /lib/functions.sh . ../netifd-proto.sh init_proto "$@" @@ -37,7 +39,8 @@ proto_gluon_bat0_renew() { proto_gluon_bat0_setup() { local config="$1" - local routing_algo="$(lookup_site 'mesh.batman_adv.routing_algo' 'BATMAN_IV')" + local routing_algo + routing_algo="$(lookup_site 'mesh.batman_adv.routing_algo' 'BATMAN_IV')" local gw_mode json_get_vars gw_mode @@ -54,7 +57,8 @@ proto_gluon_bat0_setup() { batctl gw_mode "server" ;; client) - local gw_sel_class="$(lookup_site 'mesh.batman_adv.gw_sel_class')" + local gw_sel_class + gw_sel_class="$(lookup_site 'mesh.batman_adv.gw_sel_class')" if [ -n "$gw_sel_class" ]; then batctl gw_mode "client" "$gw_sel_class" else @@ -67,7 +71,8 @@ proto_gluon_bat0_setup() { esac - local primary0_mac="$(lua -e 'print(require("gluon.util").generate_mac(3))')" + local primary0_mac + primary0_mac="$(lua -e 'print(require("gluon.util").generate_mac(3))')" ip link add primary0 type dummy echo 1 > /proc/sys/net/ipv6/conf/primary0/disable_ipv6 diff --git a/package/gluon-mesh-batman-adv/files/usr/lib/autoupdater/abort.d/10start-network b/package/gluon-mesh-batman-adv/files/usr/lib/autoupdater/abort.d/10start-network index f04d55cc721f4cdb6441d2cdc3c3101d84cd13fa..87530d2125f15c43a5409de2cf76a26bc8801718 100755 --- a/package/gluon-mesh-batman-adv/files/usr/lib/autoupdater/abort.d/10start-network +++ b/package/gluon-mesh-batman-adv/files/usr/lib/autoupdater/abort.d/10start-network @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh pidof netifd >/dev/null || start_enabled network diff --git a/package/gluon-mesh-batman-adv/files/usr/lib/autoupdater/upgrade.d/10stop-network b/package/gluon-mesh-batman-adv/files/usr/lib/autoupdater/upgrade.d/10stop-network index b02580a3283008c1ecc1e8772a6f959e42c7554f..518040736f754cb80da764decd9b4e7f4dd03147 100755 --- a/package/gluon-mesh-batman-adv/files/usr/lib/autoupdater/upgrade.d/10stop-network +++ b/package/gluon-mesh-batman-adv/files/usr/lib/autoupdater/upgrade.d/10stop-network @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh wifi down diff --git a/package/gluon-mesh-olsrd/files/usr/lib/autoupdater/abort.d/10olsrd b/package/gluon-mesh-olsrd/files/usr/lib/autoupdater/abort.d/10olsrd index 8f39df99445b353599276f54fb1ef3567b0604d0..daefd25033f41c90f0c4b5102f9d3248b1be6bd2 100755 --- a/package/gluon-mesh-olsrd/files/usr/lib/autoupdater/abort.d/10olsrd +++ b/package/gluon-mesh-olsrd/files/usr/lib/autoupdater/abort.d/10olsrd @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh diff --git a/package/gluon-mesh-olsrd/files/usr/lib/autoupdater/upgrade.d/10olsrd b/package/gluon-mesh-olsrd/files/usr/lib/autoupdater/upgrade.d/10olsrd index c9cd9a8ccaba509d9bc38c18196df7a61333b59e..9ad18a16344023701f90ece83e74443a09e8b9a1 100755 --- a/package/gluon-mesh-olsrd/files/usr/lib/autoupdater/upgrade.d/10olsrd +++ b/package/gluon-mesh-olsrd/files/usr/lib/autoupdater/upgrade.d/10olsrd @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh diff --git a/package/gluon-mesh-vpn-wireguard/files/lib/gluon/mesh-vpn/wireguard_pubkey.sh b/package/gluon-mesh-vpn-wireguard/files/lib/gluon/mesh-vpn/wireguard_pubkey.sh index bbcba5717a6198a72afb6b6802c0c644c114ae2f..24c0965788704258a572fc3f309ec00021b35e83 100755 --- a/package/gluon-mesh-vpn-wireguard/files/lib/gluon/mesh-vpn/wireguard_pubkey.sh +++ b/package/gluon-mesh-vpn-wireguard/files/lib/gluon/mesh-vpn/wireguard_pubkey.sh @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC1091,SC2034 + INCLUDE_ONLY=1 . /lib/netifd/proto/wireguard.sh diff --git a/package/gluon-mesh-vpn-core/files/lib/netifd/proto/gluon_wireguard.sh b/package/gluon-mesh-vpn-wireguard/files/lib/netifd/proto/gluon_wireguard.sh similarity index 94% rename from package/gluon-mesh-vpn-core/files/lib/netifd/proto/gluon_wireguard.sh rename to package/gluon-mesh-vpn-wireguard/files/lib/netifd/proto/gluon_wireguard.sh index 05eaad535682aef01ecb4b17b690212d0f29e971..580276aba24c9d463ab76ca9a7f8c88ff94cce34 100755 --- a/package/gluon-mesh-vpn-core/files/lib/netifd/proto/gluon_wireguard.sh +++ b/package/gluon-mesh-vpn-wireguard/files/lib/netifd/proto/gluon_wireguard.sh @@ -1,5 +1,10 @@ #!/bin/sh +# shellcheck disable=SC1091 + +# FIXME: The following lints should not need to be disabled +# shellcheck disable=SC2034,SC2155 + PROTO_DEBUG=1 . /lib/functions.sh diff --git a/package/gluon-radvd/files/usr/lib/autoupdater/abort.d/80gluon-radvd b/package/gluon-radvd/files/usr/lib/autoupdater/abort.d/80gluon-radvd index 5784fa5fcca784486eb7777467731b62e7743fb2..32814a7339047cdba23f0750b4c892540a0e3ce4 100755 --- a/package/gluon-radvd/files/usr/lib/autoupdater/abort.d/80gluon-radvd +++ b/package/gluon-radvd/files/usr/lib/autoupdater/abort.d/80gluon-radvd @@ -1,6 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh - start_enabled gluon-radvd diff --git a/package/gluon-radvd/files/usr/lib/autoupdater/download.d/20gluon-radvd b/package/gluon-radvd/files/usr/lib/autoupdater/download.d/20gluon-radvd index ade50616691f3d06e6bfc8a9d61725c2992b44c2..18f2c668ea66f4e0c74b4ef12607b8c30d93743a 100755 --- a/package/gluon-radvd/files/usr/lib/autoupdater/download.d/20gluon-radvd +++ b/package/gluon-radvd/files/usr/lib/autoupdater/download.d/20gluon-radvd @@ -1,6 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh - stop gluon-radvd diff --git a/package/gluon-respondd/files/usr/lib/autoupdater/abort.d/50gluon-respondd b/package/gluon-respondd/files/usr/lib/autoupdater/abort.d/50gluon-respondd index d29af306ae3b7fd7cccd69423607e336b4a684ee..45f5ffeedfcbab48b415322793d99d720cbb0c91 100755 --- a/package/gluon-respondd/files/usr/lib/autoupdater/abort.d/50gluon-respondd +++ b/package/gluon-respondd/files/usr/lib/autoupdater/abort.d/50gluon-respondd @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh diff --git a/package/gluon-respondd/files/usr/lib/autoupdater/download.d/50gluon-respondd b/package/gluon-respondd/files/usr/lib/autoupdater/download.d/50gluon-respondd index 3edd5f1d694fe52803108227097f10edefeb850b..54559b6ec0fd26e838c40849f00dd6fd7d5a3bba 100755 --- a/package/gluon-respondd/files/usr/lib/autoupdater/download.d/50gluon-respondd +++ b/package/gluon-respondd/files/usr/lib/autoupdater/download.d/50gluon-respondd @@ -1,6 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh - stop gluon-respondd diff --git a/package/gluon-setup-mode/files/lib/preinit/90_setup_mode b/package/gluon-setup-mode/files/lib/preinit/90_setup_mode index b9365be1ea27864105405dd2539bd7b1388372b2..1ec3bd551ef92b2aa3ab917c75b24be5225f8533 100644 --- a/package/gluon-setup-mode/files/lib/preinit/90_setup_mode +++ b/package/gluon-setup-mode/files/lib/preinit/90_setup_mode @@ -2,8 +2,9 @@ setup_mode_enable() { - local enabled="$(uci -q get 'gluon-setup-mode.@setup_mode[0].enabled')" - local configured="$(uci -q get 'gluon-setup-mode.@setup_mode[0].configured')" + local enabled configured + enabled="$(uci -q get 'gluon-setup-mode.@setup_mode[0].enabled')" + configured="$(uci -q get 'gluon-setup-mode.@setup_mode[0].configured')" if [ "$enabled" = 1 ] || [ "$configured" != 1 ]; then echo '/lib/gluon/setup-mode/rc.d' > /tmp/rc_d_path diff --git a/package/gluon-status-page/files/usr/lib/autoupdater/abort.d/70gluon-status-page b/package/gluon-status-page/files/usr/lib/autoupdater/abort.d/70gluon-status-page index 9afbeec5c9e23d67115f6877509862e51a4e7b2a..747b4a8ab4fb2073e28d1b9cce5d384e4c1cc114 100755 --- a/package/gluon-status-page/files/usr/lib/autoupdater/abort.d/70gluon-status-page +++ b/package/gluon-status-page/files/usr/lib/autoupdater/abort.d/70gluon-status-page @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh diff --git a/package/gluon-status-page/files/usr/lib/autoupdater/download.d/30gluon-status-page b/package/gluon-status-page/files/usr/lib/autoupdater/download.d/30gluon-status-page index 7db1d6b7d2cc37cfffeb41e145af0e1b5fe4851f..a688474bb408fe059f800d4f5c367e18efa98975 100755 --- a/package/gluon-status-page/files/usr/lib/autoupdater/download.d/30gluon-status-page +++ b/package/gluon-status-page/files/usr/lib/autoupdater/download.d/30gluon-status-page @@ -1,5 +1,6 @@ #!/bin/sh +# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh . /lib/gluon/autoupdater/lib.sh diff --git a/scripts/lint-sh.sh b/scripts/lint-sh.sh index 93b3d09a49211eb8dbb00648109ead5144a8d40d..013ef1c5cc51eed39c1ed24ed6ccf2db9029dff9 100755 --- a/scripts/lint-sh.sh +++ b/scripts/lint-sh.sh @@ -17,7 +17,7 @@ find package -type f | while read -r file; do is_scriptfile "$file" || continue echo "Checking $file" - shellcheck -f gcc -x -s sh -e SC2039,SC1091,SC2155,SC2034,SC3043,SC3037,SC3057 "$file" + shellcheck -f gcc -x -s sh -e SC2039,SC3043,SC3037,SC3057 "$file" done find scripts -type f | while read -r file; do