aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Fuller <[email protected]>2011-07-25 01:00:53 +0100
committerBrian Behlendorf <[email protected]>2011-08-01 09:54:44 -0700
commit5faa9c0367e8d6b1ee1c45f1ebeffd3e53ef35e8 (patch)
tree53358897ebeed920a56fc39c9ab14b87b9b5c98c
parent7f4afd300b753ee7e0ce1f8d12c098119193001b (diff)
Turn the init.d scripts into autoconf config files
This change ensures the paths used by the provided init scripts always reference the prefixes provided at configure time. The @sbindir@ and @sysconfdir@ prefixes will be correctly replaced at build time. Signed-off-by: Brian Behlendorf <[email protected]> Closes #336
-rwxr-xr-xconfigure8
-rw-r--r--configure.ac6
-rw-r--r--etc/init.d/Makefile.in20
-rw-r--r--etc/init.d/zfs.arch.in (renamed from etc/init.d/zfs.arch)14
-rw-r--r--etc/init.d/zfs.fedora.in (renamed from etc/init.d/zfs.fedora)19
-rw-r--r--etc/init.d/zfs.gentoo.in (renamed from etc/init.d/zfs.gentoo)10
-rw-r--r--etc/init.d/zfs.lsb.in (renamed from etc/init.d/zfs.lsb)12
-rw-r--r--etc/init.d/zfs.lunar.in (renamed from etc/init.d/zfs.lunar)14
-rw-r--r--etc/init.d/zfs.redhat.in (renamed from etc/init.d/zfs.redhat)5
9 files changed, 73 insertions, 35 deletions
diff --git a/configure b/configure
index cb17d5cbc..f46cc5110 100755
--- a/configure
+++ b/configure
@@ -20562,7 +20562,7 @@ fi
$as_echo "$enable_debug" >&6; }
-ac_config_files="$ac_config_files Makefile dracut/Makefile dracut/90zfs/Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/init.d/Makefile etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile lib/libshare/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile cmd/sas_switch_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh"
+ac_config_files="$ac_config_files Makefile dracut/Makefile dracut/90zfs/Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/init.d/Makefile etc/init.d/zfs.arch etc/init.d/zfs.gentoo etc/init.d/zfs.lunar etc/init.d/zfs.fedora etc/init.d/zfs.lsb etc/init.d/zfs.redhat etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile lib/libshare/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile cmd/sas_switch_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh"
cat >confcache <<\_ACEOF
@@ -21485,6 +21485,12 @@ do
"etc/udev/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/Makefile" ;;
"etc/udev/rules.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/rules.d/Makefile" ;;
"etc/init.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/init.d/Makefile" ;;
+ "etc/init.d/zfs.arch") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.arch" ;;
+ "etc/init.d/zfs.gentoo") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.gentoo" ;;
+ "etc/init.d/zfs.lunar") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.lunar" ;;
+ "etc/init.d/zfs.fedora") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.fedora" ;;
+ "etc/init.d/zfs.lsb") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.lsb" ;;
+ "etc/init.d/zfs.redhat") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.redhat" ;;
"etc/zfs/Makefile") CONFIG_FILES="$CONFIG_FILES etc/zfs/Makefile" ;;
"man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
"man/man8/Makefile") CONFIG_FILES="$CONFIG_FILES man/man8/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index fda9faf43..8afd0fcad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,12 @@ AC_CONFIG_FILES([
etc/udev/Makefile
etc/udev/rules.d/Makefile
etc/init.d/Makefile
+ etc/init.d/zfs.arch
+ etc/init.d/zfs.gentoo
+ etc/init.d/zfs.lunar
+ etc/init.d/zfs.fedora
+ etc/init.d/zfs.lsb
+ etc/init.d/zfs.redhat
etc/zfs/Makefile
man/Makefile
man/man8/Makefile
diff --git a/etc/init.d/Makefile.in b/etc/init.d/Makefile.in
index 9763877d8..1ea6c623c 100644
--- a/etc/init.d/Makefile.in
+++ b/etc/init.d/Makefile.in
@@ -35,7 +35,10 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = etc/init.d
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/zfs.arch.in $(srcdir)/zfs.fedora.in \
+ $(srcdir)/zfs.gentoo.in $(srcdir)/zfs.lsb.in \
+ $(srcdir)/zfs.lunar.in $(srcdir)/zfs.redhat.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/config/always-no-unused-but-set-variable.m4 \
@@ -83,7 +86,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/zfs_config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = zfs.arch zfs.gentoo zfs.lunar zfs.fedora zfs.lsb \
+ zfs.redhat
CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
@@ -296,6 +300,18 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+zfs.arch: $(top_builddir)/config.status $(srcdir)/zfs.arch.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+zfs.gentoo: $(top_builddir)/config.status $(srcdir)/zfs.gentoo.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+zfs.lunar: $(top_builddir)/config.status $(srcdir)/zfs.lunar.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+zfs.fedora: $(top_builddir)/config.status $(srcdir)/zfs.fedora.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+zfs.lsb: $(top_builddir)/config.status $(srcdir)/zfs.lsb.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+zfs.redhat: $(top_builddir)/config.status $(srcdir)/zfs.redhat.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
diff --git a/etc/init.d/zfs.arch b/etc/init.d/zfs.arch.in
index c0fb209a9..de2ea8a2d 100644
--- a/etc/init.d/zfs.arch
+++ b/etc/init.d/zfs.arch.in
@@ -3,6 +3,10 @@
. /etc/rc.conf
. /etc/rc.d/functions
+ZFS="@sbindir@/zfs"
+ZPOOL="@sbindir@/zpool"
+ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
+
case "$1" in
start)
stat_busy "Starting zfs"
@@ -16,8 +20,8 @@ case "$1" in
fi
# Import ZFS pools (via cache file)
- if [ -f /etc/zfs/zpool.cache ]; then
- /usr/sbin/zpool import -c /etc/zfs/zpool.cache -aN 2>/dev/null
+ if [ -f $ZPOOL_CACHE ]; then
+ $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null
if [ $? -ne 0 ]; then
stat_fail
exit 1
@@ -25,14 +29,14 @@ case "$1" in
fi
# Mount ZFS filesystems
- /usr/sbin/zfs mount -a
+ $ZFS mount -a
if [ $? -ne 0 ]; then
stat_fail
exit 1
fi
# Export ZFS flesystems
- /usr/sbin/zfs share -a
+ $ZFS share -a
if [ $? -ne 0 ]; then
stat_fail
exit 1
@@ -43,7 +47,7 @@ case "$1" in
;;
stop)
stat_busy "Stopping zfs"
- zfs umount -a
+ $ZFS umount -a
rm_daemon zfs
stat_done
;;
diff --git a/etc/init.d/zfs.fedora b/etc/init.d/zfs.fedora.in
index 70b728106..04f2077ce 100644
--- a/etc/init.d/zfs.fedora
+++ b/etc/init.d/zfs.fedora.in
@@ -30,8 +30,9 @@ export PATH=/usr/local/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
# script variables
RETVAL=0
-ZPOOL=zpool
-ZFS=zfs
+ZFS="@sbindir@/zfs"
+ZPOOL="@sbindir@/zpool"
+ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
servicename=zfs
LOCKFILE=/var/lock/subsys/$servicename
@@ -143,19 +144,19 @@ start()
fi
fi
- if [ -f /etc/zfs/zpool.cache ] ; then
-
+ if [ -f $ZPOOL_CACHE ] ; then
+
echo -n $"Importing ZFS pools not yet imported: "
- $ZPOOL import -c /etc/zfs/zpool.cache -aN || true # stupid zpool will fail if all pools are already imported
+ $ZPOOL import -c $ZPOOL_CACHE -aN || true # stupid zpool will fail if all pools are already imported
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
failure "Importing ZFS pools not yet imported: "
return 151
fi
success "Importing ZFS pools not yet imported: "
-
+
fi
-
+
action $"Mounting ZFS filesystems not yet mounted: " $ZFS mount -a || return 152
action $"Exporting ZFS filesystems: " $ZFS share -a || return 153
@@ -169,7 +170,7 @@ start()
string=`printf "$template" "$volume"`
action "$string" mount "$volume"
done
-
+
touch "$LOCKFILE"
}
@@ -204,7 +205,7 @@ stop()
# return 8
#fi
#success
-
+
rm -f "$LOCKFILE"
}
diff --git a/etc/init.d/zfs.gentoo b/etc/init.d/zfs.gentoo.in
index f709ed9e7..767aba8f9 100644
--- a/etc/init.d/zfs.gentoo
+++ b/etc/init.d/zfs.gentoo.in
@@ -11,9 +11,9 @@ depend()
keyword -lxc -openvz -prefix -vserver
}
-CACHEFILE=/etc/zfs/zpool.cache
-ZPOOL=/sbin/zpool
-ZFS=/sbin/zfs
+ZFS="@sbindir@/zfs"
+ZPOOL="@sbindir@/zpool"
+ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
ZFS_MODULE=zfs
checksystem() {
@@ -55,11 +55,11 @@ start() {
# Import all pools described by the cache file, and then mount
# all filesystem based on their properties.
- if [ -f $CACHEFILE ]; then
+ if [ -f $ZPOOL_CACHE ]; then
einfo "Importing ZFS pools"
# as per fedora script, import can fail if all pools are already imported
# The check for $rv makes no sense...but someday, it will work right.
- $ZPOOL import -c $CACHEFILE -aN 2>/dev/null || true
+ $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null || true
rv=$?
if [ $rv -ne 0 ]; then
eerror "Failed to import not-yet imported pools."
diff --git a/etc/init.d/zfs.lsb b/etc/init.d/zfs.lsb.in
index ce541a9cd..c781f05f4 100644
--- a/etc/init.d/zfs.lsb
+++ b/etc/init.d/zfs.lsb.in
@@ -31,9 +31,9 @@
RETVAL=0
LOCKFILE=/var/lock/zfs
-CACHEFILE=/etc/zfs/zpool.cache
-ZPOOL=/sbin/zpool
-ZFS=/sbin/zfs
+ZFS="@sbindir@/zfs"
+ZPOOL="@sbindir@/zpool"
+ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
[ -x $ZPOOL ] || exit 1
[ -x $ZFS ] || exit 2
@@ -66,9 +66,9 @@ start()
# Import all pools described by the cache file, and then mount
# all filesystem based on their properties.
- if [ -f $CACHEFILE ] ; then
+ if [ -f $ZPOOL_CACHE ] ; then
log_begin_msg "Importing ZFS pools"
- $ZPOOL import -c $CACHEFILE -aN 2>/dev/null
+ $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null
log_end_msg $?
log_begin_msg "Mounting ZFS filesystems"
@@ -79,7 +79,7 @@ start()
$ZFS share -a
log_end_msg $?
fi
-
+
touch $LOCKFILE
}
diff --git a/etc/init.d/zfs.lunar b/etc/init.d/zfs.lunar.in
index bdc461af8..97384dc83 100644
--- a/etc/init.d/zfs.lunar
+++ b/etc/init.d/zfs.lunar.in
@@ -10,6 +10,10 @@
# using SPL (Solaris Porting Layer) by zfsonlinux.org.
# probe: true
+ZFS="@sbindir@/zfs"
+ZPOOL="@sbindir@/zpool"
+ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
+
case $1 in
start) echo "$1ing ZFS filesystems"
@@ -35,16 +39,16 @@ case $1 in
while IFS= read -r -d $'\n' dev; do
mdev=$(echo "$dev" | awk '{ print $1; }')
echo -n "mounting $mdev..."
- if zfs mount $mdev; then
+ if $ZFS mount $mdev; then
echo -e "done";
else
echo -e "failed";
fi
- done < <(zfs list -H);
+ done < <($ZFS list -H);
# export the filesystems
echo -n "exporting ZFS filesystems..."
- if zfs share -a; then
+ if $ZFS share -a; then
echo -e "done";
else
echo -e "failed";
@@ -60,14 +64,14 @@ case $1 in
while IFS= read -r -d $'\n' dev; do
mdev=$(echo "$dev" | awk '{ print $1 }');
echo -n "umounting $mdev...";
- if zfs umount $mdev; then
+ if $ZFS umount $mdev; then
echo -e "done";
else
echo -e "failed";
fi
# the next line is, because i have to reverse the
# output, otherwise it wouldn't work as it should
- done < <(zfs list -H | tac);
+ done < <($ZFS list -H | tac);
# and finally let's rmmod the module
rmmod zfs
diff --git a/etc/init.d/zfs.redhat b/etc/init.d/zfs.redhat.in
index d3475f09d..ae797c11a 100644
--- a/etc/init.d/zfs.redhat
+++ b/etc/init.d/zfs.redhat.in
@@ -30,8 +30,9 @@ export PATH=/usr/local/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
# script variables
RETVAL=0
-ZPOOL=zpool
-ZFS=zfs
+ZFS="@sbindir@/zfs"
+ZPOOL="@sbindir@/zpool"
+ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
servicename=zfs
LOCKFILE=/var/lock/subsys/$servicename