1 1.1 lukem #!/bin/sh 2 1.1 lukem # 3 1.7 lukem # $NetBSD: sysctl,v 1.7 2000/05/13 08:45:09 lukem Exp $ 4 1.1 lukem # 5 1.1 lukem 6 1.1 lukem # PROVIDE: sysctl 7 1.2 tsarna # REQUIRE: root ipnat 8 1.1 lukem 9 1.1 lukem . /etc/rc.subr 10 1.1 lukem 11 1.1 lukem name="sysctl" 12 1.1 lukem start_cmd="sysctl_start" 13 1.1 lukem stop_cmd=":" 14 1.1 lukem 15 1.1 lukem sysctl_start() 16 1.1 lukem { 17 1.3 tsarna if [ -n "$defcorename" ]; then 18 1.3 tsarna cat <<__EOF__ 19 1.3 tsarna *** WARNING: /etc/rc.conf \$defcorename setting is obsolete. Please 20 1.3 tsarna *** set kern.defcorename in /etc/sysctl.conf 21 1.6 tsarna __EOF__ 22 1.3 tsarna sysctl -w kern.defcorename=$defcorename 23 1.4 tsarna fi 24 1.4 tsarna 25 1.6 tsarna if [ -n "$nfsiod_flags" ]; then 26 1.4 tsarna cat <<__EOF__ 27 1.4 tsarna *** WARNING: /etc/rc.conf \$nfsiod_flags setting is obsolete. Please 28 1.6 tsarna *** remove it. If it was set to other than the default of "-n 4", then 29 1.5 tsarna *** set vfs.nfs.iothreads in /etc/sysctl.conf 30 1.3 tsarna __EOF__ 31 1.3 tsarna fi 32 1.3 tsarna 33 1.3 tsarna # if $securelevel is set, change it here, else if it is 0, 34 1.3 tsarna # change it to 1 here, before we start login services. 35 1.3 tsarna # 36 1.3 tsarna if [ -n "$securelevel" ]; then 37 1.3 tsarna echo -n "Setting securelevel: " 38 1.3 tsarna sysctl -w kern.securelevel=$securelevel 39 1.3 tsarna else 40 1.3 tsarna securelevel=`sysctl -n kern.securelevel` 41 1.3 tsarna if [ x"$securelevel" = x0 ]; then 42 1.3 tsarna echo -n "Setting securelevel: " 43 1.3 tsarna sysctl -w kern.securelevel=1 44 1.3 tsarna fi 45 1.3 tsarna fi 46 1.3 tsarna 47 1.2 tsarna if [ -r /etc/sysctl.conf ]; then 48 1.2 tsarna echo "Setting sysctl variables:" 49 1.2 tsarna sysctl -f /etc/sysctl.conf 50 1.1 lukem fi 51 1.1 lukem } 52 1.1 lukem 53 1.7 lukem load_rc_config $name 54 1.1 lukem run_rc_command "$1" 55