Bring RCNG in from 5.x and adjust config files and scripts accordingly.
[dragonfly.git] / etc / rc.d / swap1
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
14 name="swap1"
15
16 case ${OSTYPE} in
17 DragonFly)
18         start_cmd='swapon -a'
19         stop_cmd=':'
20         ;;
21
22 FreeBSD)
23         start_cmd='swapon -a'
24         stop_cmd=':'
25         ;;
26 NetBSD)
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         ;;
33 esac
34
35 #               Add all block-type swap devices; these might be necessary
36 #               during disk checks.
37 #
38 swap1_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 #
47 swap1_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
55 load_rc_config swap
56 run_rc_command "$1"