From 26e61dd074df64f9e1d779273efd56fa9d92cdc5 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 28 Jul 2010 16:30:45 -0700 Subject: [PATCH] Generate common.sh with paths from configure The common.sh script assumed that it was either being run from in-tree or was installed under /usr/libexec/zfs. If this was not the case, because of say the default --prefix=/usr/local, then the paths would be wrong. To fix this common.sh is now generated from common.sh.in with the correct path information provided at configure time. --- configure.ac | 1 + scripts/{common.sh => common.sh.in} | 31 ++++++++++++++++++----------- scripts/zconfig.sh | 2 -- scripts/zfs.sh | 2 -- scripts/zpool-create.sh | 2 -- 5 files changed, 20 insertions(+), 18 deletions(-) rename scripts/{common.sh => common.sh.in} (92%) mode change 100755 => 100644 diff --git a/configure.ac b/configure.ac index 7265a99db2..2e4a2c5cda 100644 --- a/configure.ac +++ b/configure.ac @@ -82,6 +82,7 @@ AC_CONFIG_FILES([ module/zcommon/Makefile module/zfs/Makefile scripts/Makefile + scripts/common.sh zfs.spec zfs-modules.spec ]) diff --git a/scripts/common.sh b/scripts/common.sh.in old mode 100755 new mode 100644 similarity index 92% rename from scripts/common.sh rename to scripts/common.sh.in index c1229b9864..75e5a51a58 --- a/scripts/common.sh +++ b/scripts/common.sh.in @@ -26,20 +26,27 @@ RAID10S=() RAIDZS=() RAIDZ2S=() +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libexecdir=@libexecdir@ +pkglibexecdir=${libexecdir}/@PACKAGE@ +bindir=@bindir@ +sbindir=@sbindir@ + ETCDIR=${ETCDIR:-/etc} DEVDIR=${DEVDIR:-/dev/disk/zpool} -ZPOOLDIR=${ZPOOLDIR:-/usr/libexec/zfs/zpool-config} +ZPOOLDIR=${ZPOOLDIR:-${pkglibexecdir}/zpool-config} -ZDB=${ZDB:-/usr/sbin/zdb} -ZFS=${ZFS:-/usr/sbin/zfs} -ZINJECT=${ZINJECT:-/usr/sbin/zinject} -ZPOOL=${ZPOOL:-/usr/sbin/zpool} -ZPOOL_ID=${ZPOOL_ID:-/usr/bin/zpool_id} -ZTEST=${ZTEST:-/usr/sbin/ztest} +ZDB=${ZDB:-${sbindir}/zdb} +ZFS=${ZFS:-${sbindir}/zfs} +ZINJECT=${ZINJECT:-${sbindir}/zinject} +ZPOOL=${ZPOOL:-${sbindir}/zpool} +ZPOOL_ID=${ZPOOL_ID:-${bindir}/zpool_id} +ZTEST=${ZTEST:-${sbindir}/ztest} -COMMON_SH=${COMMON_SH:-/usr/libexec/zfs/common.sh} -ZFS_SH=${ZFS_SH:-/usr/libexec/zfs/zfs.sh} -ZPOOL_CREATE_SH=${ZPOOL_CREATE_SH:-/usr/libexec/zfs/zpool-create.sh} +COMMON_SH=${COMMON_SH:-${pkglibexecdir}/common.sh} +ZFS_SH=${ZFS_SH:-${pkglibexecdir}/zfs.sh} +ZPOOL_CREATE_SH=${ZPOOL_CREATE_SH:-${pkglibexecdir}/zpool-create.sh} LDMOD=${LDMOD:-/sbin/modprobe} LSMOD=${LSMOD:-/sbin/lsmod} @@ -134,7 +141,7 @@ load_modules() { for OPT in "$@"; do OPT_NAME=`echo ${OPT} | cut -f1 -d'='` - + if [ ${NAME} = "${OPT_NAME}" ]; then VALUE=`echo ${OPT} | cut -f2- -d'='` fi @@ -311,7 +318,7 @@ udev_raid10_setup() { udev_raidz_setup() { local RANKS=$1 local CHANNELS=$2 - + RAIDZS=() for RANK in `seq 1 ${RANKS}`; do RAIDZ=("raidz") diff --git a/scripts/zconfig.sh b/scripts/zconfig.sh index 55e4c46453..b74c57087a 100755 --- a/scripts/zconfig.sh +++ b/scripts/zconfig.sh @@ -7,8 +7,6 @@ basedir="$(dirname $0)" SCRIPT_COMMON=common.sh if [ -f "${basedir}/${SCRIPT_COMMON}" ]; then . "${basedir}/${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 diff --git a/scripts/zfs.sh b/scripts/zfs.sh index a342aad4dc..523fbfcc0e 100755 --- a/scripts/zfs.sh +++ b/scripts/zfs.sh @@ -7,8 +7,6 @@ basedir="$(dirname $0)" SCRIPT_COMMON=common.sh if [ -f "${basedir}/${SCRIPT_COMMON}" ]; then . "${basedir}/${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 diff --git a/scripts/zpool-create.sh b/scripts/zpool-create.sh index 8e44f81c66..d6b301e325 100755 --- a/scripts/zpool-create.sh +++ b/scripts/zpool-create.sh @@ -5,8 +5,6 @@ basedir="$(dirname $0)" SCRIPT_COMMON=common.sh if [ -f "${basedir}/${SCRIPT_COMMON}" ]; then . "${basedir}/${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