diff options
author | Kyle Fuller <[email protected]> | 2011-07-25 01:00:53 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-08-01 09:54:44 -0700 |
commit | 5faa9c0367e8d6b1ee1c45f1ebeffd3e53ef35e8 (patch) | |
tree | 53358897ebeed920a56fc39c9ab14b87b9b5c98c /etc/init.d/zfs.arch.in | |
parent | 7f4afd300b753ee7e0ce1f8d12c098119193001b (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/init.d/zfs.arch.in')
-rw-r--r-- | etc/init.d/zfs.arch.in | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/etc/init.d/zfs.arch.in b/etc/init.d/zfs.arch.in new file mode 100644 index 000000000..de2ea8a2d --- /dev/null +++ b/etc/init.d/zfs.arch.in @@ -0,0 +1,62 @@ +#!/bin/bash + +. /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" + + 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 $ZPOOL_CACHE ]; then + $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null + if [ $? -ne 0 ]; then + stat_fail + exit 1 + fi + fi + + # Mount ZFS filesystems + $ZFS mount -a + if [ $? -ne 0 ]; then + stat_fail + exit 1 + fi + + # Export ZFS flesystems + $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 |