blob: 6e24030bdbb07fcfe31be9ca556bc65147f26101 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#!/bin/sh
#
# $NetBSD: sysctl,v 1.12 2002/04/29 12:10:23 lukem Exp $
# $FreeBSD$
#
# PROVIDE: sysctl
# REQUIRE: root
# BEFORE: DAEMON
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="sysctl"
stop_cmd=":"
case ${OSTYPE} in
FreeBSD)
start_cmd="FreeBSD_start"
extra_commands="reload lastload"
reload_cmd="FreeBSD_start"
lastload_cmd="FreeBSD_start last"
;;
NetBSD)
start_cmd="NetBSD_start"
;;
esac
FreeBSD_start()
{
#
# Read in /etc/sysctl.conf and set things accordingly
#
if [ -f /etc/sysctl.conf ]; then
while read var comments
do
case ${var} in
\#*|'')
;;
*)
mib=${var%=*}
val=${var#*=}
if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then
case ${current_value} in
${val})
;;
*)
sysctl ${var}
;;
esac
elif [ "$1" = "last" ]; then
warn "sysctl ${mib} does not exist."
fi
;;
esac
done < /etc/sysctl.conf
fi
}
NetBSD_start()
{
if [ -r /etc/sysctl.conf ]; then
echo "Setting sysctl variables:"
${SYSCTL} -f /etc/sysctl.conf
fi
}
load_rc_config $name
run_rc_command "$1"
|