2002-06-13 22:14:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Add additional swap files
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: addswap
|
2007-04-02 22:53:07 +00:00
|
|
|
# REQUIRE: FILESYSTEMS
|
2002-06-13 22:14:37 +00:00
|
|
|
# BEFORE: sysctl
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="addswap"
|
|
|
|
start_cmd="addswap_start"
|
|
|
|
stop_cmd=":"
|
|
|
|
|
|
|
|
addswap_start()
|
|
|
|
{
|
|
|
|
case ${swapfile} in
|
|
|
|
[Nn][Oo] | '')
|
|
|
|
;;
|
|
|
|
*)
|
2006-01-16 13:26:05 +00:00
|
|
|
if [ -w "${swapfile}" ]; then
|
2002-06-13 22:14:37 +00:00
|
|
|
echo "Adding ${swapfile} as additional swap"
|
2002-10-12 10:31:31 +00:00
|
|
|
mdev=`mdconfig -a -t vnode -f ${swapfile}` && swapon /dev/${mdev}
|
2002-06-13 22:14:37 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|