TRIM support
[dragonfly.git] / etc / rc.d / swap1
CommitLineData
9c600e7d
MD
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 $
696a5717 5# $DragonFly: src/etc/rc.d/swap1,v 1.5 2005/11/19 21:47:32 swildner Exp $
9c600e7d
MD
6#
7
8# PROVIDE: localswap
e0fb398b
T
9# REQUIRE: savecore
10# BEFORE: SERVERS
696a5717 11# KEYWORD: shutdown
9c600e7d
MD
12
13. /etc/rc.subr
14
15name="swap1"
82ee8fdc
RG
16start_cmd='df_swap1_start'
17stop_cmd=':'
9c600e7d
MD
18
19# Add all block-type swap devices; these might be necessary
20# during disk checks.
21#
22swap1_start()
23{
24 if ! checkyesno no_swap; then
25 swapctl -A -t blk
26 fi
27}
28
29# Remove all block-type swap devices
30#
31swap1_stop()
32{
33 if checkyesno swapoff || [ -n "$rc_force" ]; then
34 echo "Removing block-type swap devices"
35 swapctl -U -t blk
36 fi
37}
38
015080b6
MD
39df_swap1_start()
40{
41 if [ `${SYSCTL_N} vm.swap_enabled` = 0 ]; then
42 return ${RC_CONFIGURED}
43 else
44 swapon -a && return ${RC_CONFIGURED}
45 fi
46 return ${RC_FAILED}
47}
48
49
9c600e7d
MD
50load_rc_config swap
51run_rc_command "$1"