openrc/init.d/sysctl.in
2008-03-25 14:35:52 +00:00

38 lines
672 B
Plaintext

#!@PREFIX@/sbin/runscript
# Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
depend()
{
use hostname
before bootmisc logger
keyword noprefix
}
sysctl_BSD() {
local retval=0 var= comments=
while read var comments; do
case "${var}" in
""|"#"*) continue;;
esac
sysctl -w "${var}" >/dev/null || retval=1
done < /etc/sysctl.conf
return ${retval}
}
sysctl_Linux() {
sysctl -p >/dev/null
}
start()
{
[ -e /etc/sysctl.conf ] || return 0
ebegin "Configuring kernel parameters"
case "${RC_UNAME}" in
Linux) sysctl_Linux;;
*) sysctl_BSD;;
esac
eend $? "Some errors were encountered"
}