aboutsummaryrefslogtreecommitdiffstats
path: root/etc
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 /etc
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
Diffstat (limited to 'etc')
-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
7 files changed, 60 insertions, 34 deletions
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