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