11.1Slukem#!/bin/sh 21.1Slukem# 31.8Sapb# $NetBSD: swap2,v 1.8 2009/09/24 16:45:48 apb Exp $ 41.1Slukem# 51.1Slukem 61.1Slukem# PROVIDE: nonlocalswap 71.1Slukem# REQUIRE: mountcritremote 81.6Sthorpej# BEFORE: DAEMON 91.1Slukem 101.7Smycroft$_rc_subr_loaded . /etc/rc.subr 111.1Slukem 121.1Slukemname="swap2" 131.1Slukemstart_cmd="swap2_start" 141.1Slukem 151.1Slukemswap2_start() 161.1Slukem{ 171.8Sapb # "Critical" file systems are now mounted. Go ahead and swap 181.8Sapb # to files now, since they will be residing in the critical file 191.8Sapb # systems (or, at least, they should be...). 201.1Slukem # 211.8Sapb # Treat exit status 2 from swapctl(8) as successful; it means 221.8Sapb # "no error, but no suitable swap devices were configured". 231.8Sapb # 241.8Sapb # Check for no swap, and warn about it unless that is desired. 251.8Sapb # 261.8Sapb local es 271.8Sapb swapctl -A -t noblk 281.8Sapb es=$? 291.8Sapb [ $es = 2 ] && es=0 301.1Slukem if ! checkyesno no_swap; then 311.1Slukem if swapctl -s | grep "no swap devices configured" > /dev/null; 321.1Slukem then 331.1Slukem warn "No swap space configured!" 341.8Sapb es=1 351.1Slukem fi 361.1Slukem fi 371.8Sapb return $es 381.1Slukem} 391.1Slukem 401.1Slukem# Remove all non-block-type swap devices 411.1Slukem# 421.8Sapbstop_cmd="swapctl -U -t noblk || [ $? = 2 ]" 431.1Slukem 441.4Slukemload_rc_config swap 451.1Slukemrun_rc_command "$1" 46