diff options
author | Damian Szuberski <[email protected]> | 2022-01-07 01:07:54 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2022-01-06 16:07:54 -0800 |
commit | c1d3be19d7646c2dfeec04a31c96542be77b9763 (patch) | |
tree | 72ca292f59dd912c1de7471158b932bad0746fcd /cmd/zpool/zpool.d | |
parent | a8f27ec6c5f89f721f0492ed7b07437ec439d83d (diff) |
Add ShellCheck's `--enable=all` inside `cmd/`
The only exception is `cmd/vdev_id/vdev_id` which might be a subject of
refactoring (see #12084)
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ahelenia ZiemiaĆska <[email protected]>
Signed-off-by: szubersk <[email protected]>
Closes #12912
Diffstat (limited to 'cmd/zpool/zpool.d')
-rwxr-xr-x | cmd/zpool/zpool.d/dm-deps | 1 | ||||
-rwxr-xr-x | cmd/zpool/zpool.d/iostat | 3 | ||||
-rwxr-xr-x | cmd/zpool/zpool.d/lsblk | 1 | ||||
-rwxr-xr-x | cmd/zpool/zpool.d/media | 2 | ||||
-rwxr-xr-x | cmd/zpool/zpool.d/ses | 5 | ||||
-rwxr-xr-x | cmd/zpool/zpool.d/smart | 1 | ||||
-rwxr-xr-x | cmd/zpool/zpool.d/upath | 1 |
7 files changed, 12 insertions, 2 deletions
diff --git a/cmd/zpool/zpool.d/dm-deps b/cmd/zpool/zpool.d/dm-deps index 42af6a8d6..44224787f 100755 --- a/cmd/zpool/zpool.d/dm-deps +++ b/cmd/zpool/zpool.d/dm-deps @@ -9,6 +9,7 @@ if [ "$1" = "-h" ] ; then exit fi +# shellcheck disable=SC2154 dev="$VDEV_PATH" # If the VDEV path is a symlink, resolve it to a real device diff --git a/cmd/zpool/zpool.d/iostat b/cmd/zpool/zpool.d/iostat index 19be475e9..95c459a3f 100755 --- a/cmd/zpool/zpool.d/iostat +++ b/cmd/zpool/zpool.d/iostat @@ -27,6 +27,7 @@ elif [ "$script" = "iostat-10s" ] ; then brief="yes" fi +# shellcheck disable=SC2154 if [ -f "$VDEV_UPATH" ] ; then # We're a file-based vdev, iostat doesn't work on us. Do nothing. exit @@ -67,7 +68,7 @@ i=0 for col in $cols ; do i=$((i+1)) # Skip the first column since it's just the device name - if [ $i -eq 1 ]; then + if [ "$i" -eq 1 ]; then continue fi diff --git a/cmd/zpool/zpool.d/lsblk b/cmd/zpool/zpool.d/lsblk index 919783a1c..1ed146443 100755 --- a/cmd/zpool/zpool.d/lsblk +++ b/cmd/zpool/zpool.d/lsblk @@ -66,6 +66,7 @@ for i in $list ; do # Special case: Looking up the size of a file-based vdev can't # be done with lsblk. + # shellcheck disable=SC2154 if [ "$i" = "size" ] && [ -f "$VDEV_UPATH" ] ; then size=$(du -h --apparent-size "$VDEV_UPATH" | cut -f 1) echo "size=$size" diff --git a/cmd/zpool/zpool.d/media b/cmd/zpool/zpool.d/media index 660f78b74..095ac86dc 100755 --- a/cmd/zpool/zpool.d/media +++ b/cmd/zpool/zpool.d/media @@ -8,12 +8,14 @@ if [ "$1" = "-h" ] ; then exit fi +# shellcheck disable=SC2154 if [ -b "$VDEV_UPATH" ]; then device="${VDEV_UPATH##*/}" read -r val 2>/dev/null < "/sys/block/$device/queue/rotational" case "$val" in 0) MEDIA="ssd" ;; 1) MEDIA="hdd" ;; + *) MEDIA="invalid" ;; esac vpd_pg83="/sys/block/$device/device/vpd_pg83" diff --git a/cmd/zpool/zpool.d/ses b/cmd/zpool/zpool.d/ses index b51fe3189..638145c95 100755 --- a/cmd/zpool/zpool.d/ses +++ b/cmd/zpool/zpool.d/ses @@ -24,6 +24,7 @@ else fi for i in $scripts ; do + # shellcheck disable=SC2154 if [ -z "$VDEV_ENC_SYSFS_PATH" ] ; then echo "$i=" continue @@ -52,7 +53,9 @@ for i in $scripts ; do locate_led) val=$(cat "$VDEV_ENC_SYSFS_PATH/locate" 2>/dev/null) ;; + *) + val=invalid + ;; esac echo "$i=$val" done - diff --git a/cmd/zpool/zpool.d/smart b/cmd/zpool/zpool.d/smart index b95256d75..032491988 100755 --- a/cmd/zpool/zpool.d/smart +++ b/cmd/zpool/zpool.d/smart @@ -69,6 +69,7 @@ if [ "$1" = "-h" ] ; then exit fi +# shellcheck disable=SC2154 if [ -b "$VDEV_UPATH" ] && PATH="/usr/sbin:$PATH" command -v smartctl > /dev/null || [ -n "$samples" ] ; then if [ -n "$samples" ] ; then # cat a smartctl output text file instead of running smartctl diff --git a/cmd/zpool/zpool.d/upath b/cmd/zpool/zpool.d/upath index 16a4327d4..e37ee1b8c 100755 --- a/cmd/zpool/zpool.d/upath +++ b/cmd/zpool/zpool.d/upath @@ -4,4 +4,5 @@ if [ "$1" = "-h" ] ; then exit fi +# shellcheck disable=SC2154 echo upath="$VDEV_UPATH" |