freebsd-skq/etc/rc.d/sysctl
fenner 389223166a Fix two typos. Using "-eq" instead of "=" in a [ caused an error when
an entry in /etc/sysctl.conf didn't exist.  Fixing this exposed a minor
typo "exits" vs. "exist".

However, there doesn't appear to be any provision to run this with
the "lastload" argument, meaning that the error will never appear.
2002-10-25 23:02:54 +00:00

71 lines
1.1 KiB
Bash

#!/bin/sh
#
# $NetBSD: sysctl,v 1.12 2002/04/29 12:10:23 lukem Exp $
# $FreeBSD$
#
# PROVIDE: sysctl
# REQUIRE: root ipfilter ipsec
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="sysctl"
stop_cmd=":"
case ${OSTYPE} in
FreeBSD)
start_cmd="FreeBSD_start"
extra_commands="reload lastload"
reload_cmd="FreeBSD_start"
lastload_cmd="FreeBSD_start last"
;;
NetBSD)
start_cmd="NetBSD_start"
;;
esac
FreeBSD_start()
{
#
# Read in /etc/sysctl.conf and set things accordingly
#
if [ -f /etc/sysctl.conf ]; then
while read var comments
do
case ${var} in
\#*|'')
;;
*)
mib=${var%=*}
val=${var#*=}
if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then
case ${current_value} in
${val})
;;
*)
sysctl ${var}
;;
esac
elif [ "$1" = "last" ]; then
warn "sysctl ${mib} does not exist."
fi
;;
esac
done < /etc/sysctl.conf
fi
}
NetBSD_start()
{
if [ -r /etc/sysctl.conf ]; then
echo "Setting sysctl variables:"
${SYSCTL} -f /etc/sysctl.conf
fi
}
load_rc_config $name
run_rc_command "$1"