mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
Ubuntu 22.04 integration: ShellCheck
- Add new SC2312 global exclude. ``` Consider invoking this command separately to avoid masking its return value (or use '|| true' to ignore). [SC2312] ``` - Correct errors detected by new ShellCheck version. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reviewed-by: George Melikov <mail@gmelikov.ru> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #14148
This commit is contained in:
parent
c3b6fd3d59
commit
a5087965fe
@ -16,7 +16,7 @@ automake --version | awk '{print $NF; exit}' | (
|
|||||||
dir="${dir%/Makefile.am}"
|
dir="${dir%/Makefile.am}"
|
||||||
grep -q '%[CD]%' "$dir/Makefile.am" || continue
|
grep -q '%[CD]%' "$dir/Makefile.am" || continue
|
||||||
|
|
||||||
reldir="${dir#$root}"
|
reldir="${dir#"$root"}"
|
||||||
reldir="${reldir#/}"
|
reldir="${reldir#/}"
|
||||||
|
|
||||||
canon_reldir="$(printf '%s' "$reldir" | tr -C 'a-zA-Z0-9@_' '_')"
|
canon_reldir="$(printf '%s' "$reldir" | tr -C 'a-zA-Z0-9@_' '_')"
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# ShellCheck can't follow non-constant source. Use a directive to specify location. [SC1090]
|
# ShellCheck can't follow non-constant source. Use a directive to specify location. [SC1090]
|
||||||
# Not following: a was not specified as input (see shellcheck -x). [SC1091]
|
# Not following: a was not specified as input (see shellcheck -x). [SC1091]
|
||||||
# Prefer putting braces around variable references even when not strictly required. [SC2250]
|
# Prefer putting braces around variable references even when not strictly required. [SC2250]
|
||||||
|
# Consider invoking this command separately to avoid masking its return value (or use '|| true' to ignore). [SC2312]
|
||||||
# In POSIX sh, 'local' is undefined. [SC2039] # older ShellCheck versions
|
# In POSIX sh, 'local' is undefined. [SC2039] # older ShellCheck versions
|
||||||
# In POSIX sh, 'local' is undefined. [SC3043] # newer ShellCheck versions
|
# In POSIX sh, 'local' is undefined. [SC3043] # newer ShellCheck versions
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ PHONY += shellcheck
|
|||||||
_STGT = $(subst ^,/,$(subst shellcheck-here-,,$@))
|
_STGT = $(subst ^,/,$(subst shellcheck-here-,,$@))
|
||||||
shellcheck-here-%:
|
shellcheck-here-%:
|
||||||
if HAVE_SHELLCHECK
|
if HAVE_SHELLCHECK
|
||||||
shellcheck --format=gcc --enable=all --exclude=SC1090,SC1091,SC2039,SC2250,SC3043 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") "$$([ -e "$(_STGT)" ] || echo "$(srcdir)/")$(_STGT)"
|
shellcheck --format=gcc --enable=all --exclude=SC1090,SC1091,SC2039,SC2250,SC2312,SC3043 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") "$$([ -e "$(_STGT)" ] || echo "$(srcdir)/")$(_STGT)"
|
||||||
else
|
else
|
||||||
@echo "skipping shellcheck of" $(_STGT) "because shellcheck is not installed"
|
@echo "skipping shellcheck of" $(_STGT) "because shellcheck is not installed"
|
||||||
endif
|
endif
|
||||||
|
@ -63,11 +63,11 @@ __zfs_list_filesystems()
|
|||||||
__zfs_match_snapshot()
|
__zfs_match_snapshot()
|
||||||
{
|
{
|
||||||
local base_dataset="${cur%@*}"
|
local base_dataset="${cur%@*}"
|
||||||
if [ "$base_dataset" != "$cur" ]
|
if [[ "$base_dataset" != "$cur" ]]
|
||||||
then
|
then
|
||||||
$__ZFS_CMD list -H -o name -s name -t snapshot -d 1 "$base_dataset"
|
$__ZFS_CMD list -H -o name -s name -t snapshot -d 1 "$base_dataset"
|
||||||
else
|
else
|
||||||
if [ "$cur" != "" ] && __zfs_list_datasets "$cur" &> /dev/null
|
if [[ "$cur" != "" ]] && __zfs_list_datasets "$cur" &> /dev/null
|
||||||
then
|
then
|
||||||
$__ZFS_CMD list -H -o name -s name -t filesystem,volume -r "$cur" | tail -n +2
|
$__ZFS_CMD list -H -o name -s name -t filesystem,volume -r "$cur" | tail -n +2
|
||||||
# We output the base dataset name even though we might be
|
# We output the base dataset name even though we might be
|
||||||
@ -104,7 +104,7 @@ __zfs_match_snapshot()
|
|||||||
__zfs_match_snapshot_or_bookmark()
|
__zfs_match_snapshot_or_bookmark()
|
||||||
{
|
{
|
||||||
local base_dataset="${cur%[#@]*}"
|
local base_dataset="${cur%[#@]*}"
|
||||||
if [ "$base_dataset" != "$cur" ]
|
if [[ "$base_dataset" != "$cur" ]]
|
||||||
then
|
then
|
||||||
if [[ $cur == *@* ]]
|
if [[ $cur == *@* ]]
|
||||||
then
|
then
|
||||||
@ -114,7 +114,7 @@ __zfs_match_snapshot_or_bookmark()
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
$__ZFS_CMD list -H -o name -s name -t filesystem,volume
|
$__ZFS_CMD list -H -o name -s name -t filesystem,volume
|
||||||
if [ -e "$cur" ] && $__ZFS_CMD list -H -o name -s name -t filesystem,volume "$cur" &> /dev/null
|
if [[ -e "$cur" ]] && $__ZFS_CMD list -H -o name -s name -t filesystem,volume "$cur" &> /dev/null
|
||||||
then
|
then
|
||||||
echo "$cur@"
|
echo "$cur@"
|
||||||
echo "$cur#"
|
echo "$cur#"
|
||||||
@ -126,10 +126,10 @@ __zfs_match_multiple_snapshots()
|
|||||||
{
|
{
|
||||||
local existing_opts
|
local existing_opts
|
||||||
existing_opts="$(expr "$cur" : '\(.*\)[%,]')"
|
existing_opts="$(expr "$cur" : '\(.*\)[%,]')"
|
||||||
if [ -e "$existing_opts" ]
|
if [[ -e "$existing_opts" ]]
|
||||||
then
|
then
|
||||||
local base_dataset="${cur%@*}"
|
local base_dataset="${cur%@*}"
|
||||||
if [ "$base_dataset" != "$cur" ]
|
if [[ "$base_dataset" != "$cur" ]]
|
||||||
then
|
then
|
||||||
local cur="${cur##*,}"
|
local cur="${cur##*,}"
|
||||||
if [[ $cur =~ ^%|%.*% ]]
|
if [[ $cur =~ ^%|%.*% ]]
|
||||||
@ -199,7 +199,7 @@ __zfs_complete_multiple_options()
|
|||||||
|
|
||||||
mapfile -t COMPREPLY < <(compgen -W "$options" -- "${cur##*,}")
|
mapfile -t COMPREPLY < <(compgen -W "$options" -- "${cur##*,}")
|
||||||
existing_opts=$(expr "$cur" : '\(.*,\)')
|
existing_opts=$(expr "$cur" : '\(.*,\)')
|
||||||
if [ -n "$existing_opts" ]
|
if [[ -n "$existing_opts" ]]
|
||||||
then
|
then
|
||||||
COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
|
COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
|
||||||
fi
|
fi
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
get_devtype() {
|
get_devtype() {
|
||||||
local typ
|
local typ
|
||||||
typ=$(udevadm info --query=property --name="$1" | sed -n 's|^ID_FS_TYPE=||p')
|
typ=$(udevadm info --query=property --name="$1" | sed -n 's|^ID_FS_TYPE=||p')
|
||||||
if [ -z "$typ" ] ; then
|
if [[ -z "$typ" ]] ; then
|
||||||
typ=$(blkid -c /dev/null "$1" -o value -s TYPE)
|
typ=$(blkid -c /dev/null "$1" -o value -s TYPE)
|
||||||
fi
|
fi
|
||||||
echo "$typ"
|
echo "$typ"
|
||||||
@ -22,7 +22,7 @@ get_pool_devices() {
|
|||||||
else
|
else
|
||||||
awk -F '\t' '/\t\/dev/ { print $2 }' "$poolconfigtemp" | \
|
awk -F '\t' '/\t\/dev/ { print $2 }' "$poolconfigtemp" | \
|
||||||
while read -r pooldev ; do
|
while read -r pooldev ; do
|
||||||
if [ -e "$pooldev" ] ; then
|
if [[ -e "$pooldev" ]] ; then
|
||||||
resolved="$(readlink -f "$pooldev")"
|
resolved="$(readlink -f "$pooldev")"
|
||||||
dinfo "zfsexpandknowledge: pool $1 has device $pooldev (which resolves to $resolved)"
|
dinfo "zfsexpandknowledge: pool $1 has device $pooldev (which resolves to $resolved)"
|
||||||
echo "$resolved"
|
echo "$resolved"
|
||||||
@ -38,15 +38,15 @@ find_zfs_block_devices() {
|
|||||||
local fstype
|
local fstype
|
||||||
local _
|
local _
|
||||||
numfields="$(awk '{print NF; exit}' /proc/self/mountinfo)"
|
numfields="$(awk '{print NF; exit}' /proc/self/mountinfo)"
|
||||||
if [ "$numfields" = "10" ] ; then
|
if [[ "$numfields" = "10" ]] ; then
|
||||||
fields="_ _ _ _ mp _ _ fstype dev _"
|
fields="_ _ _ _ mp _ _ fstype dev _"
|
||||||
else
|
else
|
||||||
fields="_ _ _ _ mp _ _ _ fstype dev _"
|
fields="_ _ _ _ mp _ _ _ fstype dev _"
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
while read -r ${fields?} ; do
|
while read -r ${fields?} ; do
|
||||||
[ "$fstype" = "zfs" ] || continue
|
[[ "$fstype" = "zfs" ]] || continue
|
||||||
[ "$mp" = "$1" ] && get_pool_devices "${dev%%/*}"
|
[[ "$mp" = "$1" ]] && get_pool_devices "${dev%%/*}"
|
||||||
done < /proc/self/mountinfo
|
done < /proc/self/mountinfo
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ check() {
|
|||||||
local _depdevtype
|
local _depdevtype
|
||||||
|
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
if [ -n "$hostonly" ]; then
|
if [[ -n "$hostonly" ]]; then
|
||||||
|
|
||||||
for mp in \
|
for mp in \
|
||||||
"/" \
|
"/" \
|
||||||
@ -92,7 +92,7 @@ if [ -n "$hostonly" ]; then
|
|||||||
mp=$(readlink -f "$mp")
|
mp=$(readlink -f "$mp")
|
||||||
mountpoint "$mp" >/dev/null 2>&1 || continue
|
mountpoint "$mp" >/dev/null 2>&1 || continue
|
||||||
blockdevs=$(find_zfs_block_devices "$mp")
|
blockdevs=$(find_zfs_block_devices "$mp")
|
||||||
if [ -z "$blockdevs" ] ; then continue ; fi
|
if [[ -z "$blockdevs" ]] ; then continue ; fi
|
||||||
dinfo "zfsexpandknowledge: block devices backing ZFS dataset $mp: ${blockdevs//$'\n'/ }"
|
dinfo "zfsexpandknowledge: block devices backing ZFS dataset $mp: ${blockdevs//$'\n'/ }"
|
||||||
for dev in $blockdevs
|
for dev in $blockdevs
|
||||||
do
|
do
|
||||||
@ -100,9 +100,9 @@ if [ -n "$hostonly" ]; then
|
|||||||
fstype=$(get_devtype "$dev")
|
fstype=$(get_devtype "$dev")
|
||||||
host_fs_types["$dev"]="$fstype"
|
host_fs_types["$dev"]="$fstype"
|
||||||
majmin=$(get_maj_min "$dev")
|
majmin=$(get_maj_min "$dev")
|
||||||
if [ -d "/sys/dev/block/$majmin/slaves" ] ; then
|
if [[ -d "/sys/dev/block/$majmin/slaves" ]] ; then
|
||||||
for _depdev in "/sys/dev/block/$majmin/slaves"/*; do
|
for _depdev in "/sys/dev/block/$majmin/slaves"/*; do
|
||||||
[ -f "$_depdev/dev" ] || continue
|
[[ -f "$_depdev/dev" ]] || continue
|
||||||
_depdev="/dev/${_depdev##*/}"
|
_depdev="/dev/${_depdev##*/}"
|
||||||
_depdevname=$(udevadm info --query=property --name="$_depdev" | sed -n 's|^DEVNAME=||p')
|
_depdevname=$(udevadm info --query=property --name="$_depdev" | sed -n 's|^DEVNAME=||p')
|
||||||
_depdevtype=$(get_devtype "$_depdevname")
|
_depdevtype=$(get_devtype "$_depdevname")
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
check() {
|
check() {
|
||||||
# We depend on udev-rules being loaded
|
# We depend on udev-rules being loaded
|
||||||
[ "${1}" = "-d" ] && return 0
|
[[ "${1}" = "-d" ]] && return 0
|
||||||
|
|
||||||
# Verify the zfs tool chain
|
# Verify the zfs tool chain
|
||||||
for tool in "zgenhostid" "zpool" "zfs" "mount.zfs"; do
|
for tool in "zgenhostid" "zpool" "zfs" "mount.zfs"; do
|
||||||
@ -50,7 +50,7 @@ install() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
inst_hook cmdline 95 "${moddir}/parse-zfs.sh"
|
inst_hook cmdline 95 "${moddir}/parse-zfs.sh"
|
||||||
if [ -n "${systemdutildir}" ]; then
|
if [[ -n "${systemdutildir}" ]]; then
|
||||||
inst_script "${moddir}/zfs-generator.sh" "${systemdutildir}/system-generators/dracut-zfs-generator"
|
inst_script "${moddir}/zfs-generator.sh" "${systemdutildir}/system-generators/dracut-zfs-generator"
|
||||||
fi
|
fi
|
||||||
inst_hook pre-mount 90 "${moddir}/zfs-load-key.sh"
|
inst_hook pre-mount 90 "${moddir}/zfs-load-key.sh"
|
||||||
@ -68,7 +68,7 @@ install() {
|
|||||||
|
|
||||||
# Synchronize initramfs and system hostid
|
# Synchronize initramfs and system hostid
|
||||||
if ! inst_simple -H @sysconfdir@/hostid; then
|
if ! inst_simple -H @sysconfdir@/hostid; then
|
||||||
if HOSTID="$(hostid 2>/dev/null)" && [ "${HOSTID}" != "00000000" ]; then
|
if HOSTID="$(hostid 2>/dev/null)" && [[ "${HOSTID}" != "00000000" ]]; then
|
||||||
zgenhostid -o "${initdir}@sysconfdir@/hostid" "${HOSTID}"
|
zgenhostid -o "${initdir}@sysconfdir@/hostid" "${HOSTID}"
|
||||||
mark_hostonly @sysconfdir@/hostid
|
mark_hostonly @sysconfdir@/hostid
|
||||||
fi
|
fi
|
||||||
|
@ -640,8 +640,8 @@ setup_snapshot_booting()
|
|||||||
# rpool/ROOT/debian/boot@snap2 => rpool/ROOT/debian_snap2/boot
|
# rpool/ROOT/debian/boot@snap2 => rpool/ROOT/debian_snap2/boot
|
||||||
# rpool/ROOT/debian/usr@snap2 => rpool/ROOT/debian_snap2/usr
|
# rpool/ROOT/debian/usr@snap2 => rpool/ROOT/debian_snap2/usr
|
||||||
# rpool/ROOT/debian/var@snap2 => rpool/ROOT/debian_snap2/var
|
# rpool/ROOT/debian/var@snap2 => rpool/ROOT/debian_snap2/var
|
||||||
subfs="${s##$rootfs}"
|
subfs="${s##"$rootfs"}"
|
||||||
subfs="${subfs%%@$snapname}"
|
subfs="${subfs%%@"$snapname"}"
|
||||||
|
|
||||||
destfs="${rootfs}_${snapname}" # base fs.
|
destfs="${rootfs}_${snapname}" # base fs.
|
||||||
[ -n "$subfs" ] && destfs="${destfs}$subfs" # + sub fs.
|
[ -n "$subfs" ] && destfs="${destfs}$subfs" # + sub fs.
|
||||||
|
@ -8,15 +8,15 @@ export ZTS_DIR=
|
|||||||
export SCRIPT_DIR=
|
export SCRIPT_DIR=
|
||||||
|
|
||||||
# General commands
|
# General commands
|
||||||
export ZDB=${ZDB:-$SBIN_DIR/zdb}
|
export ZDB="${ZDB:-$SBIN_DIR/zdb}"
|
||||||
export ZFS=${ZFS:-$SBIN_DIR/zfs}
|
export ZFS="${ZFS:-$SBIN_DIR/zfs}"
|
||||||
export ZPOOL=${ZPOOL:-$SBIN_DIR/zpool}
|
export ZPOOL="${ZPOOL:-$SBIN_DIR/zpool}"
|
||||||
export ZTEST=${ZTEST:-$SBIN_DIR/ztest}
|
export ZTEST="${ZTEST:-$SBIN_DIR/ztest}"
|
||||||
export ZFS_SH=${ZFS_SH:-$SCRIPT_DIR/zfs.sh}
|
export ZFS_SH="${ZFS_SH:-$SCRIPT_DIR/zfs.sh}"
|
||||||
|
|
||||||
# Test Suite
|
# Test Suite
|
||||||
export RUNFILE_DIR=${RUNFILE_DIR:-$ZTS_DIR/runfiles}
|
export RUNFILE_DIR="${RUNFILE_DIR:-$ZTS_DIR/runfiles}"
|
||||||
export TEST_RUNNER=${TEST_RUNNER:-$ZTS_DIR/test-runner/bin/test-runner.py}
|
export TEST_RUNNER="${TEST_RUNNER:-$ZTS_DIR/test-runner/bin/test-runner.py}"
|
||||||
export ZTS_REPORT=${ZTS_REPORT:-$ZTS_DIR/test-runner/bin/zts-report.py}
|
export ZTS_REPORT="${ZTS_REPORT:-$ZTS_DIR/test-runner/bin/zts-report.py}"
|
||||||
export STF_TOOLS=${STF_TOOLS:-$ZTS_DIR/test-runner}
|
export STF_TOOLS="${STF_TOOLS:-$ZTS_DIR/test-runner}"
|
||||||
export STF_SUITE=${STF_SUITE:-$ZTS_DIR/zfs-tests}
|
export STF_SUITE="${STF_SUITE:-$ZTS_DIR/zfs-tests}"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086,SC2295
|
||||||
|
|
||||||
# kmodtool - Helper script for building kernel module RPMs
|
# kmodtool - Helper script for building kernel module RPMs
|
||||||
# Copyright (c) 2003-2012 Ville Skyttä <ville.skytta@iki.fi>,
|
# Copyright (c) 2003-2012 Ville Skyttä <ville.skytta@iki.fi>,
|
||||||
@ -125,10 +125,10 @@ EOF
|
|||||||
|
|
||||||
print_rpmtemplate_per_kmodpkg ()
|
print_rpmtemplate_per_kmodpkg ()
|
||||||
{
|
{
|
||||||
if [ "${1}" = "--custom" ]; then
|
if [[ "${1}" = "--custom" ]]; then
|
||||||
shift
|
shift
|
||||||
local customkernel=true
|
local customkernel=true
|
||||||
elif [ "${1}" = "--redhat" ]; then
|
elif [[ "${1}" = "--redhat" ]]; then
|
||||||
# this is needed for akmods
|
# this is needed for akmods
|
||||||
shift
|
shift
|
||||||
local redhatkernel=true
|
local redhatkernel=true
|
||||||
@ -139,7 +139,7 @@ print_rpmtemplate_per_kmodpkg ()
|
|||||||
|
|
||||||
# Detect depmod install location
|
# Detect depmod install location
|
||||||
local depmod_path=/sbin/depmod
|
local depmod_path=/sbin/depmod
|
||||||
if [ ! -f "${depmod_path}" ]; then
|
if [[ ! -f "${depmod_path}" ]]; then
|
||||||
depmod_path=/usr/sbin/depmod
|
depmod_path=/usr/sbin/depmod
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -163,24 +163,24 @@ Requires(postun): kmod
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# second part
|
# second part
|
||||||
if [ -z "${customkernel}" ]; then
|
if [[ -z "${customkernel}" ]]; then
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Requires: kernel-uname-r = ${kernel_uname_r}
|
Requires: kernel-uname-r = ${kernel_uname_r}
|
||||||
BuildRequires: kernel-devel-uname-r = ${kernel_uname_r}
|
BuildRequires: kernel-devel-uname-r = ${kernel_uname_r}
|
||||||
%{?KmodsRequires:Requires: %{KmodsRequires}-uname-r = ${kernel_uname_r}}
|
%{?KmodsRequires:Requires: %{KmodsRequires}-uname-r = ${kernel_uname_r}}
|
||||||
%{?KmodsRequires:BuildRequires: %{KmodsRequires}-uname-r = ${kernel_uname_r}}
|
%{?KmodsRequires:BuildRequires: %{KmodsRequires}-uname-r = ${kernel_uname_r}}
|
||||||
%post -n kmod-${kmodname}-${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 || :
|
${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 || :
|
${prefix}${depmod_path} -aeF /lib/modules/${kernel_uname_r}/System.map ${kernel_uname_r} > /dev/null || :
|
||||||
else
|
else
|
||||||
${prefix}${depmod_path} -ae ${kernel_uname_r} &> /dev/null || :
|
${prefix}${depmod_path} -ae ${kernel_uname_r} &> /dev/null || :
|
||||||
fi
|
fi
|
||||||
%postun -n kmod-${kmodname}-${kernel_uname_r}
|
%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 || :
|
${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 || :
|
${prefix}${depmod_path} -aF /lib/modules/${kernel_uname_r}/System.map ${kernel_uname_r} &> /dev/null || :
|
||||||
else
|
else
|
||||||
${prefix}${depmod_path} -a ${kernel_uname_r} &> /dev/null || :
|
${prefix}${depmod_path} -a ${kernel_uname_r} &> /dev/null || :
|
||||||
@ -213,10 +213,10 @@ EOF
|
|||||||
|
|
||||||
print_rpmtemplate_kmoddevelpkg ()
|
print_rpmtemplate_kmoddevelpkg ()
|
||||||
{
|
{
|
||||||
if [ "${1}" = "--custom" ]; then
|
if [[ "${1}" = "--custom" ]]; then
|
||||||
shift
|
shift
|
||||||
local customkernel=true
|
local customkernel=true
|
||||||
elif [ "${1}" = "--redhat" ]; then
|
elif [[ "${1}" = "--redhat" ]]; then
|
||||||
shift
|
shift
|
||||||
local redhatkernel=true
|
local redhatkernel=true
|
||||||
fi
|
fi
|
||||||
@ -230,7 +230,7 @@ Group: System Environment/Kernel
|
|||||||
Provides: ${kmodname}-devel-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
Provides: ${kmodname}-devel-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if [ -z "${customkernel}" ] && [ -z "${redhatkernel}" ]; then
|
if [[ -z "${customkernel}" ]] && [[ -z "${redhatkernel}" ]]; then
|
||||||
echo "Requires: kmod-${kmodname}-devel-${kernel_uname_r} >= %{?epoch:%{epoch}:}%{version}-%{release}"
|
echo "Requires: kmod-${kmodname}-devel-${kernel_uname_r} >= %{?epoch:%{epoch}:}%{version}-%{release}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -256,10 +256,10 @@ EOF
|
|||||||
|
|
||||||
print_rpmtemplate_per_kmoddevelpkg ()
|
print_rpmtemplate_per_kmoddevelpkg ()
|
||||||
{
|
{
|
||||||
if [ "${1}" = "--custom" ]; then
|
if [[ "${1}" = "--custom" ]]; then
|
||||||
shift
|
shift
|
||||||
local customkernel=true
|
local customkernel=true
|
||||||
elif [ "${1}" = "--redhat" ]; then
|
elif [[ "${1}" = "--redhat" ]]; then
|
||||||
# this is needed for akmods
|
# this is needed for akmods
|
||||||
shift
|
shift
|
||||||
local redhatkernel=true
|
local redhatkernel=true
|
||||||
@ -279,7 +279,7 @@ Provides: kmod-${kmodname}-devel-uname-r = ${kernel_uname_r}
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# second part
|
# second part
|
||||||
if [ -z "${customkernel}" ]; then
|
if [[ -z "${customkernel}" ]]; then
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Requires: kernel-devel-uname-r = ${kernel_uname_r}
|
Requires: kernel-devel-uname-r = ${kernel_uname_r}
|
||||||
BuildRequires: kernel-devel-uname-r = ${kernel_uname_r}
|
BuildRequires: kernel-devel-uname-r = ${kernel_uname_r}
|
||||||
@ -333,7 +333,7 @@ print_customrpmtemplate ()
|
|||||||
{
|
{
|
||||||
for kernel in ${1}
|
for kernel in ${1}
|
||||||
do
|
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 :)
|
# 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} "
|
kernel_versions="${kernel_versions}${kernel}___${buildroot}%{_usrsrc}/kernels/${kernel} "
|
||||||
|
|
||||||
@ -342,14 +342,14 @@ print_customrpmtemplate ()
|
|||||||
print_rpmtemplate_per_kmodpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
|
print_rpmtemplate_per_kmodpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
|
||||||
|
|
||||||
# create development package
|
# create development package
|
||||||
if [ -n "${devel}" ]; then
|
if [[ -n "${devel}" ]]; then
|
||||||
# create devel package including common headers
|
# create devel package including common headers
|
||||||
print_rpmtemplate_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
|
print_rpmtemplate_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
|
||||||
|
|
||||||
# create devel package
|
# create devel package
|
||||||
print_rpmtemplate_per_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
|
print_rpmtemplate_per_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
|
||||||
fi
|
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
|
# likely a user-build-kernel with available buildfiles
|
||||||
# fixme: we should check if uname from Makefile is the same as ${kernel}
|
# fixme: we should check if uname from Makefile is the same as ${kernel}
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ print_customrpmtemplate ()
|
|||||||
print_rpmtemplate_per_kmodpkg --custom "${kernel}"
|
print_rpmtemplate_per_kmodpkg --custom "${kernel}"
|
||||||
|
|
||||||
# create development package
|
# create development package
|
||||||
if [ -n "${devel}" ]; then
|
if [[ -n "${devel}" ]]; then
|
||||||
# create devel package including common headers
|
# create devel package including common headers
|
||||||
print_rpmtemplate_kmoddevelpkg --custom "${kernel}"
|
print_rpmtemplate_kmoddevelpkg --custom "${kernel}"
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ print_rpmtemplate ()
|
|||||||
# create package
|
# create package
|
||||||
print_rpmtemplate_per_kmodpkg "${kernel}" "${kernel##${kernel_verrelarch}}"
|
print_rpmtemplate_per_kmodpkg "${kernel}" "${kernel##${kernel_verrelarch}}"
|
||||||
|
|
||||||
if [ -n "${devel}" ]; then
|
if [[ -n "${devel}" ]]; then
|
||||||
# create devel package including common headers
|
# create devel package including common headers
|
||||||
print_rpmtemplate_kmoddevelpkg "${kernel}" "${kernel##${kernel_verrelarch}}"
|
print_rpmtemplate_kmoddevelpkg "${kernel}" "${kernel##${kernel_verrelarch}}"
|
||||||
|
|
||||||
@ -423,13 +423,13 @@ myprog_help ()
|
|||||||
echo " --buildroot <dir> -- Build root (place to look for build files)"
|
echo " --buildroot <dir> -- Build root (place to look for build files)"
|
||||||
}
|
}
|
||||||
|
|
||||||
while [ -n "${1}" ] ; do
|
while [[ -n "${1}" ]] ; do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
--filterfile)
|
--filterfile)
|
||||||
shift
|
shift
|
||||||
if [ -z "${1}" ] ; then
|
if [[ -z "${1}" ]] ; then
|
||||||
error_out 2 "Please provide path to a filter-file together with --filterfile" >&2
|
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
|
error_out 2 "Filterfile ${1} not found" >&2
|
||||||
fi
|
fi
|
||||||
filterfile="${1}"
|
filterfile="${1}"
|
||||||
@ -437,7 +437,7 @@ while [ -n "${1}" ] ; do
|
|||||||
;;
|
;;
|
||||||
--kmodname)
|
--kmodname)
|
||||||
shift
|
shift
|
||||||
if [ -z "${1}" ] ; then
|
if [[ -z "${1}" ]] ; then
|
||||||
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
|
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
|
||||||
fi
|
fi
|
||||||
# strip pending -kmod
|
# strip pending -kmod
|
||||||
@ -450,7 +450,7 @@ while [ -n "${1}" ] ; do
|
|||||||
;;
|
;;
|
||||||
--prefix)
|
--prefix)
|
||||||
shift
|
shift
|
||||||
if [ -z "${1}" ] ; then
|
if [[ -z "${1}" ]] ; then
|
||||||
error_out 2 "Please provide a prefix with --prefix" >&2
|
error_out 2 "Please provide a prefix with --prefix" >&2
|
||||||
fi
|
fi
|
||||||
prefix="${1}"
|
prefix="${1}"
|
||||||
@ -458,7 +458,7 @@ while [ -n "${1}" ] ; do
|
|||||||
;;
|
;;
|
||||||
--repo)
|
--repo)
|
||||||
shift
|
shift
|
||||||
if [ -z "${1}" ] ; then
|
if [[ -z "${1}" ]] ; then
|
||||||
error_out 2 "Please provide the name of the repo together with --repo" >&2
|
error_out 2 "Please provide the name of the repo together with --repo" >&2
|
||||||
fi
|
fi
|
||||||
repo=${1}
|
repo=${1}
|
||||||
@ -466,7 +466,7 @@ while [ -n "${1}" ] ; do
|
|||||||
;;
|
;;
|
||||||
--for-kernels)
|
--for-kernels)
|
||||||
shift
|
shift
|
||||||
if [ -z "${1}" ] ; then
|
if [[ -z "${1}" ]] ; then
|
||||||
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
|
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
|
||||||
fi
|
fi
|
||||||
for_kernels="${1}"
|
for_kernels="${1}"
|
||||||
@ -514,28 +514,28 @@ while [ -n "${1}" ] ; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -e ./kmodtool-kernel-variants ]; then
|
if [[ -e ./kmodtool-kernel-variants ]]; then
|
||||||
kernels_known_variants="$(cat ./kmodtool-kernel-variants)"
|
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)"
|
kernels_known_variants="$(cat /usr/share/kmodtool/kernel-variants)"
|
||||||
else
|
else
|
||||||
kernels_known_variants="@(smp?(-debug)|PAE?(-debug)|debug|kdump|xen|kirkwood|highbank|imx|omap|tegra)"
|
kernels_known_variants="@(smp?(-debug)|PAE?(-debug)|debug|kdump|xen|kirkwood|highbank|imx|omap|tegra)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# general sanity checks
|
# general sanity checks
|
||||||
if [ -z "${target}" ]; then
|
if [[ -z "${target}" ]]; then
|
||||||
error_out 2 "please pass target arch with --target"
|
error_out 2 "please pass target arch with --target"
|
||||||
elif [ -z "${kmodname}" ]; then
|
elif [[ -z "${kmodname}" ]]; then
|
||||||
error_out 2 "please pass kmodname with --kmodname"
|
error_out 2 "please pass kmodname with --kmodname"
|
||||||
elif [ -z "${kernels_known_variants}" ] ; then
|
elif [[ -z "${kernels_known_variants}" ]] ; then
|
||||||
error_out 2 "could not determine known variants"
|
error_out 2 "could not determine known variants"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# go
|
# go
|
||||||
if [ -n "${for_kernels}" ]; then
|
if [[ -n "${for_kernels}" ]]; then
|
||||||
# this is easy:
|
# this is easy:
|
||||||
print_customrpmtemplate "${for_kernels}"
|
print_customrpmtemplate "${for_kernels}"
|
||||||
elif [ "${build_kernels}" = "akmod" ]; then
|
elif [[ "${build_kernels}" = "akmod" ]]; then
|
||||||
# do only a akmod package
|
# do only a akmod package
|
||||||
print_akmodtemplate
|
print_akmodtemplate
|
||||||
print_akmodmeta
|
print_akmodmeta
|
||||||
@ -543,7 +543,7 @@ else
|
|||||||
# seems we are on out own to decide for which kernels to build
|
# seems we are on out own to decide for which kernels to build
|
||||||
|
|
||||||
# we need more sanity checks in this case
|
# we need more sanity checks in this case
|
||||||
if [ -z "${repo}" ]; then
|
if [[ -z "${repo}" ]]; then
|
||||||
error_out 2 "please provide repo name with --repo"
|
error_out 2 "please provide repo name with --repo"
|
||||||
elif ! command -v "buildsys-build-${repo}-kerneldevpkgs" > /dev/null 2>&1; then
|
elif ! command -v "buildsys-build-${repo}-kerneldevpkgs" > /dev/null 2>&1; then
|
||||||
error_out 2 "buildsys-build-${repo}-kerneldevpkgs not found"
|
error_out 2 "buildsys-build-${repo}-kerneldevpkgs not found"
|
||||||
@ -553,14 +553,14 @@ else
|
|||||||
cmdoptions="--target ${target}"
|
cmdoptions="--target ${target}"
|
||||||
|
|
||||||
# filterfile to filter list of kernels?
|
# filterfile to filter list of kernels?
|
||||||
if [ -n "${filterfile}" ] ; then
|
if [[ -n "${filterfile}" ]] ; then
|
||||||
cmdoptions="${cmdoptions} --filterfile ${filterfile}"
|
cmdoptions="${cmdoptions} --filterfile ${filterfile}"
|
||||||
fi
|
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}) ||
|
||||||
error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: ${kernel_versions_to_build_for}"
|
error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: ${kernel_versions_to_build_for}"
|
||||||
|
|
||||||
if [ "${build_kernels}" = "current" ] && [ -z "${noakmod}" ]; then
|
if [[ "${build_kernels}" = "current" ]] && [[ -z "${noakmod}" ]]; then
|
||||||
print_akmodtemplate
|
print_akmodtemplate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
BASE_DIR=$(dirname "$0")
|
BASE_DIR=$(dirname "$0")
|
||||||
SCRIPT_COMMON=common.sh
|
SCRIPT_COMMON=common.sh
|
||||||
if [ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]; then
|
if [[ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]]; then
|
||||||
. "${BASE_DIR}/${SCRIPT_COMMON}"
|
. "${BASE_DIR}/${SCRIPT_COMMON}"
|
||||||
else
|
else
|
||||||
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
|
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
|
||||||
@ -188,7 +188,7 @@ populate "$SRC_DIR" 10 100
|
|||||||
SRC_DIR="$TEST_DIR/src"
|
SRC_DIR="$TEST_DIR/src"
|
||||||
SRC_DIR_ZFS="$SRC_DIR/zfs"
|
SRC_DIR_ZFS="$SRC_DIR/zfs"
|
||||||
|
|
||||||
if [ "$COLOR" = "no" ]; then
|
if [[ "$COLOR" = "no" ]]; then
|
||||||
COLOR_GREEN=""
|
COLOR_GREEN=""
|
||||||
COLOR_BROWN=""
|
COLOR_BROWN=""
|
||||||
COLOR_RED=""
|
COLOR_RED=""
|
||||||
@ -230,7 +230,7 @@ src_set_vars() {
|
|||||||
ZFS_DIR="$SRC_DIR_ZFS/$ZFS_TAG"
|
ZFS_DIR="$SRC_DIR_ZFS/$ZFS_TAG"
|
||||||
ZFS_URL="$REPO/zfs/tarball/$ZFS_TAG"
|
ZFS_URL="$REPO/zfs/tarball/$ZFS_TAG"
|
||||||
|
|
||||||
if [ "$TAG" = "installed" ]; then
|
if [[ "$TAG" = "installed" ]]; then
|
||||||
ZPOOL_CMD=$(command -v zpool)
|
ZPOOL_CMD=$(command -v zpool)
|
||||||
ZFS_CMD=$(command -v zfs)
|
ZFS_CMD=$(command -v zfs)
|
||||||
ZFS_SH="/usr/share/zfs/zfs.sh"
|
ZFS_SH="/usr/share/zfs/zfs.sh"
|
||||||
@ -273,7 +273,7 @@ pool_create() {
|
|||||||
pool_set_vars "$1"
|
pool_set_vars "$1"
|
||||||
src_set_vars "$1"
|
src_set_vars "$1"
|
||||||
|
|
||||||
if [ "$POOL_TAG" != "installed" ]; then
|
if [[ "$POOL_TAG" != "installed" ]]; then
|
||||||
cd "$POOL_DIR_SRC" || fail "Failed 'cd $POOL_DIR_SRC'"
|
cd "$POOL_DIR_SRC" || fail "Failed 'cd $POOL_DIR_SRC'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ pool_create() {
|
|||||||
|
|
||||||
# If the zfs-images directory doesn't exist fetch a copy from Github then
|
# If the zfs-images directory doesn't exist fetch a copy from Github then
|
||||||
# cache it in the $TEST_DIR and update $IMAGES_DIR.
|
# cache it in the $TEST_DIR and update $IMAGES_DIR.
|
||||||
if [ ! -d "$IMAGES_DIR" ]; then
|
if [[ ! -d "$IMAGES_DIR" ]]; then
|
||||||
IMAGES_DIR="$TEST_DIR/zfs-images"
|
IMAGES_DIR="$TEST_DIR/zfs-images"
|
||||||
mkdir -p "$IMAGES_DIR"
|
mkdir -p "$IMAGES_DIR"
|
||||||
curl -sL "$IMAGES_TAR" | \
|
curl -sL "$IMAGES_TAR" | \
|
||||||
@ -331,7 +331,7 @@ fi
|
|||||||
# list of available images for the reserved keyword 'all'.
|
# list of available images for the reserved keyword 'all'.
|
||||||
for TAG in $POOL_TAGS; do
|
for TAG in $POOL_TAGS; do
|
||||||
|
|
||||||
if [ "$TAG" = "all" ]; then
|
if [[ "$TAG" = "all" ]]; then
|
||||||
ALL_TAGS=$(echo "$IMAGES_DIR"/*.tar.bz2 | \
|
ALL_TAGS=$(echo "$IMAGES_DIR"/*.tar.bz2 | \
|
||||||
sed "s|$IMAGES_DIR/||g;s|.tar.bz2||g")
|
sed "s|$IMAGES_DIR/||g;s|.tar.bz2||g")
|
||||||
NEW_TAGS="$NEW_TAGS $ALL_TAGS"
|
NEW_TAGS="$NEW_TAGS $ALL_TAGS"
|
||||||
@ -341,7 +341,7 @@ for TAG in $POOL_TAGS; do
|
|||||||
done
|
done
|
||||||
POOL_TAGS="$NEW_TAGS"
|
POOL_TAGS="$NEW_TAGS"
|
||||||
|
|
||||||
if [ "$VERBOSE" = "yes" ]; then
|
if [[ "$VERBOSE" = "yes" ]]; then
|
||||||
echo "---------------------------- Options ----------------------------"
|
echo "---------------------------- Options ----------------------------"
|
||||||
echo "VERBOSE=$VERBOSE"
|
echo "VERBOSE=$VERBOSE"
|
||||||
echo "KEEP=$KEEP"
|
echo "KEEP=$KEEP"
|
||||||
@ -353,11 +353,11 @@ if [ "$VERBOSE" = "yes" ]; then
|
|||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$TEST_DIR" ]; then
|
if [[ ! -d "$TEST_DIR" ]]; then
|
||||||
mkdir -p "$TEST_DIR"
|
mkdir -p "$TEST_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$SRC_DIR" ]; then
|
if [[ ! -d "$SRC_DIR" ]]; then
|
||||||
mkdir -p "$SRC_DIR"
|
mkdir -p "$SRC_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -367,9 +367,9 @@ printf "%-16s" " "
|
|||||||
for TAG in $SRC_TAGS; do
|
for TAG in $SRC_TAGS; do
|
||||||
src_set_vars "$TAG"
|
src_set_vars "$TAG"
|
||||||
|
|
||||||
if [ "$TAG" = "installed" ]; then
|
if [[ "$TAG" = "installed" ]]; then
|
||||||
ZFS_VERSION=$(modinfo zfs | awk '/version:/ { print $2; exit }')
|
ZFS_VERSION=$(modinfo zfs | awk '/version:/ { print $2; exit }')
|
||||||
if [ -n "$ZFS_VERSION" ]; then
|
if [[ -n "$ZFS_VERSION" ]]; then
|
||||||
printf "%-16s" "$ZFS_VERSION"
|
printf "%-16s" "$ZFS_VERSION"
|
||||||
else
|
else
|
||||||
fail "ZFS is not installed"
|
fail "ZFS is not installed"
|
||||||
@ -388,21 +388,21 @@ printf "%-16s" "Clone ZFS"
|
|||||||
for TAG in $SRC_TAGS; do
|
for TAG in $SRC_TAGS; do
|
||||||
src_set_vars "$TAG"
|
src_set_vars "$TAG"
|
||||||
|
|
||||||
if [ -d "$ZFS_DIR" ]; then
|
if [[ -d "$ZFS_DIR" ]]; then
|
||||||
skip_nonewline
|
skip_nonewline
|
||||||
elif [ "$ZFS_TAG" = "installed" ]; then
|
elif [[ "$ZFS_TAG" = "installed" ]]; then
|
||||||
skip_nonewline
|
skip_nonewline
|
||||||
else
|
else
|
||||||
cd "$SRC_DIR" || fail "Failed 'cd $SRC_DIR'"
|
cd "$SRC_DIR" || fail "Failed 'cd $SRC_DIR'"
|
||||||
|
|
||||||
if [ ! -d "$SRC_DIR_ZFS" ]; then
|
if [[ ! -d "$SRC_DIR_ZFS" ]]; then
|
||||||
mkdir -p "$SRC_DIR_ZFS"
|
mkdir -p "$SRC_DIR_ZFS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git archive --format=tar --prefix="$ZFS_TAG/ $ZFS_TAG" \
|
git archive --format=tar --prefix="$ZFS_TAG/ $ZFS_TAG" \
|
||||||
-o "$SRC_DIR_ZFS/$ZFS_TAG.tar" &>/dev/null || \
|
-o "$SRC_DIR_ZFS/$ZFS_TAG.tar" &>/dev/null || \
|
||||||
rm "$SRC_DIR_ZFS/$ZFS_TAG.tar"
|
rm "$SRC_DIR_ZFS/$ZFS_TAG.tar"
|
||||||
if [ -s "$SRC_DIR_ZFS/$ZFS_TAG.tar" ]; then
|
if [[ -s "$SRC_DIR_ZFS/$ZFS_TAG.tar" ]]; then
|
||||||
tar -xf "$SRC_DIR_ZFS/$ZFS_TAG.tar" -C "$SRC_DIR_ZFS"
|
tar -xf "$SRC_DIR_ZFS/$ZFS_TAG.tar" -C "$SRC_DIR_ZFS"
|
||||||
rm "$SRC_DIR_ZFS/$ZFS_TAG.tar"
|
rm "$SRC_DIR_ZFS/$ZFS_TAG.tar"
|
||||||
echo -n -e "${COLOR_GREEN}Local${COLOR_RESET}\t\t"
|
echo -n -e "${COLOR_GREEN}Local${COLOR_RESET}\t\t"
|
||||||
@ -422,9 +422,9 @@ printf "%-16s" "Build ZFS"
|
|||||||
for TAG in $SRC_TAGS; do
|
for TAG in $SRC_TAGS; do
|
||||||
src_set_vars "$TAG"
|
src_set_vars "$TAG"
|
||||||
|
|
||||||
if [ -f "$ZFS_DIR/module/zfs/zfs.ko" ]; then
|
if [[ -f "$ZFS_DIR/module/zfs/zfs.ko" ]]; then
|
||||||
skip_nonewline
|
skip_nonewline
|
||||||
elif [ "$ZFS_TAG" = "installed" ]; then
|
elif [[ "$ZFS_TAG" = "installed" ]]; then
|
||||||
skip_nonewline
|
skip_nonewline
|
||||||
else
|
else
|
||||||
cd "$ZFS_DIR" || fail "Failed 'cd $ZFS_DIR'"
|
cd "$ZFS_DIR" || fail "Failed 'cd $ZFS_DIR'"
|
||||||
@ -454,15 +454,15 @@ for TAG in $POOL_TAGS; do
|
|||||||
mkdir -p "$POOL_DIR_PRISTINE"
|
mkdir -p "$POOL_DIR_PRISTINE"
|
||||||
|
|
||||||
# Use the existing compressed image if available.
|
# Use the existing compressed image if available.
|
||||||
if [ -f "$POOL_BZIP" ]; then
|
if [[ -f "$POOL_BZIP" ]]; then
|
||||||
tar -xjf "$POOL_BZIP" -C "$POOL_DIR_PRISTINE" \
|
tar -xjf "$POOL_BZIP" -C "$POOL_DIR_PRISTINE" \
|
||||||
--strip-components=1 || \
|
--strip-components=1 || \
|
||||||
fail "Failed 'tar -xjf $POOL_BZIP"
|
fail "Failed 'tar -xjf $POOL_BZIP"
|
||||||
# Use the installed version to create the pool.
|
# Use the installed version to create the pool.
|
||||||
elif [ "$TAG" = "installed" ]; then
|
elif [[ "$TAG" = "installed" ]]; then
|
||||||
pool_create "$TAG"
|
pool_create "$TAG"
|
||||||
# A source build is available to create the pool.
|
# A source build is available to create the pool.
|
||||||
elif [ -d "$POOL_DIR_SRC" ]; then
|
elif [[ -d "$POOL_DIR_SRC" ]]; then
|
||||||
pool_create "$TAG"
|
pool_create "$TAG"
|
||||||
else
|
else
|
||||||
SKIP=1
|
SKIP=1
|
||||||
@ -471,13 +471,13 @@ for TAG in $POOL_TAGS; do
|
|||||||
# Verify 'zpool import' works for all listed source versions.
|
# Verify 'zpool import' works for all listed source versions.
|
||||||
for SRC_TAG in $SRC_TAGS; do
|
for SRC_TAG in $SRC_TAGS; do
|
||||||
|
|
||||||
if [ "$SKIP" -eq 1 ]; then
|
if [[ "$SKIP" -eq 1 ]]; then
|
||||||
skip_nonewline
|
skip_nonewline
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
src_set_vars "$SRC_TAG"
|
src_set_vars "$SRC_TAG"
|
||||||
if [ "$SRC_TAG" != "installed" ]; then
|
if [[ "$SRC_TAG" != "installed" ]]; then
|
||||||
cd "$ZFS_DIR" || fail "Failed 'cd $ZFS_DIR'"
|
cd "$ZFS_DIR" || fail "Failed 'cd $ZFS_DIR'"
|
||||||
fi
|
fi
|
||||||
$ZFS_SH zfs="spa_config_path=$POOL_DIR_COPY"
|
$ZFS_SH zfs="spa_config_path=$POOL_DIR_COPY"
|
||||||
@ -505,7 +505,7 @@ for TAG in $POOL_TAGS; do
|
|||||||
printf "\n"
|
printf "\n"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$KEEP" = "no" ]; then
|
if [[ "$KEEP" = "no" ]]; then
|
||||||
rm -Rf "$TEST_DIR"
|
rm -Rf "$TEST_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
BASE_DIR=${0%/*}
|
BASE_DIR=${0%/*}
|
||||||
SCRIPT_COMMON=common.sh
|
SCRIPT_COMMON=common.sh
|
||||||
if [ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]; then
|
if [[ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]]; then
|
||||||
. "${BASE_DIR}/${SCRIPT_COMMON}"
|
. "${BASE_DIR}/${SCRIPT_COMMON}"
|
||||||
else
|
else
|
||||||
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
|
echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user