diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 27aad8f452..f8ae21eeee 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -36,21 +36,58 @@ AC_DEFUN([ZFS_AC_DEBUG], [ ]) AC_DEFUN([ZFS_AC_CONFIG_SCRIPT], [ - SCRIPT_CONFIG=.script-config - rm -f ${SCRIPT_CONFIG} - echo "KERNELSRC=${LINUX}" >>${SCRIPT_CONFIG} - echo "KERNELBUILD=${LINUX_OBJ}" >>${SCRIPT_CONFIG} - echo "KERNELSRCVER=${LINUX_VERSION}" >>${SCRIPT_CONFIG} - echo >>${SCRIPT_CONFIG} - echo "SPLSRC=${SPL}" >>${SCRIPT_CONFIG} - echo "SPLBUILD=${SPL_OBJ}" >>${SCRIPT_CONFIG} - echo "SPLSRCVER=${SPL_VERSION}" >>${SCRIPT_CONFIG} - echo >>${SCRIPT_CONFIG} - echo "TOPDIR=${TOPDIR}" >>${SCRIPT_CONFIG} - echo "BUILDDIR=${BUILDDIR}" >>${SCRIPT_CONFIG} - echo "LIBDIR=${LIBDIR}" >>${SCRIPT_CONFIG} - echo "CMDDIR=${CMDDIR}" >>${SCRIPT_CONFIG} - echo "MODDIR=${MODDIR}" >>${SCRIPT_CONFIG} + cat >.script-config <&2 @@ -32,7 +49,7 @@ msg() { } spl_dump_log() { - sysctl -w kernel.spl.debug.dump=1 &>/dev/null + ${SYSCTL} -w kernel.spl.debug.dump=1 &>/dev/null local NAME=`dmesg | tail -n 1 | cut -f5 -d' '` ${SPLBUILD}/cmd/spl ${NAME} >${NAME}.log echo @@ -49,11 +66,11 @@ check_modules() { for MOD in ${MODULES[*]}; do local NAME=`basename $MOD .ko` - if /sbin/lsmod | egrep -q "^${NAME}"; then + if ${LSMOD} | egrep -q "^${NAME}"; then LOADED_MODULES=(${NAME} ${LOADED_MODULES[*]}) fi - if [ ! -f ${MOD} ]; then + if [ ${INFOMOD} ${MOD} 2>/dev/null ]; then MISSING_MODULES=("\t${MOD}\n" ${MISSING_MODULES[*]}) fi done @@ -78,10 +95,10 @@ load_module() { local NAME=`basename $1 .ko` if [ ${VERBOSE} ]; then - echo "Loading $NAME ($@)" + echo "Loading ${NAME} ($@)" fi - /sbin/insmod $* || ERROR="Failed to load $1" return 1 + ${LDMOD} $* || ERROR="Failed to load $1" return 1 return 0 } @@ -114,10 +131,10 @@ unload_module() { local NAME=`basename $1 .ko` if [ ${VERBOSE} ]; then - echo "Unloading $NAME ($@)" + echo "Unloading ${NAME} ($@)" fi - /sbin/rmmod $NAME || ERROR="Failed to unload $NAME" return 1 + ${RMMOD} ${NAME} || ERROR="Failed to unload ${NAME}" return 1 return 0 } @@ -129,7 +146,7 @@ unload_modules() { for MOD in ${MODULES_REVERSE[*]}; do local NAME=`basename ${MOD} .ko` - if /sbin/lsmod | egrep -q "^${NAME}"; then + if ${LSMOD} | egrep -q "^${NAME}"; then if [ "${DUMP_LOG}" -a ${NAME} = "spl" ]; then spl_dump_log diff --git a/scripts/zfs.sh b/scripts/zfs.sh index df1c782a52..2906a54cf9 100755 --- a/scripts/zfs.sh +++ b/scripts/zfs.sh @@ -1,35 +1,18 @@ #!/bin/bash # -# A simple script to simply the loading/unloading the ZFS module -# stack. It should probably be considered a first step towards -# a full ZFS init script when that is needed. -# +# A simple script to simply the loading/unloading the ZFS module stack. + +SCRIPT_COMMON=common.sh +if [ -f ./${SCRIPT_COMMON} ]; then +. ./${SCRIPT_COMMON} +elif [ -f /usr/libexec/zfs/${SCRIPT_COMMON} ]; then +. /usr/libexec/zfs/${SCRIPT_COMMON} +else +echo "Missing helper script ${SCRIPT_COMMON}" && exit 1 +fi -. ./common.sh PROG=zfs.sh - -KMOD=/lib/modules/${KERNELSRCVER}/kernel -KERNEL_MODULES=( \ - $KMOD/lib/zlib_deflate/zlib_deflate.ko \ -) - -SPL_MODULES=( \ - ${SPLBUILD}/spl/spl.ko \ -) - -ZFS_MODULES=( \ - ${MODDIR}/avl/zavl.ko \ - ${MODDIR}/nvpair/znvpair.ko \ - ${MODDIR}/unicode/zunicode.ko \ - ${MODDIR}/zcommon/zcommon.ko \ - ${MODDIR}/zfs/zfs.ko \ -) - -MODULES=( \ - ${KERNEL_MODULES[*]} \ - ${SPL_MODULES[*]} \ - ${ZFS_MODULES[*]} \ -) +UNLOAD= usage() { cat << EOF @@ -55,8 +38,6 @@ $0 spl="spl_debug_mask=0" EOF } -UNLOAD= - while getopts 'hvud' OPTION; do case $OPTION in h) diff --git a/scripts/zpool-config/Makefile.am b/scripts/zpool-config/Makefile.am deleted file mode 100644 index 07cf7ead3a..0000000000 --- a/scripts/zpool-config/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST = *.sh diff --git a/scripts/zpool-config/file-raid0.sh b/scripts/zpool-config/file-raid0.sh index 02683fabcb..67f85d7515 100644 --- a/scripts/zpool-config/file-raid0.sh +++ b/scripts/zpool-config/file-raid0.sh @@ -16,13 +16,13 @@ zpool_create() { die "Error $? creating ${FILE}" done - msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES} - ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_NAME} ${FILES} + ${ZPOOL} create ${ZPOOL_NAME} ${FILES} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} for FILE in ${FILES}; do msg "Removing ${FILE}" diff --git a/scripts/zpool-config/file-raid10.sh b/scripts/zpool-config/file-raid10.sh index d3d2d82eb5..ad635f597e 100644 --- a/scripts/zpool-config/file-raid10.sh +++ b/scripts/zpool-config/file-raid10.sh @@ -17,15 +17,15 @@ zpool_create() { die "Error $? creating ${FILE}" done - msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ + msg ${ZPOOL} create ${ZPOOL_NAME} \ mirror ${FILES_M1} mirror ${FILES_M2} - ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ + ${ZPOOL} create ${ZPOOL_NAME} \ mirror ${FILES_M1} mirror ${FILES_M2} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} for FILE in ${FILES}; do msg "Removing ${FILE}" diff --git a/scripts/zpool-config/file-raidz.sh b/scripts/zpool-config/file-raidz.sh index e7e4a46358..8689f323a9 100644 --- a/scripts/zpool-config/file-raidz.sh +++ b/scripts/zpool-config/file-raidz.sh @@ -16,13 +16,13 @@ zpool_create() { die "Error $? creating ${FILE}" done - msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${FILES} - ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${FILES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_NAME} raidz ${FILES} + ${ZPOOL} create ${ZPOOL_NAME} raidz ${FILES} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} for FILE in ${FILES}; do msg "Removing ${FILE}" diff --git a/scripts/zpool-config/file-raidz2.sh b/scripts/zpool-config/file-raidz2.sh index 1dd97d3eea..8a78e9e7e4 100644 --- a/scripts/zpool-config/file-raidz2.sh +++ b/scripts/zpool-config/file-raidz2.sh @@ -16,13 +16,13 @@ zpool_create() { die "Error $? creating ${FILE}" done - msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${FILES} - ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${FILES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${FILES} + ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${FILES} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} for FILE in ${FILES}; do msg "Removing ${FILE}" diff --git a/scripts/zpool-config/hda-raid0.sh b/scripts/zpool-config/hda-raid0.sh index c2bda9cd76..70b631e566 100644 --- a/scripts/zpool-config/hda-raid0.sh +++ b/scripts/zpool-config/hda-raid0.sh @@ -6,11 +6,11 @@ DEVICES="/dev/hda" zpool_create() { - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} || exit 1 + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 } diff --git a/scripts/zpool-config/lo-raid0.sh b/scripts/zpool-config/lo-raid0.sh index b514499bc7..3270469bb6 100644 --- a/scripts/zpool-config/lo-raid0.sh +++ b/scripts/zpool-config/lo-raid0.sh @@ -21,13 +21,13 @@ zpool_create() { DEVICES="${DEVICES} ${DEVICE}" done - msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} - ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${ZPOOL_NAME} ${DEVICES} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} for FILE in ${FILES}; do DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` diff --git a/scripts/zpool-config/lo-raid10.sh b/scripts/zpool-config/lo-raid10.sh index 2376669495..9215eb8e07 100644 --- a/scripts/zpool-config/lo-raid10.sh +++ b/scripts/zpool-config/lo-raid10.sh @@ -34,15 +34,15 @@ zpool_create() { DEVICES_M2="${DEVICES_M2} ${DEVICE}" done - msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ + msg ${ZPOOL} create ${ZPOOL_NAME} \ mirror ${DEVICES_M1} mirror ${DEVICES_M2} - ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ + ${ZPOOL} create ${ZPOOL_NAME} \ mirror ${DEVICES_M1} mirror ${DEVICES_M2} } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} for FILE in ${FILES}; do DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` diff --git a/scripts/zpool-config/lo-raidz.sh b/scripts/zpool-config/lo-raidz.sh index 9ec90e2bcc..5f968d4b5f 100644 --- a/scripts/zpool-config/lo-raidz.sh +++ b/scripts/zpool-config/lo-raidz.sh @@ -21,13 +21,13 @@ zpool_create() { DEVICES="${DEVICES} ${DEVICE}" done - msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${DEVICES} - ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz ${DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_NAME} raidz ${DEVICES} + ${ZPOOL} create ${ZPOOL_NAME} raidz ${DEVICES} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} for FILE in ${FILES}; do DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` diff --git a/scripts/zpool-config/lo-raidz2.sh b/scripts/zpool-config/lo-raidz2.sh index 2883d7f9f5..f6a5127b56 100644 --- a/scripts/zpool-config/lo-raidz2.sh +++ b/scripts/zpool-config/lo-raidz2.sh @@ -21,13 +21,13 @@ zpool_create() { DEVICES="${DEVICES} ${DEVICE}" done - msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${DEVICES} - ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1 + msg ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${DEVICES} + ${ZPOOL} create ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} for FILE in ${FILES}; do DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` diff --git a/scripts/zpool-config/sda-raid0.sh b/scripts/zpool-config/sda-raid0.sh index c54ecd280e..8ca58b129a 100644 --- a/scripts/zpool-config/sda-raid0.sh +++ b/scripts/zpool-config/sda-raid0.sh @@ -6,11 +6,11 @@ DEVICES="/dev/sda" zpool_create() { - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create -f ${ZPOOL_NAME} ${DEVICES} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} || exit 1 + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 } diff --git a/scripts/zpool-config/x4550-raid0.sh b/scripts/zpool-config/x4550-raid0.sh index 458d7211fa..7bb87bc07c 100644 --- a/scripts/zpool-config/x4550-raid0.sh +++ b/scripts/zpool-config/x4550-raid0.sh @@ -16,11 +16,11 @@ zpool_create() { let S_IDX=S_IDX+1 done - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${STRIPES[*]} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${STRIPES[*]} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${STRIPES[*]} + ${ZPOOL} create -f ${ZPOOL_NAME} ${STRIPES[*]} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} } diff --git a/scripts/zpool-config/x4550-raid10-2x24.sh b/scripts/zpool-config/x4550-raid10-2x24.sh index cc20cb7e5b..678880424f 100644 --- a/scripts/zpool-config/x4550-raid10-2x24.sh +++ b/scripts/zpool-config/x4550-raid10-2x24.sh @@ -43,11 +43,11 @@ zpool_create() { let M_IDX=M_IDX+1 done - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} + ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} } diff --git a/scripts/zpool-config/x4550-raid10-3x16.sh b/scripts/zpool-config/x4550-raid10-3x16.sh index b458c2b5b7..799aef2c4e 100644 --- a/scripts/zpool-config/x4550-raid10-3x16.sh +++ b/scripts/zpool-config/x4550-raid10-3x16.sh @@ -36,11 +36,11 @@ zpool_create() { let M_IDX=M_IDX+1 done - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} + ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} } diff --git a/scripts/zpool-config/x4550-raid10-6x8.sh b/scripts/zpool-config/x4550-raid10-6x8.sh index fefbf3af84..d8050727f6 100644 --- a/scripts/zpool-config/x4550-raid10-6x8.sh +++ b/scripts/zpool-config/x4550-raid10-6x8.sh @@ -29,11 +29,11 @@ zpool_create() { let M_IDX=M_IDX+1 done - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} + ${ZPOOL} create -f ${ZPOOL_NAME} ${MIRRORS[*]} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} } diff --git a/scripts/zpool-config/x4550-raidz-12x4.sh b/scripts/zpool-config/x4550-raidz-12x4.sh index 19a4b134b8..fd6ea8f0de 100644 --- a/scripts/zpool-config/x4550-raidz-12x4.sh +++ b/scripts/zpool-config/x4550-raidz-12x4.sh @@ -33,11 +33,11 @@ zpool_create() { let Z_IDX=Z_IDX+1 done - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]} + ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} } diff --git a/scripts/zpool-config/x4550-raidz-6x8.sh b/scripts/zpool-config/x4550-raidz-6x8.sh index eaf3a9b1b8..67f67df732 100644 --- a/scripts/zpool-config/x4550-raidz-6x8.sh +++ b/scripts/zpool-config/x4550-raidz-6x8.sh @@ -33,11 +33,11 @@ zpool_create() { let Z_IDX=Z_IDX+1 done - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]} + ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} } diff --git a/scripts/zpool-config/x4550-raidz2-12x4.sh b/scripts/zpool-config/x4550-raidz2-12x4.sh index 2059d3c2c9..2af7cccf2d 100644 --- a/scripts/zpool-config/x4550-raidz2-12x4.sh +++ b/scripts/zpool-config/x4550-raidz2-12x4.sh @@ -33,11 +33,11 @@ zpool_create() { let Z_IDX=Z_IDX+1 done - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} + ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} } diff --git a/scripts/zpool-config/x4550-raidz2-6x8.sh b/scripts/zpool-config/x4550-raidz2-6x8.sh index 3bdd582f0f..f45a496e9f 100644 --- a/scripts/zpool-config/x4550-raidz2-6x8.sh +++ b/scripts/zpool-config/x4550-raidz2-6x8.sh @@ -33,11 +33,11 @@ zpool_create() { let Z_IDX=Z_IDX+1 done - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1 + msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} + ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1 } zpool_destroy() { - msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} } diff --git a/scripts/zpool-create.sh b/scripts/zpool-create.sh index 5561ab80f9..16f829cf6a 100755 --- a/scripts/zpool-create.sh +++ b/scripts/zpool-create.sh @@ -1,6 +1,14 @@ #!/bin/bash -. ./common.sh +SCRIPT_COMMON=common.sh +if [ -f ./${SCRIPT_COMMON} ]; then +. ./${SCRIPT_COMMON} +elif [ -f /usr/libexec/zfs/${SCRIPT_COMMON} ]; then +. /usr/libexec/zfs/${SCRIPT_COMMON} +else +echo "Missing helper script ${SCRIPT_COMMON}" && exit 1 +fi + PROG=zpool-create.sh usage() { @@ -29,7 +37,7 @@ check_config() { local NAME=`basename ${ZPOOL_CONFIG} .sh` ERROR="Unknown config '${NAME}', available configs are:\n" - for CFG in `ls ${TOPDIR}/scripts/zpool-config/`; do + for CFG in `ls ${ZPOOLDIR}/ | grep ".sh"`; do local NAME=`basename ${CFG} .sh` ERROR="${ERROR}${NAME}\n" done @@ -40,7 +48,7 @@ check_config() { return 0 } -ZPOOL_CONFIG=zpool_config.sh +ZPOOL_CONFIG=unknown ZPOOL_NAME=tank ZPOOL_DESTROY= ZPOOL_OPTIONS="" @@ -56,7 +64,7 @@ while getopts 'hvc:p:dl:s:' OPTION; do VERBOSE=1 ;; c) - ZPOOL_CONFIG=${TOPDIR}/scripts/zpool-config/${OPTARG}.sh + ZPOOL_CONFIG=${ZPOOLDIR}/${OPTARG}.sh ;; p) ZPOOL_NAME=${OPTARG} @@ -92,27 +100,27 @@ else if [ "${ZPOOL_OPTIONS}" ]; then if [ ${VERBOSE} ]; then echo - echo "${CMDDIR}/zpool/zpool ${ZPOOL_OPTIONS} ${ZPOOL_NAME}" + echo "${ZPOOL} ${ZPOOL_OPTIONS} ${ZPOOL_NAME}" fi - ${CMDDIR}/zpool/zpool ${ZPOOL_OPTIONS} ${ZPOOL_NAME} || exit 1 + ${ZPOOL} ${ZPOOL_OPTIONS} ${ZPOOL_NAME} || exit 1 fi if [ "${ZFS_OPTIONS}" ]; then if [ ${VERBOSE} ]; then echo - echo "${CMDDIR}/zfs/zfs ${ZFS_OPTIONS} ${ZPOOL_NAME}" + echo "${ZFS} ${ZFS_OPTIONS} ${ZPOOL_NAME}" fi - ${CMDDIR}/zfs/zfs ${ZFS_OPTIONS} ${ZPOOL_NAME} || exit 1 + ${ZFS} ${ZFS_OPTIONS} ${ZPOOL_NAME} || exit 1 fi if [ ${VERBOSE} ]; then echo echo "zpool list" - ${CMDDIR}/zpool/zpool list || exit 1 + ${ZPOOL} list || exit 1 echo echo "zpool status ${ZPOOL_NAME}" - ${CMDDIR}/zpool/zpool status ${ZPOOL_NAME} || exit 1 + ${ZPOOL} status ${ZPOOL_NAME} || exit 1 fi fi diff --git a/zfs.spec.in b/zfs.spec.in index 047e2ef184..9419b34a32 100644 --- a/zfs.spec.in +++ b/zfs.spec.in @@ -29,6 +29,16 @@ BuildRequires: zlib-devel The %{name}-devel package contains the header files needed for building additional applications against the %{name} libraries. +%package test +Summary: ZFS File System Test Infrastructure +Group: Utilities/System + +%description test +The %{name}-test package contains a test infrastructure for zpios which +can be used to simplfy the benchmarking of various hardware and software +configurations. The test infrastructure additionally integrates with +various system profiling tools to facilitate an in depth analysis. + %prep %setup %build @@ -53,5 +63,9 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %{_includedir}/* +%files test +%defattr(-,root,root) +%{_libexecdir}/@PACKAGE@/* + %post %postun