openrc/init.d/sysctl.Linux.in
William Hubbs 09327f429f Allow files in sysctl.d to override sysctl.conf
reported-by: Peter Gantner (a.k.a. nephros) <gentoo@nephros.org>
X-Gentoo-Bug: 406631
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=406631
2012-03-24 14:37:08 -05:00

35 lines
698 B
Plaintext

#!@PREFIX@/sbin/runscript
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
depend()
{
before bootmisc logger
keyword -vserver
}
start()
{
local conf= retval=0 err errs
ebegin "Configuring kernel parameters"
eindent
for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
if [ -r "$conf" ]; then
vebegin "applying $conf"
if ! err=$(sysctl -p "$conf" 2>&1 >/dev/null) ; then
errs="${errs} ${err}"
sysctl -e -p "${conf}" >/dev/null
fi
veend $? || retval=1
fi
done
eoutdent
if [ ${retval} -eq 0 ] && [ -n "${errs}" ] ; then
ewarn "Unknown keys:${errs}"
fi
eend $retval "Some errors were encountered: ${errs}"
}