]> granicus.if.org Git - zfs/commitdiff
Generate common.sh with paths from configure
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 28 Jul 2010 23:30:45 +0000 (16:30 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 28 Jul 2010 23:30:45 +0000 (16:30 -0700)
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
scripts/common.sh.in [moved from scripts/common.sh with 92% similarity, mode: 0644]
scripts/zconfig.sh
scripts/zfs.sh
scripts/zpool-create.sh

index 7265a99db2ec6e7f6617230ee797d7dcfd832c4f..2e4a2c5cda2d5313d39cb37f351d89d92b2b50cb 100644 (file)
@@ -82,6 +82,7 @@ AC_CONFIG_FILES([
        module/zcommon/Makefile
        module/zfs/Makefile
        scripts/Makefile
+       scripts/common.sh
        zfs.spec
        zfs-modules.spec
 ])
old mode 100755 (executable)
new mode 100644 (file)
similarity index 92%
rename from scripts/common.sh
rename to scripts/common.sh.in
index c1229b9..75e5a51
@@ -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")
index 55e4c464538df4d714428bfe97339b7c0b2e0294..b74c57087ae4c52cedf8aa4006c728c604d68473 100755 (executable)
@@ -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
index a342aad4dc782bf71425c2acd6db8a3fb5d7cabc..523fbfcc0e02a5ea22a1000fefc223e6cd470929 100755 (executable)
@@ -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
index 8e44f81c660b358f1a8ff1225004061a49d22c4d..d6b301e3257b3ad8025a5fdf6e3daa55182aff37 100755 (executable)
@@ -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