aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-04-09 04:09:55 +0200
committerBrian Behlendorf <[email protected]>2022-05-10 10:18:38 -0700
commit5cdca5b1da7884c54260db473f892354bc79951b (patch)
tree6bdce13ac507fd450359dde2b3fa10405a480c54 /scripts
parent3ff81c460114e0b3f69a9993d4777ec2c590fb16 (diff)
autoconf: use include directives instead of recursing down cmd
No installation diff, dist lost -zfs-2.1.99/cmd/fsck_zfs/fsck.zfs which was distributed erroneously, since it's generated Also clean gitrev on clean Also add -e 'any possible bashisms' to default checkbashisms flags, and fully parallelise it and shellcheck, and it works out-of-tree, too Also align the Release in the dist META file correctly Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13316
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am20
-rwxr-xr-xscripts/zfs-helpers.sh47
-rwxr-xr-xscripts/zfs-tests.sh10
-rwxr-xr-xscripts/zimport.sh4
4 files changed, 35 insertions, 46 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 775759187..af7be462c 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -28,7 +28,7 @@ EXTRA_DIST = \
zol2zfs-patch.sed \
$(EXTRA_SCRIPTS)
-SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS)
+SHELLCHECKSCRIPTS += $(dist_pkgdata_SCRIPTS) $(EXTRA_SCRIPTS)
define EXTRA_ENVIRONMENT
@@ -37,13 +37,13 @@ export INTREE="yes"
export GDB="libtool --mode=execute gdb"
export LDMOD=/sbin/insmod
-export CMD_DIR=@abs_top_builddir@/cmd
+export CMD_DIR=@abs_top_builddir@
export UDEV_RULE_DIR=@abs_top_builddir@/udev/rules.d
-export ZEDLET_ETC_DIR=$$CMD_DIR/zed/zed.d
-export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/zed/zed.d
-export ZPOOL_SCRIPT_DIR=$$CMD_DIR/zpool/zpool.d
-export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/zpool/zpool.d
-export ZPOOL_COMPAT_DIR=$$CMD_DIR/zpool/compatibility.d
+export ZEDLET_ETC_DIR=$$CMD_DIR/cmd/zed/zed.d
+export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/cmd/zed/zed.d
+export ZPOOL_SCRIPT_DIR=$$CMD_DIR/cmd/zpool/zpool.d
+export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/cmd/zpool/zpool.d
+export ZPOOL_COMPAT_DIR=$$CMD_DIR/cmd/zpool/compatibility.d
export CONTRIB_DIR=@abs_top_builddir@/contrib
export LIB_DIR=@abs_top_builddir@/.libs
export SYSCONF_DIR=@abs_top_builddir@/etc
@@ -62,9 +62,9 @@ endef
export EXTRA_ENVIRONMENT
all-local:
- -$(SED) -e '\|^export BIN_DIR=|s|$$|@abs_top_builddir@/bin|' \
- -e '\|^export SBIN_DIR=|s|$$|@abs_top_builddir@/bin|' \
- -e '\|^export LIBEXEC_DIR=|s|$$|@abs_top_builddir@/bin|' \
+ -$(SED) -e '\|^export BIN_DIR=|s|$$|@abs_top_builddir@/tests/zfs-tests/bin|' \
+ -e '\|^export SBIN_DIR=|s|$$|@abs_top_builddir@|' \
+ -e '\|^export LIBEXEC_DIR=|s|$$|@abs_top_builddir@|' \
-e '\|^export ZTS_DIR=|s|$$|@abs_top_srcdir@/tests|' \
-e '\|^export SCRIPT_DIR=|s|$$|@abs_top_srcdir@/scripts|' \
$(abs_top_srcdir)/scripts/common.sh.in >common.sh
diff --git a/scripts/zfs-helpers.sh b/scripts/zfs-helpers.sh
index 93a047f22..5fa932dcc 100755
--- a/scripts/zfs-helpers.sh
+++ b/scripts/zfs-helpers.sh
@@ -18,7 +18,7 @@
# --sysconfdir=DIR install zfs configuration files [PREFIX/etc]
#
-BASE_DIR=$(dirname "$0")
+BASE_DIR=${0%/*}
SCRIPT_COMMON=common.sh
if [ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]; then
. "${BASE_DIR}/${SCRIPT_COMMON}"
@@ -46,7 +46,7 @@ msg() {
usage() {
cat << EOF
USAGE:
-$0 [dhirv]
+$0 [-dhirv]
DESCRIPTION:
Install/remove the ZFS helper utilities.
@@ -99,7 +99,7 @@ if [ "$INSTALL" = "no" ] && [ "$REMOVE" = "no" ]; then
fail "Either -i or -r must be specified"
fi
-if [ "$(id -u)" != "0" ]; then
+if [ "$(id -u)" != "0" ] && [ "$DRYRUN" = "no" ]; then
fail "Must run as root"
fi
@@ -126,13 +126,13 @@ install() {
echo "Symlink exists: $dst"
elif [ -e "$dst" ]; then
echo "File exists: $dst"
- elif [ ! -e "$src" ]; then
+ elif ! [ -e "$src" ]; then
echo "Source missing: $src"
else
msg "ln -s $src $dst"
if [ "$DRYRUN" = "no" ]; then
- DIR=$(dirname "$dst")
+ DIR=${dst%/*}
mkdir -p "$DIR" >/dev/null 2>&1
ln -s "$src" "$dst"
fi
@@ -145,7 +145,7 @@ remove() {
if [ -h "$dst" ]; then
msg "rm $dst"
rm "$dst"
- DIR=$(dirname "$dst")
+ DIR=${dst%/*}
rmdir "$DIR" >/dev/null 2>&1
elif [ -e "$dst" ]; then
echo "Expected symlink: $dst"
@@ -153,30 +153,23 @@ remove() {
}
if [ "${INSTALL}" = "yes" ]; then
- install "$CMD_DIR/mount_zfs/mount.zfs" \
- "$INSTALL_MOUNT_HELPER_DIR/mount.zfs"
- install "$CMD_DIR/fsck_zfs/fsck.zfs" \
- "$INSTALL_MOUNT_HELPER_DIR/fsck.zfs"
- install "$CMD_DIR/zvol_id/zvol_id" \
- "$INSTALL_UDEV_DIR/zvol_id"
- install "$CMD_DIR/vdev_id/vdev_id" \
- "$INSTALL_UDEV_DIR/vdev_id"
- install "$UDEV_RULE_DIR/60-zvol.rules" \
- "$INSTALL_UDEV_RULE_DIR/60-zvol.rules"
- install "$UDEV_RULE_DIR/69-vdev.rules" \
- "$INSTALL_UDEV_RULE_DIR/69-vdev.rules"
- install "$UDEV_RULE_DIR/90-zfs.rules" \
- "$INSTALL_UDEV_RULE_DIR/90-zfs.rules"
- install "$CMD_DIR/zpool/zpool.d" \
- "$INSTALL_SYSCONF_DIR/zfs/zpool.d"
- install "$CONTRIB_DIR/pyzfs/libzfs_core" \
- "$INSTALL_PYTHON_DIR/libzfs_core"
+ for cmd in "mount.zfs" "fsck.zfs"; do
+ install "$CMD_DIR/$cmd" "$INSTALL_MOUNT_HELPER_DIR/$cmd"
+ done
+ for udev in "$CMD_DIR/zvol_id" "$UDEV_SCRIPT_DIR/vdev_id"; do
+ install "$udev" "$INSTALL_UDEV_DIR/${udev##*/}"
+ done
+ for rule in "60-zvol.rules" "69-vdev.rules" "90-zfs.rules"; do
+ install "$UDEV_RULE_DIR/$rule" "$INSTALL_UDEV_RULE_DIR/$rule"
+ done
+ install "$ZPOOL_SCRIPT_DIR" "$INSTALL_SYSCONF_DIR/zfs/zpool.d"
+ install "$CONTRIB_DIR/pyzfs/libzfs_core" "$INSTALL_PYTHON_DIR/libzfs_core"
# Ideally we would install these in the configured ${libdir}, which is
# by default "/usr/local/lib and unfortunately not included in the
# dynamic linker search path.
- install "$(find "$LIB_DIR" -type f -name 'libzfs_core.so*')" "/lib/libzfs_core.so"
- install "$(find "$LIB_DIR" -type f -name 'libnvpair.so*')" "/lib/libnvpair.so"
- ldconfig
+ install "$LIB_DIR"/libzfs_core.so.?.?.? "/lib/libzfs_core.so"
+ install "$LIB_DIR"/libnvpair.so.?.?.? "/lib/libnvpair.so"
+ [ "$DRYRUN" = "no" ] && ldconfig
else
remove "$INSTALL_MOUNT_HELPER_DIR/mount.zfs"
remove "$INSTALL_MOUNT_HELPER_DIR/fsck.zfs"
diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh
index df69325a1..cad65d048 100755
--- a/scripts/zfs-tests.sh
+++ b/scripts/zfs-tests.sh
@@ -248,7 +248,7 @@ constrain_path() {
SYSTEM_DIRS="$SYSTEM_DIRS /usr/bin /usr/sbin /bin /sbin $LIBEXEC_DIR"
if [ "$INTREE" = "yes" ]; then
- # Constrained path set to ./zfs/bin/
+ # Constrained path set to $(top_builddir)/tests/zfs-tests/bin
STF_PATH="$BIN_DIR"
STF_PATH_REMOVE="no"
STF_MISSING_BIN=""
@@ -258,14 +258,10 @@ constrain_path() {
fi
# Special case links for standard zfs utilities
- DIRS="$(find "$CMD_DIR" -type d \( ! -name .deps -a \
- ! -name .libs \) -print | tr '\n' ' ')"
- create_links "$DIRS" "$ZFS_FILES"
+ create_links "$CMD_DIR" "$ZFS_FILES"
# Special case links for zfs test suite utilities
- DIRS="$(find "$STF_SUITE" -type d \( ! -name .deps -a \
- ! -name .libs \) -print | tr '\n' ' ')"
- create_links "$DIRS" "$ZFSTEST_FILES"
+ create_links "$CMD_DIR/tests/zfs-tests/cmd" "$ZFSTEST_FILES"
else
# Constrained path set to /var/tmp/constrained_path.*
SYSTEMDIR=${SYSTEMDIR:-/var/tmp/constrained_path.XXXXXX}
diff --git a/scripts/zimport.sh b/scripts/zimport.sh
index 14d2813ce..595de494e 100755
--- a/scripts/zimport.sh
+++ b/scripts/zimport.sh
@@ -235,8 +235,8 @@ src_set_vars() {
ZFS_CMD=$(command -v zfs)
ZFS_SH="/usr/share/zfs/zfs.sh"
else
- ZPOOL_CMD="./cmd/zpool/zpool"
- ZFS_CMD="./cmd/zfs/zfs"
+ ZPOOL_CMD="./zpool"
+ ZFS_CMD="./zfs"
ZFS_SH="./scripts/zfs.sh"
fi
}