diff options
author | William A. Kennington III <wak@google.com> | 2023-06-06 00:23:49 +0300 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2023-06-06 03:00:45 +0300 |
commit | 4372aabadb2ce97a3a4a3e38fe2edcf76ed46257 (patch) | |
tree | 1251b408f3c77adc5986cbbfcc8754f61e261f84 /meta-google | |
parent | e1e58f472046b4d98bb94412574f81d712ce174f (diff) | |
download | openbmc-4372aabadb2ce97a3a4a3e38fe2edcf76ed46257.tar.xz |
meta-google: ncsi: Fix shellcheck issues
Change-Id: I89d2cdf8e7f31fc137b9db99c843e89f88c0c5b7
Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'meta-google')
-rwxr-xr-x | meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in index 6b823363c8..a08935ae84 100755 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in @@ -15,7 +15,9 @@ [ ! -e /usr/share/gbmc-br-lib.sh ] && exit +# shellcheck source=meta-google/recipes-google/networking/network-sh/lib.sh source /usr/share/network/lib.sh || exit +# shellcheck source=meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-lib.sh source /usr/share/gbmc-br-lib.sh || exit NCSI_IF='@NCSI_IF@' @@ -25,7 +27,7 @@ old_fqdn= old_rtr= set_host() { - [ -n "$host" -a -n "$domain" -a -n "$hextet" ] || return + [[ -n "$host" && -n "$domain" && -n "$hextet" ]] || return local fqdn="$host-n$hextet.$domain" [ "$fqdn" != "$old_fqdn" ] || return @@ -36,7 +38,7 @@ set_host() { } set_net() { - [ -n "$pfx" -a -n "$rtr" ] || return + [[ -n "$pfx" && -n "$rtr" ]] || return [[ "$pfx" != "$old_pfx" || "$rtr" != "$old_rtr" ]] || return old_pfx="$pfx" old_rtr="$rtr" @@ -57,7 +59,7 @@ set_net() { w=60 while true; do start=$SECONDS - while read line; do + while read -r line; do if [ -z "$line" ]; then hextet= pfx= @@ -69,7 +71,7 @@ while true; do ip_to_bytes t_pfx_b "$t_pfx" || continue (( t_pfx_len == 76 && t_pfx_b[8] & 0xfd == 0xfd )) || continue (( t_pfx_b[9] |= 1 )) - hextet="fd$(printf '%02x' ${t_pfx_b[9]})" + hextet="fd$(printf '%02x' "${t_pfx_b[9]}")" pfx="$(ip_bytes_to_str t_pfx_b)" elif [[ "$line" =~ ^'DNS search list'' '*:' '*([^.]+)(.*[.]google[.]com)$ ]]; then # Ideally, we use PCRE and with lookahead and can do this in a single regex @@ -78,7 +80,7 @@ while true; do host="${BASH_REMATCH[1]}" domain="${BASH_REMATCH[2]#.}" if [[ "$host" =~ (-n[a-fA-F0-9]{1,4})$ ]]; then - host="${host%${BASH_REMATCH[1]}}" + host="${host%"${BASH_REMATCH[1]}"}" fi elif [[ "$line" =~ ^from' '(.*)$ ]]; then rtr="${BASH_REMATCH[1]}" |