summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-07-31 21:57:35 +0000
committerjhb <jhb@FreeBSD.org>2008-07-31 21:57:35 +0000
commit4072a30fef4ea74ad58a682821fc0f0e248e8512 (patch)
tree422f012280e16aaabd5f3126a7076d23ad258643
parente3839f1499f7e24497598c2da5e109942140d301 (diff)
downloadFreeBSD-src-4072a30fef4ea74ad58a682821fc0f0e248e8512.zip
FreeBSD-src-4072a30fef4ea74ad58a682821fc0f0e248e8512.tar.gz
Parse sysctl settings from /etc/sysctl.conf.local after /etc/sysctl.conf
if it exists. This mirrors similar behavior for /boot/loader.conf and /etc/rc.conf. Obtained from: Yahoo! MFC after: 1 week
-rwxr-xr-xetc/rc.d/sysctl25
1 files changed, 15 insertions, 10 deletions
diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl
index c55cc84..623956d 100755
--- a/etc/rc.d/sysctl
+++ b/etc/rc.d/sysctl
@@ -16,12 +16,12 @@ reload_cmd="sysctl_start"
lastload_cmd="sysctl_start last"
extra_commands="reload lastload"
-sysctl_start()
+#
+# Read in a file containing sysctl settings and set things accordingly.
+#
+parse_file()
{
- #
- # Read in /etc/sysctl.conf and set things accordingly
- #
- if [ -f /etc/sysctl.conf ]; then
+ if [ -f $1 ]; then
while read var comments
do
case ${var} in
@@ -36,19 +36,24 @@ sysctl_start()
${val})
;;
*)
- if ! sysctl "${var}" >/dev/null 2>&1; then
- warn "unable to set ${var}"
- fi
+ sysctl "${var}"
;;
esac
- elif [ "$1" = "last" ]; then
+ elif [ "$2" = "last" ]; then
warn "sysctl ${mib} does not exist."
fi
;;
esac
- done < /etc/sysctl.conf
+ 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"
OpenPOWER on IntegriCloud