81 lines
1.4 KiB
Bash
81 lines
1.4 KiB
Bash
#!/bin/sh
|
|
#
|
|
### BEGIN INIT INFO
|
|
# Provides: zvol zfs
|
|
# Required-Start: $local_fs
|
|
# Required-Stop: $local_fs
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Mount ZFS filesystems
|
|
# Description: Run the `zfs mount -a` or `zfs umount -a` command.
|
|
# This init script is deprecated and should be disabled in the
|
|
# /etc/default/zfs options file. Instead, use the zfs-mount
|
|
# package for Debian or the zfs-mountall package for Ubuntu
|
|
### END INIT INFO
|
|
|
|
PATH=/sbin:/bin
|
|
|
|
. /lib/lsb/init-functions
|
|
. /lib/init/vars.sh
|
|
|
|
[ -f /etc/default/zfs ] && . /etc/default/zfs
|
|
|
|
do_start()
|
|
{
|
|
log_begin_msg "Mounting ZFS filesystems"
|
|
log_progress_msg "filesystems"
|
|
zfs mount -a
|
|
RET=$?
|
|
|
|
if [ $RET != 0 ] ; then
|
|
log_end_msg $RET
|
|
exit $RET
|
|
fi
|
|
|
|
log_end_msg 0
|
|
}
|
|
|
|
do_stop()
|
|
{
|
|
log_begin_msg "Unmounting ZFS filesystems"
|
|
log_progress_msg "filesystems"
|
|
zfs unmount -a
|
|
RET=$?
|
|
|
|
# Ignore a non-zero `zfs` result so that a busy ZFS instance
|
|
# does not hang the system during shutdown.
|
|
if [ $RET != 0 ] ; then
|
|
log_end_msg $RET
|
|
fi
|
|
|
|
log_end_msg 0
|
|
}
|
|
|
|
case "$1" in
|
|
(start)
|
|
case "$ZFS_MOUNT" in
|
|
([Oo][Ff][Ff]|[Nn][Oo]|'')
|
|
exit 0
|
|
;;
|
|
esac
|
|
do_start
|
|
;;
|
|
(stop)
|
|
case "$ZFS_UNMOUNT" in
|
|
([Oo][Ff][Ff]|[Nn][Oo]|'')
|
|
exit 0
|
|
;;
|
|
esac
|
|
do_stop
|
|
;;
|
|
(force-reload|reload|restart|status)
|
|
# no-op
|
|
;;
|
|
|
|
(*)
|
|
[ -n "$1" ] && echo "Error: Unknown command $1."
|
|
echo "Usage: $0 {start|stop}"
|
|
exit 3
|
|
;;
|
|
esac
|