Pass `--enable=all` to shellcheck within contrib/
- Remove `SHELLCHECK_IGNORE` in favor of inline suppressions and more general `SHELLCHECK_OPTS`. - Exclude `SC2250` (turned on by `--enable=all`) globally - Pass `--enable=all` to shellcheck for scripts in contrib/: it's very important to catch errors early in areas that are not easily testable. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #12760
This commit is contained in:
parent
4325de09cd
commit
34eef3e9a7
|
@ -1,7 +1,7 @@
|
||||||
.PHONY: shellcheck
|
.PHONY: shellcheck
|
||||||
shellcheck: $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
shellcheck: $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
||||||
if HAVE_SHELLCHECK
|
if HAVE_SHELLCHECK
|
||||||
[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") --exclude=SC1090,SC1091$(SHELLCHECK_IGNORE) --format=gcc $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck --format=gcc --exclude=SC1090,SC1091,SC2250 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") $(SHELLCHECK_OPTS) $(SCRIPTS) $(SHELLCHECKSCRIPTS)
|
||||||
else
|
else
|
||||||
@[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping shellcheck of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because shellcheck is not installed"
|
@[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping shellcheck of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because shellcheck is not installed"
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -10,3 +10,4 @@ endif
|
||||||
DIST_SUBDIRS = bash_completion.d bpftrace dracut initramfs pam_zfs_key pyzfs zcp
|
DIST_SUBDIRS = bash_completion.d bpftrace dracut initramfs pam_zfs_key pyzfs zcp
|
||||||
|
|
||||||
SHELLCHECKDIRS = bash_completion.d bpftrace dracut initramfs
|
SHELLCHECKDIRS = bash_completion.d bpftrace dracut initramfs
|
||||||
|
SHELLCHECK_OPTS = --enable=all
|
||||||
|
|
|
@ -10,4 +10,4 @@ SUBSTFILES += $(noinst_DATA)
|
||||||
|
|
||||||
SHELLCHECKSCRIPTS = $(noinst_DATA)
|
SHELLCHECKSCRIPTS = $(noinst_DATA)
|
||||||
SHELLCHECK_SHELL = bash
|
SHELLCHECK_SHELL = bash
|
||||||
SHELLCHECK_IGNORE = ,SC2207
|
SHELLCHECK_OPTS = --enable=all
|
||||||
|
|
|
@ -185,9 +185,9 @@ __zfs_complete_ordered_arguments()
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
if __zfs_argument_chosen $list1
|
if __zfs_argument_chosen $list1
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "$list2 $extra" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$list2 $extra" -- "$cur")
|
||||||
else
|
else
|
||||||
COMPREPLY=($(compgen -W "$list1 $extra" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$list1 $extra" -- "$cur")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,9 +197,9 @@ __zfs_complete_multiple_options()
|
||||||
local cur=$2
|
local cur=$2
|
||||||
local existing_opts
|
local existing_opts
|
||||||
|
|
||||||
COMPREPLY=($(compgen -W "$options" -- "${cur##*,}"))
|
mapfile -t COMPREPLY < <(compgen -W "$options" -- "${cur##*,}")
|
||||||
existing_opts=$(expr "$cur" : '\(.*,\)')
|
existing_opts=$(expr "$cur" : '\(.*,\)')
|
||||||
if [[ $existing_opts ]]
|
if [ -n "$existing_opts" ]
|
||||||
then
|
then
|
||||||
COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
|
COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
|
||||||
fi
|
fi
|
||||||
|
@ -210,7 +210,7 @@ __zfs_complete_switch()
|
||||||
local options=$1
|
local options=$1
|
||||||
if [[ ${cur:0:1} == - ]]
|
if [[ ${cur:0:1} == - ]]
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "-{$options}" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "-{$options}" -- "$cur")
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
@ -244,7 +244,7 @@ __zfs_complete()
|
||||||
if [[ ${prev##*/} == zfs ]]
|
if [[ ${prev##*/} == zfs ]]
|
||||||
then
|
then
|
||||||
cmds=$(__zfs_get_commands)
|
cmds=$(__zfs_get_commands)
|
||||||
COMPREPLY=($(compgen -W "$cmds -?" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$cmds -?" -- "$cur")
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -252,15 +252,15 @@ __zfs_complete()
|
||||||
bookmark)
|
bookmark)
|
||||||
if __zfs_argument_chosen
|
if __zfs_argument_chosen
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "${prev%@*}# ${prev/@/#}" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "${prev%@*}# ${prev/@/#}" -- "$cur")
|
||||||
else
|
else
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
clone)
|
clone)
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
-o)
|
-o)
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_get_editable_properties)" -- "$cur")
|
||||||
__zfs_complete_nospace
|
__zfs_complete_nospace
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -268,9 +268,9 @@ __zfs_complete()
|
||||||
then
|
then
|
||||||
if __zfs_argument_chosen
|
if __zfs_argument_chosen
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_list_datasets)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_list_datasets)" -- "$cur")
|
||||||
else
|
else
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -279,7 +279,7 @@ __zfs_complete()
|
||||||
get)
|
get)
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
-d)
|
-d)
|
||||||
COMPREPLY=($(compgen -W "" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "" -- "$cur")
|
||||||
;;
|
;;
|
||||||
-t)
|
-t)
|
||||||
__zfs_complete_multiple_options "filesystem volume snapshot bookmark all" "$cur"
|
__zfs_complete_multiple_options "filesystem volume snapshot bookmark all" "$cur"
|
||||||
|
@ -296,7 +296,7 @@ __zfs_complete()
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
if __zfs_argument_chosen $(__zfs_get_properties)
|
if __zfs_argument_chosen $(__zfs_get_properties)
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
|
||||||
else
|
else
|
||||||
__zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur"
|
__zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur"
|
||||||
fi
|
fi
|
||||||
|
@ -313,7 +313,7 @@ __zfs_complete()
|
||||||
list)
|
list)
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
-d)
|
-d)
|
||||||
COMPREPLY=($(compgen -W "" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "" -- "$cur")
|
||||||
;;
|
;;
|
||||||
-t)
|
-t)
|
||||||
__zfs_complete_multiple_options "filesystem volume snapshot bookmark all" "$cur"
|
__zfs_complete_multiple_options "filesystem volume snapshot bookmark all" "$cur"
|
||||||
|
@ -322,23 +322,23 @@ __zfs_complete()
|
||||||
__zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur"
|
__zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur"
|
||||||
;;
|
;;
|
||||||
-s|-S)
|
-s|-S)
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_get_properties)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_get_properties)" -- "$cur")
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if ! __zfs_complete_switch "H,r,d,o,t,s,S"
|
if ! __zfs_complete_switch "H,r,d,o,t,s,S"
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
promote)
|
promote)
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_list_filesystems)" -- "$cur")
|
||||||
;;
|
;;
|
||||||
rollback)
|
rollback)
|
||||||
if ! __zfs_complete_switch "r,R,f"
|
if ! __zfs_complete_switch "r,R,f"
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
send)
|
send)
|
||||||
|
@ -346,13 +346,13 @@ __zfs_complete()
|
||||||
then
|
then
|
||||||
if __zfs_argument_chosen
|
if __zfs_argument_chosen
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
|
||||||
else
|
else
|
||||||
if [[ $prev == -*i* ]]
|
if [[ $prev == -*i* ]]
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot_or_bookmark)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot_or_bookmark)" -- "$cur")
|
||||||
else
|
else
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -360,13 +360,13 @@ __zfs_complete()
|
||||||
snapshot)
|
snapshot)
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
-o)
|
-o)
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_get_editable_properties)" -- "$cur")
|
||||||
__zfs_complete_nospace
|
__zfs_complete_nospace
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if ! __zfs_complete_switch "o,r"
|
if ! __zfs_complete_switch "o,r"
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
|
||||||
__zfs_complete_nospace
|
__zfs_complete_nospace
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -379,12 +379,12 @@ __zfs_complete()
|
||||||
upgrade)
|
upgrade)
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
-a|-V|-v)
|
-a|-V|-v)
|
||||||
COMPREPLY=($(compgen -W "" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "" -- "$cur")
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if ! __zfs_complete_switch "a,V,v,r"
|
if ! __zfs_complete_switch "a,V,v,r"
|
||||||
then
|
then
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_list_filesystems)" -- "$cur")
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -397,7 +397,7 @@ __zfs_complete()
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if type __ltrim_colon_completions &> /dev/null
|
if type __ltrim_colon_completions &> /dev/null
|
||||||
|
@ -438,7 +438,7 @@ __zpool_complete()
|
||||||
if [[ ${prev##*/} == zpool ]]
|
if [[ ${prev##*/} == zpool ]]
|
||||||
then
|
then
|
||||||
cmds=$(__zpool_get_commands)
|
cmds=$(__zpool_get_commands)
|
||||||
COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$cmds" -- "$cur")
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@ __zpool_complete()
|
||||||
then
|
then
|
||||||
_filedir -d
|
_filedir -d
|
||||||
else
|
else
|
||||||
COMPREPLY=($(compgen -W "$(__zpool_list_pools) -d" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zpool_list_pools) -d" -- "$cur")
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
@ -468,12 +468,12 @@ __zpool_complete()
|
||||||
then
|
then
|
||||||
_filedir
|
_filedir
|
||||||
else
|
else
|
||||||
COMPREPLY=($(compgen -W "$pools" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$pools" -- "$cur")
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
COMPREPLY=($(compgen -W "$(__zpool_list_pools)" -- "$cur"))
|
mapfile -t COMPREPLY < <(compgen -W "$(__zpool_list_pools)" -- "$cur")
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -5,3 +5,4 @@ EXTRA_DIST = \
|
||||||
zfs-trace.sh
|
zfs-trace.sh
|
||||||
|
|
||||||
SHELLCHECKSCRIPTS = zfs-trace.sh
|
SHELLCHECKSCRIPTS = zfs-trace.sh
|
||||||
|
SHELLCHECK_OPTS = --enable=all
|
||||||
|
|
|
@ -5,4 +5,5 @@ pkgdracutdir = $(dracutdir)/modules.d/02zfsexpandknowledge
|
||||||
pkgdracut_SCRIPTS = \
|
pkgdracut_SCRIPTS = \
|
||||||
module-setup.sh
|
module-setup.sh
|
||||||
|
|
||||||
|
SHELLCHECK_OPTS = --enable=all
|
||||||
SUBSTFILES += $(pkgdracut_SCRIPTS)
|
SUBSTFILES += $(pkgdracut_SCRIPTS)
|
||||||
|
|
|
@ -19,6 +19,7 @@ pkgdracut_DATA = \
|
||||||
zfs-rollback-bootfs.service
|
zfs-rollback-bootfs.service
|
||||||
|
|
||||||
SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA)
|
SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA)
|
||||||
|
SHELLCHECK_OPTS = --enable=all
|
||||||
|
|
||||||
# Provided by /bin/sleep, and, again, every implementation of that supports this
|
# Provided by /bin/sleep, and, again, every implementation of that supports this
|
||||||
CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.'
|
CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.'
|
||||||
|
|
|
@ -20,7 +20,7 @@ _do_zpool_export() {
|
||||||
zpool list 2>&1 | vinfo
|
zpool list 2>&1 | vinfo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return ${ret}
|
return "${ret}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if command -v zpool >/dev/null; then
|
if command -v zpool >/dev/null; then
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
|
|
||||||
. /lib/dracut-zfs-lib.sh
|
. /lib/dracut-zfs-lib.sh
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
echo ZPOOL_IMPORT_OPTS="$ZPOOL_IMPORT_OPTS"
|
echo ZPOOL_IMPORT_OPTS="$ZPOOL_IMPORT_OPTS"
|
||||||
|
|
|
@ -61,9 +61,9 @@ install() {
|
||||||
dracut_install /usr/lib*/gcc/**/libgcc_s.so*
|
dracut_install /usr/lib*/gcc/**/libgcc_s.so*
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC2050
|
# shellcheck disable=SC2050
|
||||||
if [ @LIBFETCH_DYNAMIC@ != 0 ]; then
|
if [ "@LIBFETCH_DYNAMIC@" != 0 ]; then
|
||||||
for d in $libdirs; do
|
for d in $libdirs; do
|
||||||
[ -e "$d/"@LIBFETCH_SONAME@ ] && dracut_install "$d/"@LIBFETCH_SONAME@
|
[ -e "$d/@LIBFETCH_SONAME@" ] && dracut_install "$d/@LIBFETCH_SONAME@"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
dracut_install @mounthelperdir@/mount.zfs
|
dracut_install @mounthelperdir@/mount.zfs
|
||||||
|
@ -107,7 +107,7 @@ install() {
|
||||||
for _service in "zfs-import-scan.service" "zfs-import-cache.service" ; do
|
for _service in "zfs-import-scan.service" "zfs-import-cache.service" ; do
|
||||||
dracut_install "@systemdunitdir@/$_service"
|
dracut_install "@systemdunitdir@/$_service"
|
||||||
if ! [ -L "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service" ]; then
|
if ! [ -L "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service" ]; then
|
||||||
ln -sf ../$_service "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service"
|
ln -sf "../$_service" "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service"
|
||||||
type mark_hostonly >/dev/null 2>&1 && mark_hostonly "@systemdunitdir@/$_service"
|
type mark_hostonly >/dev/null 2>&1 && mark_hostonly "@systemdunitdir@/$_service"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -49,11 +49,14 @@ case "${root}" in
|
||||||
|
|
||||||
info "ZFS: Set ${root} as bootfs."
|
info "ZFS: Set ${root} as bootfs."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
info "ZFS: no ZFS-on-root"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Make sure Dracut is happy that we have a root and will wait for ZFS
|
# Make sure Dracut is happy that we have a root and will wait for ZFS
|
||||||
# modules to settle before mounting.
|
# modules to settle before mounting.
|
||||||
if [ ${wait_for_zfs} -eq 1 ]; then
|
if [ "${wait_for_zfs}" -eq 1 ]; then
|
||||||
ln -s /dev/null /dev/root 2>/dev/null
|
ln -s /dev/null /dev/root 2>/dev/null
|
||||||
initqueuedir="${hookdir}/initqueue/finished"
|
initqueuedir="${hookdir}/initqueue/finished"
|
||||||
test -d "${initqueuedir}" || {
|
test -d "${initqueuedir}" || {
|
||||||
|
|
|
@ -70,6 +70,7 @@ import_pool() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_mount_dataset_cb() {
|
_mount_dataset_cb() {
|
||||||
|
# shellcheck disable=SC2154
|
||||||
mount -o zfsutil -t zfs "${1}" "${NEWROOT}${2}"
|
mount -o zfsutil -t zfs "${1}" "${NEWROOT}${2}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ mount_dataset() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return ${ret}
|
return "${ret}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# for_relevant_root_children DATASET EXEC
|
# for_relevant_root_children DATASET EXEC
|
||||||
|
@ -117,7 +118,7 @@ for_relevant_root_children() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
exit ${_ret}
|
exit "${_ret}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ export_all() {
|
||||||
done
|
done
|
||||||
IFS="${OLDIFS}"
|
IFS="${OLDIFS}"
|
||||||
|
|
||||||
return ${ret}
|
return "${ret}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ask_for_password
|
# ask_for_password
|
||||||
|
@ -171,6 +172,7 @@ ask_for_password() {
|
||||||
--ply-tries) ply_tries="$2"; shift;;
|
--ply-tries) ply_tries="$2"; shift;;
|
||||||
--tty-tries) tty_tries="$2"; shift;;
|
--tty-tries) tty_tries="$2"; shift;;
|
||||||
--tty-echo-off) tty_echo_off=yes;;
|
--tty-echo-off) tty_echo_off=yes;;
|
||||||
|
*) echo "ask_for_password(): wrong opt '$1'" >&2;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
@ -202,6 +204,6 @@ ask_for_password() {
|
||||||
fi
|
fi
|
||||||
} 9>/.console_lock
|
} 9>/.console_lock
|
||||||
|
|
||||||
[ $ret -ne 0 ] && echo "Wrong password" >&2
|
[ "$ret" -ne 0 ] && echo "Wrong password" >&2
|
||||||
return $ret
|
return "$ret"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ dist_initrd_SCRIPTS = \
|
||||||
|
|
||||||
SUBDIRS = conf.d conf-hooks.d hooks scripts
|
SUBDIRS = conf.d conf-hooks.d hooks scripts
|
||||||
SHELLCHECKDIRS = hooks scripts
|
SHELLCHECKDIRS = hooks scripts
|
||||||
|
SHELLCHECK_OPTS = --enable=all
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
README.initramfs.markdown
|
README.initramfs.markdown
|
||||||
|
|
|
@ -7,4 +7,5 @@ hooks_SCRIPTS = \
|
||||||
zfs \
|
zfs \
|
||||||
zfsunlock
|
zfsunlock
|
||||||
|
|
||||||
|
SHELLCHECK_OPTS = --enable=all
|
||||||
SUBSTFILES += $(hooks_SCRIPTS)
|
SUBSTFILES += $(hooks_SCRIPTS)
|
||||||
|
|
|
@ -30,8 +30,8 @@ find /lib/ -type f -name "libgcc_s.so.[1-9]" | while read -r libgcc; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# shellcheck disable=SC2050
|
# shellcheck disable=SC2050
|
||||||
if [ @LIBFETCH_DYNAMIC@ != 0 ]; then
|
if [ "@LIBFETCH_DYNAMIC@" != 0 ]; then
|
||||||
find /lib/ -name @LIBFETCH_SONAME@ | while read -r libfetch; do
|
find /lib/ -name "@LIBFETCH_SONAME@" | while read -r libfetch; do
|
||||||
copy_exec "$libfetch"
|
copy_exec "$libfetch"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -9,3 +9,4 @@ SUBDIRS = local-top
|
||||||
|
|
||||||
SHELLCHECKDIRS = $(SUBDIRS)
|
SHELLCHECKDIRS = $(SUBDIRS)
|
||||||
SHELLCHECK_SHELL = sh
|
SHELLCHECK_SHELL = sh
|
||||||
|
SHELLCHECK_OPTS = --enable=all
|
||||||
|
|
|
@ -4,3 +4,5 @@ localtopdir = /usr/share/initramfs-tools/scripts/local-top
|
||||||
|
|
||||||
dist_localtop_SCRIPTS = \
|
dist_localtop_SCRIPTS = \
|
||||||
zfs
|
zfs
|
||||||
|
|
||||||
|
SHELLCHECK_OPTS = --enable=all
|
||||||
|
|
|
@ -596,7 +596,7 @@ setup_snapshot_booting()
|
||||||
retval=0
|
retval=0
|
||||||
|
|
||||||
# Make sure that the snapshot specified actually exists.
|
# Make sure that the snapshot specified actually exists.
|
||||||
if [ ! "$(get_fs_value "${snap}" type)" ]
|
if [ -z "$(get_fs_value "${snap}" type)" ]
|
||||||
then
|
then
|
||||||
# Snapshot does not exist (...@<null> ?)
|
# Snapshot does not exist (...@<null> ?)
|
||||||
# ask the user for a snapshot to use.
|
# ask the user for a snapshot to use.
|
||||||
|
@ -613,7 +613,8 @@ setup_snapshot_booting()
|
||||||
then
|
then
|
||||||
# If the destination dataset for the clone
|
# If the destination dataset for the clone
|
||||||
# already exists, destroy it. Recursively
|
# already exists, destroy it. Recursively
|
||||||
if [ "$(get_fs_value "${rootfs}_${snapname}" type)" ]; then
|
if [ -n "$(get_fs_value "${rootfs}_${snapname}" type)" ]
|
||||||
|
then
|
||||||
filesystems=$("${ZFS}" list -oname -tfilesystem -H \
|
filesystems=$("${ZFS}" list -oname -tfilesystem -H \
|
||||||
-r -Sname "${ZFS_BOOTFS}")
|
-r -Sname "${ZFS_BOOTFS}")
|
||||||
for fs in $filesystems; do
|
for fs in $filesystems; do
|
||||||
|
@ -848,7 +849,7 @@ mountroot()
|
||||||
done
|
done
|
||||||
IFS="$OLD_IFS"
|
IFS="$OLD_IFS"
|
||||||
|
|
||||||
[ "$quiet" != "y" ] && zfs_log_end_msg $ZFS_ERROR
|
[ "$quiet" != "y" ] && zfs_log_end_msg "$ZFS_ERROR"
|
||||||
else
|
else
|
||||||
# No auto - use value from the command line option.
|
# No auto - use value from the command line option.
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,3 @@ initconf_SCRIPTS = zfs
|
||||||
SUBSTFILES += $(initconf_SCRIPTS)
|
SUBSTFILES += $(initconf_SCRIPTS)
|
||||||
|
|
||||||
SHELLCHECK_SHELL = sh
|
SHELLCHECK_SHELL = sh
|
||||||
SHELLCHECK_IGNORE = ,SC2034
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
# To enable a boolean setting, set it to yes, on, true, or 1.
|
# To enable a boolean setting, set it to yes, on, true, or 1.
|
||||||
# Anything else will be interpreted as unset.
|
# Anything else will be interpreted as unset.
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
|
||||||
# Run `zfs mount -a` during system start?
|
# Run `zfs mount -a` during system start?
|
||||||
ZFS_MOUNT='yes'
|
ZFS_MOUNT='yes'
|
||||||
|
|
|
@ -27,7 +27,6 @@ EXTRA_DIST = \
|
||||||
zol2zfs-patch.sed \
|
zol2zfs-patch.sed \
|
||||||
$(EXTRA_SCRIPTS)
|
$(EXTRA_SCRIPTS)
|
||||||
|
|
||||||
SHELLCHECK_IGNORE = ,SC1117
|
|
||||||
SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS)
|
SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS)
|
||||||
|
|
||||||
define EXTRA_ENVIRONMENT
|
define EXTRA_ENVIRONMENT
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||||
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2086,SC2250
|
# shellcheck disable=SC2086
|
||||||
|
|
||||||
trap 'rm -f "$stdout_file" "$stderr_file" "$result_file"' EXIT
|
trap 'rm -f "$stdout_file" "$stderr_file" "$result_file"' EXIT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue