Add ShellCheck's `--enable=all` inside `etc/`
Strengthen static code analysis for shell scripts. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #12913
This commit is contained in:
parent
ccc421ec39
commit
ae66d3aa90
|
@ -1,9 +1,10 @@
|
|||
include $(top_srcdir)/config/Shellcheck.am
|
||||
|
||||
SUBDIRS = zfs sudoers.d
|
||||
SHELLCHECKDIRS = zfs
|
||||
SHELLCHECKDIRS = default $(ZFS_INIT_SYSV) zfs
|
||||
SHELLCHECK_OPTS = --enable=all
|
||||
|
||||
if BUILD_LINUX
|
||||
SHELLCHECKDIRS += default $(ZFS_INIT_SYSV)
|
||||
SUBDIRS += default $(ZFS_INIT_SYSTEMD) $(ZFS_INIT_SYSV) $(ZFS_MODULE_LOAD)
|
||||
endif
|
||||
DIST_SUBDIRS = default init.d zfs systemd modules-load.d sudoers.d
|
||||
|
|
|
@ -5,4 +5,5 @@ initconf_SCRIPTS = zfs
|
|||
|
||||
SUBSTFILES += $(initconf_SCRIPTS)
|
||||
|
||||
SHELLCHECK_SHELL = sh
|
||||
SHELLCHECK_SHELL = dash
|
||||
SHELLCHECK_OPTS = --enable=all
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# OpenZFS userland configuration.
|
||||
# shellcheck disable=SC2154
|
||||
|
||||
# NOTE: This file is intended for sysv init and initramfs.
|
||||
# Changing some of these settings may not make any difference on
|
||||
|
|
|
@ -7,4 +7,5 @@ init_SCRIPTS = zfs-import zfs-load-key zfs-mount zfs-share zfs-zed
|
|||
|
||||
SUBSTFILES += $(init_SCRIPTS)
|
||||
|
||||
SHELLCHECK_SHELL = dash # local variables
|
||||
SHELLCHECK_SHELL = dash
|
||||
SHELLCHECK_OPTS = --enable=all
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!@DEFAULT_INIT_SHELL@
|
||||
# shellcheck disable=SC2154
|
||||
#
|
||||
# zfs-import This script will import ZFS pools
|
||||
#
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!@DEFAULT_INIT_SHELL@
|
||||
# shellcheck disable=SC2154
|
||||
#
|
||||
# zfs-load-key This script will load/unload the zfs filesystems keys.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!@DEFAULT_INIT_SHELL@
|
||||
# shellcheck disable=SC2154
|
||||
#
|
||||
# zfs-mount This script will mount/umount the zfs filesystems.
|
||||
#
|
||||
|
@ -68,7 +69,7 @@ do_mount()
|
|||
check_boolean "$DO_OVERLAY_MOUNTS" && overlay=O
|
||||
|
||||
zfs_action "Mounting ZFS filesystem(s)" \
|
||||
"$ZFS" mount -a$verbose$overlay "$MOUNT_EXTRA_OPTIONS"
|
||||
"$ZFS" mount "-a$verbose$overlay" "$MOUNT_EXTRA_OPTIONS"
|
||||
|
||||
# Require each volume/filesystem to have 'noauto' and no fsck
|
||||
# option. This shouldn't really be necessary, as long as one
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!@DEFAULT_INIT_SHELL@
|
||||
# shellcheck disable=SC2154
|
||||
#
|
||||
# zfs-share This script will network share zfs filesystems and volumes.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!@DEFAULT_INIT_SHELL@
|
||||
# shellcheck disable=SC2154
|
||||
#
|
||||
# zfs-zed
|
||||
#
|
||||
|
|
|
@ -15,4 +15,5 @@ pkgsysconf_SCRIPTS = \
|
|||
|
||||
SUBSTFILES += $(pkgsysconf_SCRIPTS)
|
||||
|
||||
SHELLCHECK_SHELL = dash # local variables
|
||||
SHELLCHECK_OPTS = --enable=all
|
||||
SHELLCHECK_SHELL = dash
|
||||
|
|
|
@ -46,6 +46,7 @@ elif type success > /dev/null 2>&1 ; then
|
|||
|
||||
zfs_log_begin_msg() { printf "%s" "$1 "; }
|
||||
zfs_log_end_msg() {
|
||||
# shellcheck disable=SC2154
|
||||
zfs_set_ifs "$OLD_IFS"
|
||||
if [ "$1" -eq 0 ]; then
|
||||
success
|
||||
|
@ -119,12 +120,12 @@ zfs_action()
|
|||
$CMD
|
||||
ret=$?
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
zfs_log_end_msg $ret
|
||||
zfs_log_end_msg "$ret"
|
||||
else
|
||||
zfs_log_failure_msg $ret
|
||||
zfs_log_failure_msg "$ret"
|
||||
fi
|
||||
|
||||
return $ret
|
||||
return "$ret"
|
||||
}
|
||||
|
||||
# Returns
|
||||
|
|
Loading…
Reference in New Issue