Annotation of src/etc/rc.d/swap2, Revision 1.8
1.1 lukem 1: #!/bin/sh
2: #
1.8 ! apb 3: # $NetBSD: swap2,v 1.7 2004/08/13 18:08:03 mycroft Exp $
1.1 lukem 4: #
5:
6: # PROVIDE: nonlocalswap
7: # REQUIRE: mountcritremote
1.6 thorpej 8: # BEFORE: DAEMON
1.1 lukem 9:
1.7 mycroft 10: $_rc_subr_loaded . /etc/rc.subr
1.1 lukem 11:
12: name="swap2"
13: start_cmd="swap2_start"
14:
15: swap2_start()
16: {
1.8 ! apb 17: # "Critical" file systems are now mounted. Go ahead and swap
! 18: # to files now, since they will be residing in the critical file
! 19: # systems (or, at least, they should be...).
1.1 lukem 20: #
1.8 ! apb 21: # Treat exit status 2 from swapctl(8) as successful; it means
! 22: # "no error, but no suitable swap devices were configured".
! 23: #
! 24: # Check for no swap, and warn about it unless that is desired.
! 25: #
! 26: local es
! 27: swapctl -A -t noblk
! 28: es=$?
! 29: [ $es = 2 ] && es=0
1.1 lukem 30: if ! checkyesno no_swap; then
31: if swapctl -s | grep "no swap devices configured" > /dev/null;
32: then
33: warn "No swap space configured!"
1.8 ! apb 34: es=1
1.1 lukem 35: fi
36: fi
1.8 ! apb 37: return $es
1.1 lukem 38: }
39:
40: # Remove all non-block-type swap devices
41: #
1.8 ! apb 42: stop_cmd="swapctl -U -t noblk || [ $? = 2 ]"
1.1 lukem 43:
1.4 lukem 44: load_rc_config swap
1.1 lukem 45: run_rc_command "$1"
CVSweb <webmaster@jp.NetBSD.org>