freebsd-nq/etc/rc.d/sysctl
Hiroki Sato 5d595cb88e Integrate rc.d/network_ipv6 into rc.d/netif:
- Add rc.d/stf and rc.d/faith for stf(4) and faith(4).
- Remove rc.d/auto_linklocal and rc.d/network_ipv6.
- Move rc.d/sysctl to just before FILESYSTEMS because rc.d/netif
  depends on some sysctl variables.

Reviewed by:	brooks
MFC after:	3 days
2009-09-12 22:13:41 +00:00

62 lines
947 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: sysctl
# REQUIRE: root
# BEFORE: FILESYSTEMS
. /etc/rc.subr
name="sysctl"
stop_cmd=":"
start_cmd="sysctl_start"
reload_cmd="sysctl_start"
lastload_cmd="sysctl_start last"
extra_commands="reload lastload"
#
# Read in a file containing sysctl settings and set things accordingly.
#
parse_file()
{
if [ -f $1 ]; 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})
;;
*)
if ! sysctl "${var}" >/dev/null 2>&1; then
warn "unable to set ${var}"
fi
;;
esac
elif [ "$2" = "last" ]; then
warn "sysctl ${mib} does not exist."
fi
;;
esac
done < $1
fi
}
sysctl_start()
{
parse_file /etc/sysctl.conf $1
parse_file /etc/sysctl.conf.local $1
}
load_rc_config $name
run_rc_command "$1"