freebsd-dev/etc/rc.d/addswap
Gordon Tetlow 27bc1b287e Merge in all the changes that Mike Makonnen has been maintaining for a
while. This is only the script pieces, the glue for the build comes next.

Submitted by:	Mike Makonnen <makonnen@pacbell.net>
Reviewed by:	silence on -current and -hackers
Prodded by:	rwatson
2002-06-13 22:14:37 +00:00

35 lines
501 B
Bash

#!/bin/sh
#
# Add additional swap files
#
# $FreeBSD$
#
# PROVIDE: addswap
# REQUIRE: mountcritlocal
# BEFORE: sysctl
# KEYWORD: FreeBSD
. /etc/rc.subr
name="addswap"
start_cmd="addswap_start"
stop_cmd=":"
addswap_start()
{
case ${swapfile} in
[Nn][Oo] | '')
;;
*)
if [ -w "${swapfile}" -a -c /dev/mdctl ]; then
echo "Adding ${swapfile} as additional swap"
mdev=`mdconfig -a -t vnode -f ${swapfile}` && swapon /dev/${mdev}
fi
;;
esac
}
load_rc_config $name
run_rc_command "$1"