swap revision 124616
1#!/bin/sh
2#
3# $NetBSD: swap1,v 1.8 2002/03/24 15:52:41 lukem Exp $
4# $FreeBSD: head/etc/rc.d/swap1 124616 2004-01-17 10:16:38Z mtm $
5#
6
7# PROVIDE: localswap
8# REQUIRE: disks
9# KEYWORD: FreeBSD shutdown
10
11. /etc/rc.subr
12
13name="swap1"
14
15case ${OSTYPE} in
16FreeBSD)
17	start_cmd='swapon -a'
18	stop_cmd=':'
19	;;
20NetBSD)
21	#	Add all block-type swap devices; these might be necessary
22	#	during disk checks.
23	#
24	start_cmd="swap1_start"
25	stop_cmd="swap1_stop"
26	;;
27esac
28
29#		Add all block-type swap devices; these might be necessary
30#		during disk checks.
31#
32swap1_start()
33{
34	if ! checkyesno no_swap; then
35		swapctl -A -t blk
36	fi
37}
38
39#		Remove all block-type swap devices
40#
41swap1_stop()
42{
43	if checkyesno swapoff || [ -n "$rc_force" ]; then
44		echo "Removing block-type swap devices"
45		swapctl -U -t blk
46	fi
47}
48
49load_rc_config swap
50run_rc_command "$1"
51