aboutsummaryrefslogtreecommitdiffstats
path: root/etc/init.d
diff options
context:
space:
mode:
authorKyle Fuller <[email protected]>2011-07-10 16:57:33 +0100
committerBrian Behlendorf <[email protected]>2011-07-11 14:12:23 -0700
commit615ab66d18f74b3f4979c06192e1aa1082523dd3 (patch)
tree9a6fb994cb4fd03b08741ab1e35c3873a65efed2 /etc/init.d
parent057e8eee35d4cc06cc4edd6e8239d28a4122cf71 (diff)
Provide a rc.d script for archlinuxzfs-0.6.0-rc5
Unlike most other Linux distributions archlinux installs its init scripts in /etc/rc.d insead of /etc/init.d. This commit provides an archlinux rc.d script for zfs and extends the build infrastructure to ensure it get's installed in the correct place. Signed-off-by: Brian Behlendorf <[email protected]> Closes #322
Diffstat (limited to 'etc/init.d')
-rw-r--r--etc/init.d/Makefile.am4
-rw-r--r--etc/init.d/Makefile.in5
-rw-r--r--etc/init.d/zfs.arch58
3 files changed, 63 insertions, 4 deletions
diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am
index dd11946e7..00bb2681a 100644
--- a/etc/init.d/Makefile.am
+++ b/etc/init.d/Makefile.am
@@ -1,5 +1,5 @@
-EXTRA_DIST = zfs.fedora zfs.gentoo zfs.lsb zfs.lunar zfs.redhat
+EXTRA_DIST = zfs.fedora zfs.gentoo zfs.lsb zfs.lunar zfs.redhat zfs.arch
install-data-local:
- @instdest=$(DESTDIR)/$(sysconfdir)/init.d/zfs; \
+ @instdest=$(DESTDIR)$(DEFAULT_INIT_DIR)/zfs; \
$(INSTALL) -TD zfs.$(DEFAULT_INIT_SCRIPT) $$instdest
diff --git a/etc/init.d/Makefile.in b/etc/init.d/Makefile.in
index 53f5457b6..9763877d8 100644
--- a/etc/init.d/Makefile.in
+++ b/etc/init.d/Makefile.in
@@ -115,6 +115,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
+DEFAULT_INIT_DIR = @DEFAULT_INIT_DIR@
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
DEFS = @DEFS@
@@ -261,7 +262,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-EXTRA_DIST = zfs.fedora zfs.gentoo zfs.lsb zfs.lunar zfs.redhat
+EXTRA_DIST = zfs.fedora zfs.gentoo zfs.lsb zfs.lunar zfs.redhat zfs.arch
all: all-am
.SUFFIXES:
@@ -449,7 +450,7 @@ uninstall-am:
install-data-local:
- @instdest=$(DESTDIR)/$(sysconfdir)/init.d/zfs; \
+ @instdest=$(DESTDIR)$(DEFAULT_INIT_DIR)/zfs; \
$(INSTALL) -TD zfs.$(DEFAULT_INIT_SCRIPT) $$instdest
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/etc/init.d/zfs.arch b/etc/init.d/zfs.arch
new file mode 100644
index 000000000..c0fb209a9
--- /dev/null
+++ b/etc/init.d/zfs.arch
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting zfs"
+
+ if [ ! -c /dev/zfs ]; then
+ modprobe zfs
+ if [ $? -ne 0 ]; then
+ stat_fail
+ exit 1
+ fi
+ 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 [ $? -ne 0 ]; then
+ stat_fail
+ exit 1
+ fi
+ fi
+
+ # Mount ZFS filesystems
+ /usr/sbin/zfs mount -a
+ if [ $? -ne 0 ]; then
+ stat_fail
+ exit 1
+ fi
+
+ # Export ZFS flesystems
+ /usr/sbin/zfs share -a
+ if [ $? -ne 0 ]; then
+ stat_fail
+ exit 1
+ fi
+
+ add_daemon zfs
+ stat_done
+ ;;
+ stop)
+ stat_busy "Stopping zfs"
+ zfs umount -a
+ rm_daemon zfs
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+exit 0