2007-04-06 02:27:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: zfs
|
|
|
|
# REQUIRE: mountcritlocal
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="zfs"
|
|
|
|
rcvar="zfs_enable"
|
|
|
|
start_cmd="zfs_start"
|
|
|
|
stop_cmd="zfs_stop"
|
|
|
|
required_modules="zfs"
|
|
|
|
|
2007-04-22 20:55:08 +00:00
|
|
|
zfs_start_jail()
|
|
|
|
{
|
|
|
|
if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
|
|
|
|
zfs mount -a
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
zfs_start_main()
|
2007-04-06 02:27:02 +00:00
|
|
|
{
|
2013-07-09 08:59:39 +00:00
|
|
|
zfs mount -va
|
2007-04-06 02:27:02 +00:00
|
|
|
zfs share -a
|
2007-04-13 11:02:06 +00:00
|
|
|
if [ ! -r /etc/zfs/exports ]; then
|
|
|
|
touch /etc/zfs/exports
|
|
|
|
fi
|
2007-04-06 02:27:02 +00:00
|
|
|
}
|
|
|
|
|
2007-04-22 20:55:08 +00:00
|
|
|
zfs_start()
|
|
|
|
{
|
|
|
|
if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
|
|
|
|
zfs_start_jail
|
|
|
|
else
|
|
|
|
zfs_start_main
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
zfs_stop_jail()
|
|
|
|
{
|
|
|
|
if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
|
|
|
|
zfs unmount -a
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
zfs_stop_main()
|
2007-04-06 02:27:02 +00:00
|
|
|
{
|
|
|
|
zfs unshare -a
|
|
|
|
zfs unmount -a
|
|
|
|
}
|
|
|
|
|
2007-04-22 20:55:08 +00:00
|
|
|
zfs_stop()
|
|
|
|
{
|
|
|
|
if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
|
|
|
|
zfs_stop_jail
|
|
|
|
else
|
|
|
|
zfs_stop_main
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2007-04-06 02:27:02 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|