summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/addswap
blob: b075faa69257dc715fd9f642a8cee42a761c614d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
#
# Add additional swap files
#
# $FreeBSD$
#

# PROVIDE: addswap
# REQUIRE: mountcritlocal
# BEFORE: sysctl
# KEYWORD: FreeBSD nojail

. /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"
OpenPOWER on IntegriCloud