2002-06-13 22:14:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Add additional swap files
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: addswap
|
2012-02-11 06:21:16 +00:00
|
|
|
# REQUIRE: FILESYSTEMS kld
|
2012-09-11 05:04:59 +00:00
|
|
|
# BEFORE: netif
|
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"
|