]> git.proxmox.com Git - mirror_zfs-debian.git/blob - debian/zfsutils-linux.zfs-mount.init
Merge tag 'upstream/0.6.5.3'
[mirror_zfs-debian.git] / debian / zfsutils-linux.zfs-mount.init
1 #!/bin/sh
2 #
3 ### BEGIN INIT INFO
4 # Provides: zvol zfs zfs-mount
5 # Required-Start: $local_fs
6 # Required-Stop: $local_fs
7 # Default-Start: 2 3 4 5
8 # Default-Stop: 0 1 6
9 # Short-Description: Mount ZFS filesystems
10 # Description: Run the `zfs mount -a` or `zfs umount -a` command.
11 # This init script is deprecated and should be disabled in the
12 # /etc/default/zfs options file. Instead, use the zfs-mount
13 # package for Debian or the zfs-mountall package for Ubuntu
14 ### END INIT INFO
15
16 PATH=/sbin:/bin
17
18 . /lib/lsb/init-functions
19 # Do not source /lib/init/*.sh as they are not public APIs after getting rid
20 # of /lib/init/rw. However, this line may help when doing back port to older
21 # releases.
22 #
23 #. /lib/init/vars.sh
24
25 [ -f /etc/default/zfs ] && . /etc/default/zfs
26
27 do_start()
28 {
29 log_begin_msg "Mounting ZFS filesystems"
30 log_progress_msg "filesystems"
31 zfs mount -a
32 RET=$?
33
34 if [ $RET != 0 ] ; then
35 log_end_msg $RET
36 exit $RET
37 fi
38
39 log_end_msg 0
40 }
41
42 do_stop()
43 {
44 log_begin_msg "Unmounting ZFS filesystems"
45 log_progress_msg "filesystems"
46 zfs unmount -a
47 RET=$?
48
49 # Ignore a non-zero `zfs` result so that a busy ZFS instance
50 # does not hang the system during shutdown.
51 if [ $RET != 0 ] ; then
52 log_end_msg $RET
53 fi
54
55 log_end_msg 0
56 }
57
58 case "$1" in
59 (start)
60 case "$ZFS_MOUNT" in
61 ([Oo][Ff][Ff]|[Nn][Oo]|'')
62 exit 0
63 ;;
64 esac
65 do_start
66 ;;
67 (stop)
68 case "$ZFS_UNMOUNT" in
69 ([Oo][Ff][Ff]|[Nn][Oo]|'')
70 exit 0
71 ;;
72 esac
73 do_stop
74 ;;
75 (force-reload|reload|restart|status)
76 # no-op
77 ;;
78
79 (*)
80 [ -n "$1" ] && echo "Error: Unknown command $1."
81 echo "Usage: $0 {start|stop}"
82 exit 3
83 ;;
84 esac