summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrpe <rpe@openbsd.org>2015-08-13 17:24:42 +0000
committerrpe <rpe@openbsd.org>2015-08-13 17:24:42 +0000
commitc30b68864bc7397aa0eb9ab79ffd90c7a94237d9 (patch)
tree6ed9f4b217cd7c6e5070e8b77a44d64fb2c4176d
parentscaffolding that will display more info for the elusive REQUIRED_BY error (diff)
downloadwireguard-openbsd-c30b68864bc7397aa0eb9ab79ffd90c7a94237d9.tar.xz
wireguard-openbsd-c30b68864bc7397aa0eb9ab79ffd90c7a94237d9.zip
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@
-rw-r--r--etc/rc54
1 files changed, 19 insertions, 35 deletions
diff --git a/etc/rc b/etc/rc
index 48d3cd5daf6..f28f0e99879 100644
--- a/etc/rc
+++ b/etc/rc
@@ -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
}