mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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 <behlendorf1@llnl.gov> Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #12912
This commit is contained in:
@@ -5,6 +5,8 @@ AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS)
|
||||
|
||||
DEFAULT_INCLUDES += -I$(srcdir)
|
||||
|
||||
SHELLCHECK_OPTS = --enable=all
|
||||
|
||||
sbin_PROGRAMS = zpool
|
||||
|
||||
zpool_SOURCES = \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,4 +4,5 @@ if [ "$1" = "-h" ] ; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
echo upath="$VDEV_UPATH"
|
||||
|
||||
Reference in New Issue
Block a user