[BACK]Return to swap1 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc / rc.d

File: [cvs.NetBSD.org] / src / etc / rc.d / swap1 (download)

Revision 1.11, Thu Sep 24 16:45:48 2009 UTC (14 years, 6 months ago) by apb
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-premerge-20091211, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, khorben-n900, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Changes since 1.10: +6 -3 lines

Adapt /etc/rc.d/swap1 and swap2 scripts to the new meaning of
exit status 2 from swapctl(8).

#!/bin/sh
#
# $NetBSD: swap1,v 1.11 2009/09/24 16:45:48 apb Exp $
#

# PROVIDE: localswap
# REQUIRE: DISKS root
# KEYWORD: shutdown

$_rc_subr_loaded . /etc/rc.subr

name="swap1"
start_cmd="swap1_start"
stop_cmd="swap1_stop"

#		Add all block-type swap devices; these might be necessary
#		during disk checks.
#
swap1_start()
{
	# Treat exit status 2 from swapctl(8) as successful; it means
	# "no error, but no suitable swap devices were configured".
	#
	if ! checkyesno no_swap; then
		swapctl -A -t blk || [ $? = 2 ]
	fi
}

#		Remove all block-type swap devices
#
swap1_stop()
{
	if checkyesno swapoff || [ -n "$rc_force" ]; then
		echo "Removing block-type swap devices"
		swapctl -U -t blk || [ $? = 2 ]
	fi
}

load_rc_config swap
run_rc_command "$1"