swap revision 98184
171164Sache#!/bin/sh
271164Sache#
371164Sache# $NetBSD: swap1,v 1.8 2002/03/24 15:52:41 lukem Exp $
471164Sache# $FreeBSD: head/etc/rc.d/swap1 98184 2002-06-13 22:14:37Z gordon $
571164Sache#
671164Sache
771164Sache# PROVIDE: localswap
871164Sache# REQUIRE: disks
971164Sache# KEYWORD: FreeBSD NetBSD shutdown
1071164Sache
1171164Sache. /etc/rc.subr
1271164Sache
1371164Sachename="swap1"
1471164Sache
1571164Sachecase `${CMD_OSTYPE}` in
1671164SacheFreeBSD)
1771164Sache	start_cmd='swapon -a'
1871164Sache	stop_cmd=':'
1971164Sache	;;
2071164SacheNetBSD)
2171164Sache	#	Add all block-type swap devices; these might be necessary
2271164Sache	#	during disk checks.
2371164Sache	#
2471164Sache	start_cmd="swap1_start"
2571164Sache	stop_cmd="swap1_stop"
2671164Sache	;;
2771164Sacheesac
2871164Sache
2971164Sache#		Add all block-type swap devices; these might be necessary
3071164Sache#		during disk checks.
3171164Sache#
3271164Sacheswap1_start()
3371164Sache{
3471164Sache	if ! checkyesno no_swap; then
3571164Sache		swapctl -A -t blk
3671164Sache	fi
3771164Sache}
3871164Sache
3971164Sache#		Remove all block-type swap devices
4071164Sache#
4171164Sacheswap1_stop()
4271164Sache{
4371164Sache	if checkyesno swapoff || [ -n "$rc_force" ]; then
4471164Sache		echo "Removing block-type swap devices"
4571164Sache		swapctl -U -t blk
4671164Sache	fi
4771164Sache}
4871164Sache
4971164Sacheload_rc_config swap
5071164Sacherun_rc_command "$1"
5171164Sache