1 #!/bin/sh 2 # 3 # $NetBSD: swap1,v 1.11 2009/09/24 16:45:48 apb Exp $ 4 # 5 6 # PROVIDE: localswap 7 # REQUIRE: DISKS root 8 # KEYWORD: shutdown 9 10 $_rc_subr_loaded . /etc/rc.subr 11 12 name="swap1" 13 start_cmd="swap1_start" 14 stop_cmd="swap1_stop" 15 16 # Add all block-type swap devices; these might be necessary 17 # during disk checks. 18 # 19 swap1_start() 20 { 21 # Treat exit status 2 from swapctl(8) as successful; it means 22 # "no error, but no suitable swap devices were configured". 23 # 24 if ! checkyesno no_swap; then 25 swapctl -A -t blk || [ $? = 2 ] 26 fi 27 } 28 29 # Remove all block-type swap devices 30 # 31 swap1_stop() 32 { 33 if checkyesno swapoff || [ -n "$rc_force" ]; then 34 echo "Removing block-type swap devices" 35 swapctl -U -t blk || [ $? = 2 ] 36 fi 37 } 38 39 load_rc_config swap 40 run_rc_command "$1" 41