Sync usage with man page.
[netbsd-mini2440.git] / etc / rc.d / securelevel
blob1faea32201fdc30c2da6ea8e25ae53e6d81fa31e
1 #!/bin/sh
3 # $NetBSD: securelevel,v 1.7 2008/11/12 12:35:52 ad Exp $
6 # PROVIDE: securelevel
7 # REQUIRE: ipnat mountd
8 # BEFORE: DAEMON
10 $_rc_subr_loaded . /etc/rc.subr
12 name="securelevel"
13 start_cmd="securelevel_start"
14 stop_cmd=":"
16 securelevel_start()
18 # if $securelevel is set higher, change it here, else if
19 # it is 0, change it to 1 here, before we start daemons
20 # or login services.
22 osecurelevel=$(sysctl -n kern.securelevel 2>&-)
23 if [ $? != 0 ]; then
24 echo "Can't set securelevel. (kern.securelevel sysctl not present.)"
25 exit 1
28 if [ -n "$securelevel" -a "$securelevel" != "$osecurelevel" ]; then
29 if [ "$securelevel" -lt "$osecurelevel" ]; then
30 echo "Can't lower securelevel."
31 exit 1
32 else
33 echo -n "Setting securelevel: "
34 sysctl -w kern.securelevel=$securelevel
36 else
37 if [ "$osecurelevel" = 0 ]; then
38 echo -n "Setting securelevel: "
39 sysctl -w kern.securelevel=1
44 load_rc_config $name
45 run_rc_command "$1"