05341f326e
mountcritremote REQUIREs FILESYSTEMS, and that script REQUIREs zfs, so this change is a noop. By removing it we make life a little easier both for rcorder(8) and for debugging down the road. Approved by: 2 weeks of silence from pjd
86 lines
1.3 KiB
Bash
86 lines
1.3 KiB
Bash
#!/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"
|
|
|
|
zfs_start_jail()
|
|
{
|
|
if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
|
|
zfs mount -a
|
|
fi
|
|
}
|
|
|
|
zfs_start_main()
|
|
{
|
|
zfs volinit
|
|
zfs mount -a
|
|
zfs share -a
|
|
if [ ! -r /etc/zfs/exports ]; then
|
|
touch /etc/zfs/exports
|
|
fi
|
|
# Enable swap on ZVOLs with property org.freebsd:swap=on.
|
|
zfs list -H -o org.freebsd:swap,name -t volume | \
|
|
while read state name; do
|
|
case "${state}" in
|
|
[oO][nN])
|
|
swapon /dev/zvol/${name}
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
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()
|
|
{
|
|
# Disable swap on ZVOLs with property org.freebsd:swap=on.
|
|
zfs list -H -o org.freebsd:swap,name -t volume | \
|
|
while read state name; do
|
|
case "${state}" in
|
|
[oO][nN])
|
|
swapoff /dev/zvol/${name}
|
|
;;
|
|
esac
|
|
done
|
|
zfs unshare -a
|
|
zfs unmount -a
|
|
zfs volfini
|
|
}
|
|
|
|
zfs_stop()
|
|
{
|
|
if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
|
|
zfs_stop_jail
|
|
else
|
|
zfs_stop_main
|
|
fi
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|