Make savecore return RC_CONFIGURED unconditionally.
[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.3 2003/12/14 19:13:15 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='df_swap1_start'
19         stop_cmd=':'
20         ;;
21 FreeBSD)
22         start_cmd='swapon -a'
23         stop_cmd=':'
24         ;;
25 NetBSD)
26         #       Add all block-type swap devices; these might be necessary
27         #       during disk checks.
28         #
29         start_cmd="swap1_start"
30         stop_cmd="swap1_stop"
31         ;;
32 esac
33
34 #               Add all block-type swap devices; these might be necessary
35 #               during disk checks.
36 #
37 swap1_start()
38 {
39         if ! checkyesno no_swap; then
40                 swapctl -A -t blk
41         fi
42 }
43
44 #               Remove all block-type swap devices
45 #
46 swap1_stop()
47 {
48         if checkyesno swapoff || [ -n "$rc_force" ]; then
49                 echo "Removing block-type swap devices"
50                 swapctl -U -t blk
51         fi
52 }
53
54 df_swap1_start()
55 {
56         if [ `${SYSCTL_N} vm.swap_enabled` = 0 ]; then
57                 return ${RC_CONFIGURED}
58         else
59                 swapon -a && return ${RC_CONFIGURED}
60         fi
61         return ${RC_FAILED}
62 }
63
64
65 load_rc_config swap
66 run_rc_command "$1"