summaryrefslogtreecommitdiff
path: root/meta-google
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2023-06-06 00:38:02 +0300
committerWilliam A. Kennington III <wak@google.com>2023-06-06 03:00:45 +0300
commitced2bfd0ecf96fecfb4a1c946ce8465dd4c7524e (patch)
treec06ab9691a3364285c3147884346e167046eaac7 /meta-google
parentb06ae50426a746aeb768b6c250c70087c78ead0d (diff)
downloadopenbmc-ced2bfd0ecf96fecfb4a1c946ce8465dd4c7524e.tar.xz
meta-google: gbmc-mac-config: Fix shellcheck issues
Change-Id: I09d6d093c03aa0e6bf2a4a089769503947a77ddd Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'meta-google')
-rw-r--r--meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in10
1 files changed, 6 insertions, 4 deletions
diff --git a/meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in b/meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in
index 0466d0d2cd..dce4611a46 100644
--- a/meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in
+++ b/meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# shellcheck source=meta-google/recipes-google/ipmi/ipmi-fru-sh/lib.sh
source /usr/share/ipmi-fru/lib.sh || exit
ipmi_fru_alloc '@EEPROM@' eeprom || exit
@@ -41,7 +42,7 @@ if (( internal[1] != 1 || internal[2] != 32 )); then
exit 1
fi
mac=("${internal[@]:3:6}")
-num="${internal[@]:9:1}"
+num="${internal[9]}"
macstr=$(printf '%02x:%02x:%02x:%02x:%02x:%02x' "${mac[@]}")
echo "Base MAC $macstr num $num" >&2
@@ -49,6 +50,7 @@ rc=0
# Pre-Determine if we will miss an allocation due to the number of
# addresses the FRU actually supports.
+# shellcheck disable=SC2190
declare -A num_to_intfs=(@NUM_TO_INTFS@)
for key in "${!num_to_intfs[@]}"; do
if (( key >= num )); then
@@ -60,7 +62,7 @@ done
# Write out each MAC override to the runtime networkd configuration
for (( i=0; i<num; i++ )); do
if (( mac[5] > 0xff )); then
- echo "MAC assignment too large: ${mac[@]}" >&2
+ echo "MAC assignment too large: ${mac[*]}" >&2
rc=2
break
fi
@@ -78,8 +80,8 @@ for (( i=0; i<num; i++ )); do
# In case we don't have any interface configs, set the MAC directly
# This is safe to apply, as systemd-networkd will always override this
# value based on written configs.
- if ip link show $intf >/dev/null 2>&1 && \
- ! ip link set dev $intf address $macstr; then
+ if ip link show "$intf" >/dev/null 2>&1 && \
+ ! ip link set dev "$intf" address "$macstr"; then
echo "Setting MAC($macstr) on $intf failed" >&2
fi
done