sysctl revision 100280
1#!/bin/sh 2# 3# $NetBSD: sysctl,v 1.12 2002/04/29 12:10:23 lukem Exp $ 4# $FreeBSD: head/etc/rc.d/sysctl 100280 2002-07-18 05:00:17Z gordon $ 5# 6 7# PROVIDE: sysctl 8# REQUIRE: root ipfilter ipsec 9# BEFORE: DAEMON 10# KEYWORD: FreeBSD NetBSD 11 12. /etc/rc.subr 13 14name="sysctl" 15stop_cmd=":" 16 17case `${CMD_OSTYPE}` in 18FreeBSD) 19 start_cmd="FreeBSD_start" 20 extra_commands="reload lastload" 21 reload_cmd="FreeBSD_start" 22 lastload_cmd="FreeBSD_start last" 23 ;; 24NetBSD) 25 start_cmd="NetBSD_start" 26 ;; 27esac 28 29FreeBSD_start() 30{ 31 # 32 # Read in /etc/sysctl.conf and set things accordingly 33 # 34 if [ -f /etc/sysctl.conf ]; then 35 while read var comments 36 do 37 case ${var} in 38 \#*|'') 39 ;; 40 *) 41 mib=${var%=*} 42 val=${var#*=} 43 44 if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then 45 case ${current_value} in 46 ${val}) 47 ;; 48 *) 49 sysctl ${var} 50 ;; 51 esac 52 elif [ "$1" -eq "last" ]; then 53 warn "sysctl ${mib} does not exits." 54 fi 55 ;; 56 esac 57 done < /etc/sysctl.conf 58 fi 59} 60 61NetBSD_start() 62{ 63 if [ -r /etc/sysctl.conf ]; then 64 echo "Setting sysctl variables:" 65 ${SYSCTL} -f /etc/sysctl.conf 66 fi 67} 68 69load_rc_config $name 70run_rc_command "$1" 71