openrc/init.d/sysctl.Linux.in
Diego Elio Pettenò 8104618d10 init.d/sysctl.Linux: do not use sysctl -q
The -q option is not implemented by BusyBox, so instead of using that, make
it so that the standard error is caught, but standard output is thrown
away.

Note: the ordered behaviour of redirection is part of POSIX so we should be
on the safe side with this change, as first we duplicate the output
descriptor to be used as stderr, then we change the output descriptor to
point to NULL.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-03-24 13:19:41 -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.d/*.conf /etc/sysctl.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}"
}