Add ShellCheck's `--enable=all` inside `scripts/`
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 #12914
This commit is contained in:
parent
8a7c4efd3c
commit
836136961a
|
@ -28,6 +28,7 @@ EXTRA_DIST = \
|
|||
$(EXTRA_SCRIPTS)
|
||||
|
||||
SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS)
|
||||
SHELLCHECK_OPTS = --enable=all
|
||||
|
||||
define EXTRA_ENVIRONMENT
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ new_change_commit()
|
|||
error=1
|
||||
fi
|
||||
|
||||
return $error
|
||||
return "$error"
|
||||
}
|
||||
|
||||
is_coverity_fix()
|
||||
|
@ -99,7 +99,7 @@ coverity_fix_commit()
|
|||
error=1
|
||||
fi
|
||||
|
||||
return $error
|
||||
return "$error"
|
||||
}
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
|
|
129
scripts/kmodtool
129
scripts/kmodtool
|
@ -54,9 +54,9 @@ error_out()
|
|||
print_rpmtemplate_header()
|
||||
{
|
||||
echo
|
||||
echo '%global kmodinstdir_prefix '${prefix}/lib/modules/
|
||||
echo '%global kmodinstdir_postfix '/extra/${kmodname}/
|
||||
echo '%global kernel_versions '${kernel_versions}
|
||||
echo "%global kmodinstdir_prefix ${prefix}/lib/modules/"
|
||||
echo "%global kmodinstdir_postfix /extra/${kmodname}/"
|
||||
echo "%global kernel_versions ${kernel_versions}"
|
||||
echo
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version}
|
|||
Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
EOF
|
||||
|
||||
if [[ ${obsolete_name} ]]; then
|
||||
if [ -n "${obsolete_name}" ]; then
|
||||
echo "Provides: akmod-${obsolete_name} = ${obsolete_version}"
|
||||
echo "Obsoletes: akmod-${obsolete_name} < ${obsolete_version}"
|
||||
fi
|
||||
|
@ -116,7 +116,7 @@ Provides: kmod-${kmodname}-PAE = %{?epoch:%{epoch}:}%{version}-%{release}
|
|||
Requires: akmod-${kmodname} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
EOF
|
||||
|
||||
if [[ ${obsolete_name} ]]; then
|
||||
if [ -n "${obsolete_name}" ]; then
|
||||
echo "Provides: kmod-${obsolete_name} = ${obsolete_version}"
|
||||
echo "Obsoletes: kmod-${obsolete_name} < ${obsolete_version}"
|
||||
fi
|
||||
|
@ -134,10 +134,10 @@ EOF
|
|||
|
||||
print_rpmtemplate_per_kmodpkg ()
|
||||
{
|
||||
if [[ "${1}" == "--custom" ]]; then
|
||||
if [ "${1}" = "--custom" ]; then
|
||||
shift
|
||||
local customkernel=true
|
||||
elif [[ "${1}" == "--redhat" ]]; then
|
||||
elif [ "${1}" = "--redhat" ]; then
|
||||
# this is needed for akmods
|
||||
shift
|
||||
local redhatkernel=true
|
||||
|
@ -148,7 +148,7 @@ print_rpmtemplate_per_kmodpkg ()
|
|||
|
||||
# Detect depmod install location
|
||||
local depmod_path=/sbin/depmod
|
||||
if [ ! -f ${depmod_path} ]; then
|
||||
if [ ! -f "${depmod_path}" ]; then
|
||||
depmod_path=/usr/sbin/depmod
|
||||
fi
|
||||
|
||||
|
@ -171,30 +171,30 @@ Requires(postun): kmod
|
|||
%endif
|
||||
EOF
|
||||
|
||||
if [[ ${obsolete_name} ]]; then
|
||||
if [ -n "${obsolete_name}" ]; then
|
||||
echo "Provides: kmod-${obsolete_name}-${kernel_uname_r} = ${obsolete_version}"
|
||||
echo "Obsoletes: kmod-${obsolete_name}-${kernel_uname_r} < ${obsolete_version}"
|
||||
fi
|
||||
|
||||
# second part
|
||||
if [[ ! "${customkernel}" ]]; then
|
||||
if [ -z "${customkernel}" ]; then
|
||||
cat <<EOF
|
||||
Requires: kernel-uname-r = ${kernel_uname_r}
|
||||
BuildRequires: kernel-devel-uname-r = ${kernel_uname_r}
|
||||
%{?KmodsRequires:Requires: %{KmodsRequires}-uname-r = ${kernel_uname_r}}
|
||||
%{?KmodsRequires:BuildRequires: %{KmodsRequires}-uname-r = ${kernel_uname_r}}
|
||||
%post -n kmod-${kmodname}-${kernel_uname_r}
|
||||
if [[ -f "/boot/System.map-${kernel_uname_r}" ]]; then
|
||||
if [ -f "/boot/System.map-${kernel_uname_r}" ]; then
|
||||
${prefix}${depmod_path} -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} > /dev/null || :
|
||||
elif [[ -f "/lib/modules/${kernel_uname_r}/System.map" ]]; then
|
||||
elif [ -f "/lib/modules/${kernel_uname_r}/System.map" ]; then
|
||||
${prefix}${depmod_path} -aeF /lib/modules/${kernel_uname_r}/System.map ${kernel_uname_r} > /dev/null || :
|
||||
else
|
||||
${prefix}${depmod_path} -ae ${kernel_uname_r} &> /dev/null || :
|
||||
fi
|
||||
%postun -n kmod-${kmodname}-${kernel_uname_r}
|
||||
if [[ -f "/boot/System.map-${kernel_uname_r}" ]]; then
|
||||
if [ -f "/boot/System.map-${kernel_uname_r}" ]; then
|
||||
${prefix}${depmod_path} -aF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} &> /dev/null || :
|
||||
elif [[ -f "/lib/modules/${kernel_uname_r}/System.map" ]]; then
|
||||
elif [ -f "/lib/modules/${kernel_uname_r}/System.map" ]; then
|
||||
${prefix}${depmod_path} -aF /lib/modules/${kernel_uname_r}/System.map ${kernel_uname_r} &> /dev/null || :
|
||||
else
|
||||
${prefix}${depmod_path} -a ${kernel_uname_r} &> /dev/null || :
|
||||
|
@ -204,9 +204,9 @@ EOF
|
|||
else
|
||||
cat <<EOF
|
||||
%post -n kmod-${kmodname}-${kernel_uname_r}
|
||||
[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && ${prefix}${depmod_path} -a > /dev/null || :
|
||||
[ "\$(uname -r)" = "${kernel_uname_r}" ] && ${prefix}${depmod_path} -a > /dev/null || :
|
||||
%postun -n kmod-${kmodname}-${kernel_uname_r}
|
||||
[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && ${prefix}${depmod_path} -a > /dev/null || :
|
||||
[ "\$(uname -r)" = "${kernel_uname_r}" ] && ${prefix}${depmod_path} -a > /dev/null || :
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
@ -227,10 +227,10 @@ EOF
|
|||
|
||||
print_rpmtemplate_kmoddevelpkg ()
|
||||
{
|
||||
if [[ "${1}" == "--custom" ]]; then
|
||||
if [ "${1}" = "--custom" ]; then
|
||||
shift
|
||||
local customkernel=true
|
||||
elif [[ "${1}" == "--redhat" ]]; then
|
||||
elif [ "${1}" = "--redhat" ]; then
|
||||
shift
|
||||
local redhatkernel=true
|
||||
fi
|
||||
|
@ -244,11 +244,11 @@ Group: System Environment/Kernel
|
|||
Provides: ${kmodname}-devel-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
EOF
|
||||
|
||||
if [[ ! ${customkernel} ]] && [[ ! ${redhatkernel} ]]; then
|
||||
if [ -z "${customkernel}" ] && [ -z "${redhatkernel}" ]; then
|
||||
echo "Requires: kmod-${kmodname}-devel-${kernel_uname_r} >= %{?epoch:%{epoch}:}%{version}-%{release}"
|
||||
fi
|
||||
|
||||
if [[ ${obsolete_name} ]]; then
|
||||
if [ -n "${obsolete_name}" ]; then
|
||||
echo "Provides: kmod-${obsolete_name}-devel = ${obsolete_version}"
|
||||
echo "Obsoletes: kmod-${obsolete_name}-devel < ${obsolete_version}"
|
||||
fi
|
||||
|
@ -263,14 +263,14 @@ the ${kmodname}-devel-<kernel> objects for the newest kernel.
|
|||
%defattr(644,root,root,755)
|
||||
%{_usrsrc}/${kmodname}-%{version}
|
||||
EOF
|
||||
if [[ ${obsolete_name} ]]; then
|
||||
if [ -n "${obsolete_name}" ]; then
|
||||
echo "%{_usrsrc}/${obsolete_name}-%{version}"
|
||||
fi
|
||||
|
||||
for kernel in ${1}; do
|
||||
local kernel_uname_r=${kernel}
|
||||
echo "%exclude %{_usrsrc}/${kmodname}-%{version}/${kernel_uname_r}"
|
||||
if [[ ${obsolete_name} ]]; then
|
||||
if [ -n "${obsolete_name}" ]; then
|
||||
echo "%exclude %{_usrsrc}/${obsolete_name}-%{version}/${kernel_uname_r}"
|
||||
fi
|
||||
done
|
||||
|
@ -281,10 +281,10 @@ EOF
|
|||
|
||||
print_rpmtemplate_per_kmoddevelpkg ()
|
||||
{
|
||||
if [[ "${1}" == "--custom" ]]; then
|
||||
if [ "${1}" = "--custom" ]; then
|
||||
shift
|
||||
local customkernel=true
|
||||
elif [[ "${1}" == "--redhat" ]]; then
|
||||
elif [ "${1}" = "--redhat" ]; then
|
||||
# this is needed for akmods
|
||||
shift
|
||||
local redhatkernel=true
|
||||
|
@ -303,13 +303,13 @@ Provides: ${kmodname}-devel-kmod = %{?epoch:%{epoch}:}%{version}-%{relea
|
|||
Provides: kmod-${kmodname}-devel-uname-r = ${kernel_uname_r}
|
||||
EOF
|
||||
|
||||
if [[ ${obsolete_name} ]]; then
|
||||
if [ -n "${obsolete_name}" ]; then
|
||||
echo "Provides: kmod-${obsolete_name}-devel-${kernel_uname_r} = ${obsolete_version}"
|
||||
echo "Obsoletes: kmod-${obsolete_name}-devel-${kernel_uname_r} < ${obsolete_version}"
|
||||
fi
|
||||
|
||||
# second part
|
||||
if [[ ! "${customkernel}" ]]; then
|
||||
if [ -z "${customkernel}" ]; then
|
||||
cat <<EOF
|
||||
Requires: kernel-devel-uname-r = ${kernel_uname_r}
|
||||
BuildRequires: kernel-devel-uname-r = ${kernel_uname_r}
|
||||
|
@ -328,7 +328,7 @@ kernel ${kernel_uname_r} for the %{_target_cpu} family of processors.
|
|||
%defattr(644,root,root,755)
|
||||
%{_usrsrc}/${kmodname}-%{version}/${kernel_uname_r}
|
||||
EOF
|
||||
if [[ ${obsolete_name} ]]; then
|
||||
if [ -n "${obsolete_name}" ]; then
|
||||
echo "%{_usrsrc}/${obsolete_name}-%{version}/${kernel_uname_r}"
|
||||
fi
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ Requires: kmod-${kmodname}-${kernel_uname_r} >= %{?epoch:%{epoch}:}%{vers
|
|||
%{?KmodsMetaRequires:Requires: %{?KmodsMetaRequires}}
|
||||
EOF
|
||||
|
||||
if [[ ${obsolete_name} ]]; then
|
||||
if [ -n "${obsolete_name}" ]; then
|
||||
echo "Provides: kmod-${obsolete_name}${kernel_variant} = ${obsolete_version}"
|
||||
echo "Obsoletes: kmod-${obsolete_name}${kernel_variant} < ${obsolete_version}"
|
||||
fi
|
||||
|
@ -371,7 +371,7 @@ print_customrpmtemplate ()
|
|||
{
|
||||
for kernel in ${1}
|
||||
do
|
||||
if [[ -e "${buildroot}/usr/src/kernels/${kernel}" ]] ; then
|
||||
if [ -e "${buildroot}/usr/src/kernels/${kernel}" ] ; then
|
||||
# this looks like a Fedora/RH kernel -- print a normal template (which includes the proper BR) and be happy :)
|
||||
kernel_versions="${kernel_versions}${kernel}___${buildroot}%{_usrsrc}/kernels/${kernel} "
|
||||
|
||||
|
@ -380,14 +380,14 @@ print_customrpmtemplate ()
|
|||
print_rpmtemplate_per_kmodpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
|
||||
|
||||
# create development package
|
||||
if [[ "${devel}" ]]; then
|
||||
if [ -n "${devel}" ]; then
|
||||
# create devel package including common headers
|
||||
print_rpmtemplate_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
|
||||
|
||||
# create devel package
|
||||
print_rpmtemplate_per_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
|
||||
fi
|
||||
elif [[ -e ${prefix}/lib/modules/"${kernel}"/build/Makefile ]] ; then
|
||||
elif [ -e "${prefix}/lib/modules/${kernel}/build/Makefile" ]; then
|
||||
# likely a user-build-kernel with available buildfiles
|
||||
# fixme: we should check if uname from Makefile is the same as ${kernel}
|
||||
|
||||
|
@ -395,7 +395,7 @@ print_customrpmtemplate ()
|
|||
print_rpmtemplate_per_kmodpkg --custom "${kernel}"
|
||||
|
||||
# create development package
|
||||
if [[ "${devel}" ]]; then
|
||||
if [ -n "${devel}" ]; then
|
||||
# create devel package including common headers
|
||||
print_rpmtemplate_kmoddevelpkg --custom "${kernel}"
|
||||
|
||||
|
@ -429,17 +429,17 @@ print_rpmtemplate ()
|
|||
local kernel_verrelarch=${kernel%%${kernels_known_variants}}
|
||||
|
||||
# create metapackage
|
||||
print_rpmtemplate_kmodmetapkg ${kernel} ${kernel##${kernel_verrelarch}}
|
||||
print_rpmtemplate_kmodmetapkg "${kernel}" "${kernel##${kernel_verrelarch}}"
|
||||
|
||||
# create package
|
||||
print_rpmtemplate_per_kmodpkg ${kernel} ${kernel##${kernel_verrelarch}}
|
||||
print_rpmtemplate_per_kmodpkg "${kernel}" "${kernel##${kernel_verrelarch}}"
|
||||
|
||||
if [[ "${devel}" ]]; then
|
||||
if [ -n "${devel}" ]; then
|
||||
# create devel package including common headers
|
||||
print_rpmtemplate_kmoddevelpkg ${kernel} ${kernel##${kernel_verrelarch}}
|
||||
print_rpmtemplate_kmoddevelpkg "${kernel}" "${kernel##${kernel_verrelarch}}"
|
||||
|
||||
# create devel package
|
||||
print_rpmtemplate_per_kmoddevelpkg ${kernel} ${kernel##${kernel_verrelarch}}
|
||||
print_rpmtemplate_per_kmoddevelpkg "${kernel}" "${kernel##${kernel_verrelarch}}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -447,8 +447,10 @@ print_rpmtemplate ()
|
|||
myprog_help ()
|
||||
{
|
||||
echo "Usage: ${0##*/} [OPTIONS]"
|
||||
echo $'\n'"Creates a template to be used during kmod building"
|
||||
echo $'\n'"Available options:"
|
||||
echo
|
||||
echo "Creates a template to be used during kmod building"
|
||||
echo
|
||||
echo "Available options:"
|
||||
echo " --filterfile <file> -- filter the results with grep --file <file>"
|
||||
echo " --for-kernels <list> -- created templates only for these kernels"
|
||||
echo " --kmodname <file> -- name of the kmod (required)"
|
||||
|
@ -459,13 +461,13 @@ myprog_help ()
|
|||
echo " --buildroot <dir> -- Build root (place to look for build files)"
|
||||
}
|
||||
|
||||
while [ "${1}" ] ; do
|
||||
while [ -n "${1}" ] ; do
|
||||
case "${1}" in
|
||||
--filterfile)
|
||||
shift
|
||||
if [[ ! "${1}" ]] ; then
|
||||
if [ -z "${1}" ] ; then
|
||||
error_out 2 "Please provide path to a filter-file together with --filterfile" >&2
|
||||
elif [[ ! -e "${1}" ]]; then
|
||||
elif [ ! -e "${1}" ]; then
|
||||
error_out 2 "Filterfile ${1} not found" >&2
|
||||
fi
|
||||
filterfile="${1}"
|
||||
|
@ -473,7 +475,7 @@ while [ "${1}" ] ; do
|
|||
;;
|
||||
--kmodname)
|
||||
shift
|
||||
if [[ ! "${1}" ]] ; then
|
||||
if [ -z "${1}" ] ; then
|
||||
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
|
||||
fi
|
||||
# strip pending -kmod
|
||||
|
@ -486,7 +488,7 @@ while [ "${1}" ] ; do
|
|||
;;
|
||||
--prefix)
|
||||
shift
|
||||
if [[ ! "${1}" ]] ; then
|
||||
if [ -z "${1}" ] ; then
|
||||
error_out 2 "Please provide a prefix with --prefix" >&2
|
||||
fi
|
||||
prefix="${1}"
|
||||
|
@ -494,7 +496,7 @@ while [ "${1}" ] ; do
|
|||
;;
|
||||
--repo)
|
||||
shift
|
||||
if [[ ! "${1}" ]] ; then
|
||||
if [ -z "${1}" ] ; then
|
||||
error_out 2 "Please provide the name of the repo together with --repo" >&2
|
||||
fi
|
||||
repo=${1}
|
||||
|
@ -502,7 +504,7 @@ while [ "${1}" ] ; do
|
|||
;;
|
||||
--for-kernels)
|
||||
shift
|
||||
if [[ ! "${1}" ]] ; then
|
||||
if [ -z "${1}" ] ; then
|
||||
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
|
||||
fi
|
||||
for_kernels="${1}"
|
||||
|
@ -514,7 +516,7 @@ while [ "${1}" ] ; do
|
|||
;;
|
||||
--obsolete-name)
|
||||
shift
|
||||
if [[ ! "${1}" ]] ; then
|
||||
if [ -z "${1}" ] ; then
|
||||
error_out 2 "Please provide the name of the kmod to obsolete together with --obsolete-name" >&2
|
||||
fi
|
||||
obsolete_name="${1}"
|
||||
|
@ -522,7 +524,7 @@ while [ "${1}" ] ; do
|
|||
;;
|
||||
--obsolete-version)
|
||||
shift
|
||||
if [[ ! "${1}" ]] ; then
|
||||
if [ -z "${1}" ] ; then
|
||||
error_out 2 "Please provide the version of the kmod to obsolete together with --obsolete-version" >&2
|
||||
fi
|
||||
obsolete_version="${1}"
|
||||
|
@ -566,30 +568,30 @@ while [ "${1}" ] ; do
|
|||
esac
|
||||
done
|
||||
|
||||
if [[ -e ./kmodtool-kernel-variants ]]; then
|
||||
if [ -e ./kmodtool-kernel-variants ]; then
|
||||
kernels_known_variants="$(cat ./kmodtool-kernel-variants)"
|
||||
elif [[ -e /usr/share/kmodtool/kernel-variants ]] ; then
|
||||
elif [ -e /usr/share/kmodtool/kernel-variants ] ; then
|
||||
kernels_known_variants="$(cat /usr/share/kmodtool/kernel-variants)"
|
||||
else
|
||||
kernels_known_variants="@(smp?(-debug)|PAE?(-debug)|debug|kdump|xen|kirkwood|highbank|imx|omap|tegra)"
|
||||
fi
|
||||
|
||||
# general sanity checks
|
||||
if [[ ! "${target}" ]]; then
|
||||
if [ -z "${target}" ]; then
|
||||
error_out 2 "please pass target arch with --target"
|
||||
elif [[ ! "${kmodname}" ]]; then
|
||||
elif [ -z "${kmodname}" ]; then
|
||||
error_out 2 "please pass kmodname with --kmodname"
|
||||
elif [[ ! "${kernels_known_variants}" ]] ; then
|
||||
elif [ -z "${kernels_known_variants}" ] ; then
|
||||
error_out 2 "could not determine known variants"
|
||||
elif { [[ "${obsolete_name}" ]] && [[ ! "${obsolete_version}" ]]; } || { [[ ! "${obsolete_name}" ]] && [[ "${obsolete_version}" ]]; } ; then
|
||||
elif { [ -n "${obsolete_name}" ] && [ -z "${obsolete_version}" ]; } || { [ -z "${obsolete_name}" ] && [ -n "${obsolete_version}" ]; } ; then
|
||||
error_out 2 "you need to provide both --obsolete-name and --obsolete-version"
|
||||
fi
|
||||
|
||||
# go
|
||||
if [[ "${for_kernels}" ]]; then
|
||||
if [ -n "${for_kernels}" ]; then
|
||||
# this is easy:
|
||||
print_customrpmtemplate "${for_kernels}"
|
||||
elif [[ "${build_kernels}" == "akmod" ]]; then
|
||||
elif [ "${build_kernels}" = "akmod" ]; then
|
||||
# do only a akmod package
|
||||
print_akmodtemplate
|
||||
print_akmodmeta
|
||||
|
@ -597,9 +599,9 @@ else
|
|||
# seems we are on out own to decide for which kernels to build
|
||||
|
||||
# we need more sanity checks in this case
|
||||
if [[ ! "${repo}" ]]; then
|
||||
if [ -z "${repo}" ]; then
|
||||
error_out 2 "please provide repo name with --repo"
|
||||
elif ! command -v "buildsys-build-${repo}-kerneldevpkgs" &> /dev/null ; then
|
||||
elif ! command -v "buildsys-build-${repo}-kerneldevpkgs" > /dev/null 2>&1; then
|
||||
error_out 2 "buildsys-build-${repo}-kerneldevpkgs not found"
|
||||
fi
|
||||
|
||||
|
@ -607,17 +609,18 @@ else
|
|||
cmdoptions="--target ${target}"
|
||||
|
||||
# filterfile to filter list of kernels?
|
||||
if [[ "${filterfile}" ]] ; then
|
||||
if [ -n "${filterfile}" ] ; then
|
||||
cmdoptions="${cmdoptions} --filterfile ${filterfile}"
|
||||
fi
|
||||
|
||||
kernel_versions_to_build_for="$(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})"
|
||||
kernel_versions_to_build_for=$(buildsys-build-${repo}-kerneldevpkgs "--${build_kernels}" ${cmdoptions})
|
||||
returncode=$?
|
||||
if (( returncode != 0 )); then
|
||||
error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: $(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})"
|
||||
if [ "$returncode" -ne 0 ]; then
|
||||
|
||||
error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: ${kernel_versions_to_build_for}"
|
||||
fi
|
||||
|
||||
if [[ "${build_kernels}" == "current" ]] && [[ ! "${noakmod}" ]]; then
|
||||
if [ "${build_kernels}" = "current" ] && [ -z "${noakmod}" ]; then
|
||||
print_akmodtemplate
|
||||
fi
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
# `configure` is run.
|
||||
#
|
||||
|
||||
set -e -u
|
||||
set -eu
|
||||
|
||||
dist=no
|
||||
distdir=.
|
||||
|
@ -34,6 +34,7 @@ do
|
|||
case $flag in
|
||||
\?) echo "Usage: $0 [-D distdir] [file]" >&2; exit 1;;
|
||||
D) dist=yes; distdir=${OPTARG};;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
@ -45,6 +46,7 @@ GITREV="${1:-include/zfs_gitrev.h}"
|
|||
case "${GITREV}" in
|
||||
/*) echo "Error: ${GITREV} should be a relative path" >&2
|
||||
exit 1;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
ZFS_GITREV=$({ cd "${top_srcdir}" &&
|
||||
|
@ -60,7 +62,7 @@ then
|
|||
'1s/^#define[[:blank:]]ZFS_META_GITREV "\([^"]*\)"$/\1/p' \
|
||||
"${top_srcdir}/${GITREV}")
|
||||
fi
|
||||
elif [ ${dist} = yes ]
|
||||
elif [ "${dist}" = yes ]
|
||||
then
|
||||
# Append -dist when creating distributed sources from a git repository
|
||||
ZFS_GITREV="${ZFS_GITREV}-dist"
|
||||
|
|
|
@ -40,4 +40,4 @@ if [ x"${OUT}" != x ]; then
|
|||
echo
|
||||
fi
|
||||
|
||||
exit $RET
|
||||
exit "$RET"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh
|
||||
# shellcheck disable=SC2154
|
||||
#
|
||||
# This script is designed to facilitate in-tree development and testing
|
||||
# by installing symlinks on your system which refer to in-tree helper
|
||||
|
@ -85,6 +86,8 @@ while getopts 'hdirv' OPTION; do
|
|||
usage
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh
|
||||
# shellcheck disable=SC2154
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
|
@ -422,6 +423,8 @@ while getopts 'hvqxkfScRn:d:s:r:?t:T:u:I:' OPTION; do
|
|||
usage
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -442,7 +445,7 @@ if [ -n "$SINGLETEST" ]; then
|
|||
SINGLEQUIET="True"
|
||||
fi
|
||||
|
||||
cat >$RUNFILE_DIR/$RUNFILES << EOF
|
||||
cat >"${RUNFILE_DIR}/${RUNFILES}" << EOF
|
||||
[DEFAULT]
|
||||
pre =
|
||||
quiet = $SINGLEQUIET
|
||||
|
@ -466,7 +469,7 @@ EOF
|
|||
CLEANUPSCRIPT="cleanup"
|
||||
fi
|
||||
|
||||
cat >>$RUNFILE_DIR/$RUNFILES << EOF
|
||||
cat >>"${RUNFILE_DIR}/${RUNFILES}" << EOF
|
||||
|
||||
[$SINGLETESTDIR]
|
||||
tests = ['$SINGLETESTFILE']
|
||||
|
@ -745,4 +748,4 @@ if [ -n "$SINGLETEST" ]; then
|
|||
rm -f "$RUNFILES" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
exit ${RESULT}
|
||||
exit "${RESULT}"
|
||||
|
|
|
@ -75,6 +75,8 @@ while getopts 'hvruS' OPTION; do
|
|||
usage
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -271,6 +273,10 @@ if [ "$UNLOAD" = "yes" ]; then
|
|||
stack_check_linux
|
||||
unload_modules_linux
|
||||
;;
|
||||
*)
|
||||
echo "unknown system: $UNAME" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ "$LOAD" = "yes" ]; then
|
||||
|
@ -285,6 +291,10 @@ if [ "$LOAD" = "yes" ]; then
|
|||
udevadm trigger
|
||||
udevadm settle
|
||||
;;
|
||||
*)
|
||||
echo "unknown system: $UNAME" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ KEEP="no"
|
|||
VERBOSE="no"
|
||||
COLOR="yes"
|
||||
REPO="https://github.com/openzfs"
|
||||
IMAGES_DIR="$SCRIPTDIR/zfs-images/"
|
||||
IMAGES_DIR="${BASE_DIR}/zfs-images/"
|
||||
IMAGES_TAR="https://github.com/openzfs/zfs-images/tarball/master"
|
||||
ERROR=0
|
||||
|
||||
|
@ -140,7 +140,7 @@ while getopts 'hvckr:s:i:p:f:o:?' OPTION; do
|
|||
o)
|
||||
POOL_CREATE_OPTIONS="$OPTARG"
|
||||
;;
|
||||
?)
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
|
@ -170,7 +170,7 @@ populate() {
|
|||
for DIR in $DIRS; do
|
||||
COUNT=$((RANDOM % MAX_DIR_SIZE))
|
||||
|
||||
for _ in $(seq $COUNT); do
|
||||
for _ in $(seq "$COUNT"); do
|
||||
FILE=$(mktemp -p "$DIR")
|
||||
SIZE=$((RANDOM % MAX_FILE_SIZE))
|
||||
dd if=/dev/urandom of="$FILE" bs=1k \
|
||||
|
@ -471,7 +471,7 @@ for TAG in $POOL_TAGS; do
|
|||
# Verify 'zpool import' works for all listed source versions.
|
||||
for SRC_TAG in $SRC_TAGS; do
|
||||
|
||||
if [ $SKIP -eq 1 ]; then
|
||||
if [ "$SKIP" -eq 1 ]; then
|
||||
skip_nonewline
|
||||
continue
|
||||
fi
|
||||
|
@ -509,4 +509,4 @@ if [ "$KEEP" = "no" ]; then
|
|||
rm -Rf "$TEST_DIR"
|
||||
fi
|
||||
|
||||
exit $ERROR
|
||||
exit "$ERROR"
|
||||
|
|
|
@ -102,10 +102,12 @@ function core_file
|
|||
|
||||
function core_prog
|
||||
{
|
||||
# shellcheck disable=SC2154
|
||||
prog=$ZTEST
|
||||
core_id=$($GDB --batch -c "$1" | grep "Core was generated by" | \
|
||||
tr \' ' ')
|
||||
if [[ "$core_id" == *"zdb "* ]]; then
|
||||
# shellcheck disable=SC2154
|
||||
prog=$ZDB
|
||||
fi
|
||||
printf "%s" "$prog"
|
||||
|
@ -130,7 +132,7 @@ function store_core
|
|||
or_die mkdir -p "$dest/vdev"
|
||||
|
||||
if [[ $symlink -ne 0 ]]; then
|
||||
or_die ln -sf "$dest" ztest.core.$foundcrashes
|
||||
or_die ln -sf "$dest" "ztest.core.${foundcrashes}"
|
||||
fi
|
||||
|
||||
echo "*** ztest crash found - moving logs to $dest"
|
||||
|
@ -195,10 +197,10 @@ while getopts ":ht:m:I:s:c:f:l" opt; do
|
|||
case $opt in
|
||||
t ) [[ $OPTARG -gt 0 ]] && timeout=$OPTARG ;;
|
||||
m ) [[ $OPTARG -gt 0 ]] && coremax=$OPTARG ;;
|
||||
I ) [[ $OPTARG ]] && iterations=$OPTARG ;;
|
||||
s ) [[ $OPTARG ]] && size=$OPTARG ;;
|
||||
c ) [[ $OPTARG ]] && coredir=$OPTARG ;;
|
||||
f ) [[ $OPTARG ]] && basedir=$(readlink -f "$OPTARG") ;;
|
||||
I ) [[ -n $OPTARG ]] && iterations=$OPTARG ;;
|
||||
s ) [[ -n $OPTARG ]] && size=$OPTARG ;;
|
||||
c ) [[ -n $OPTARG ]] && coredir=$OPTARG ;;
|
||||
f ) [[ -n $OPTARG ]] && basedir=$(readlink -f "$OPTARG") ;;
|
||||
l ) symlink=1 ;;
|
||||
h ) usage
|
||||
exit 2
|
||||
|
|
Loading…
Reference in New Issue