Browse Source

Changes to sysctl_conf(), mixerctl_conf() and wsconsctl_conf():

- no need to check for non-empty *.conf files, stripcom handles that now
- pipe stripcom output directly to while-read-loop
- quote the argument to the *ctl commands
- no need to double shutup mixerctl, -q already means quiet
OK krw@, halex@
OPENBSD_5_9
rpe 9 years ago
parent
commit
64a99181e8
1 changed files with 19 additions and 35 deletions
  1. +19
    -35
      src/etc/rc

+ 19
- 35
src/etc/rc View File

@ -1,4 +1,4 @@
# $OpenBSD: rc,v 1.456 2015/08/12 17:27:27 rpe Exp $
# $OpenBSD: rc,v 1.457 2015/08/13 17:24:42 rpe Exp $
# System startup script run by init on autoboot or after single-user.
# Output and error are redirected to console by init, and the console is the
@ -48,52 +48,36 @@ update_limit() {
done
}
# Apply sysctl(8) settings.
# Apply sysctl.conf(5) settings.
sysctl_conf() {
[ -s /etc/sysctl.conf ] || return
# delete comments and blank lines
set -- `stripcom /etc/sysctl.conf`
while [ $# -ge 1 ] ; do
sysctl $1
# update limits if needed
case $1 in
stripcom /etc/sysctl.conf |
while read _line; do
sysctl "$_line"
case $_line in
kern.maxproc=*)
update_limit -p maxproc
;;
update_limit -p maxproc;;
kern.maxfiles=*)
update_limit -n openfiles
;;
update_limit -n openfiles;;
esac
shift
done
}
# Apply mixerctl(1) settings.
# Apply mixerctl.conf(5) settings.
mixerctl_conf() {
[ -s /etc/mixerctl.conf ] || return
# delete comments and blank lines
set -- `stripcom /etc/mixerctl.conf`
while [ $# -ge 1 ] ; do
mixerctl -q $1 >/dev/null 2>&1
shift
stripcom /etc/mixerctl.conf |
while read _line; do
mixerctl -q "$_line" 2>/dev/null
done
}
# Apply wscons system driver settings using wsconsctl(8).
# Apply wsconsctl.conf(5) settings.
wsconsctl_conf() {
local save_IFS="$IFS"
[ -x /sbin/wsconsctl -a -s /etc/wsconsctl.conf ] || return
# delete comments and blank lines
IFS="
"
set -- `stripcom /etc/wsconsctl.conf`
IFS="$save_IFS"
while [ $# -ge 1 ] ; do
eval wsconsctl $1
shift
[[ -x /sbin/wsconsctl ]] || return
stripcom /etc/wsconsctl.conf |
while read _line; do
wsconsctl "$_line"
done
}


Loading…
Cancel
Save