96776149fc
NETWORKING, and SERVERS) by specifying that certain things should come BEFORE a given barrier, rather than having the barrier REQUIRE a service. This allows scripts to be removed without having to edit the barrier dependencies. As discussed on tech-userlevel, and approved by Luke.
41 lines
858 B
Bash
Executable File
41 lines
858 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $NetBSD: securelevel,v 1.4 2002/03/22 04:34:00 thorpej Exp $
|
|
#
|
|
|
|
# PROVIDE: securelevel
|
|
# REQUIRE: aftermountlkm ipnat mountd
|
|
# BEFORE: DAEMON
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="securelevel"
|
|
start_cmd="securelevel_start"
|
|
stop_cmd=":"
|
|
|
|
securelevel_start()
|
|
{
|
|
# if $securelevel is set higher, change it here, else if
|
|
# it is 0, change it to 1 here, before we start daemons
|
|
# or login services.
|
|
#
|
|
osecurelevel=`sysctl -n kern.securelevel`
|
|
if [ -n "$securelevel" -a "$securelevel" != "$osecurelevel" ]; then
|
|
if [ "$securelevel" -lt "$osecurelevel" ]; then
|
|
echo "Can't lower securelevel."
|
|
exit 1
|
|
else
|
|
echo -n "Setting securelevel: "
|
|
sysctl -w kern.securelevel=$securelevel
|
|
fi
|
|
else
|
|
if [ "$osecurelevel" = 0 ]; then
|
|
echo -n "Setting securelevel: "
|
|
sysctl -w kern.securelevel=1
|
|
fi
|
|
fi
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|