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