diff options
Diffstat (limited to 'etc/init.d')
-rw-r--r-- | etc/init.d/Makefile.am | 4 | ||||
-rw-r--r-- | etc/init.d/Makefile.in | 5 | ||||
-rw-r--r-- | etc/init.d/zfs.arch | 58 |
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 |