clean up a little:

- don't set the securelevel to the same thing
	- don't try to lower the securelevel

inspired by PR#13647
This commit is contained in:
mrg 2002-03-01 17:58:00 +00:00
parent c6cc70654c
commit 685d1c413a
1 changed files with 14 additions and 8 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: securelevel,v 1.2 2000/09/06 01:05:43 lukem Exp $
# $NetBSD: securelevel,v 1.3 2002/03/01 17:58:00 mrg Exp $
#
# PROVIDE: securelevel
@ -14,15 +14,21 @@ stop_cmd=":"
securelevel_start()
{
# if $securelevel is set, change it here, else if it is 0,
# change it to 1 here, before we start daemons or login services.
# 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.
#
if [ -n "$securelevel" ]; then
echo -n "Setting securelevel: "
sysctl -w kern.securelevel=$securelevel
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
securelevel=`sysctl -n kern.securelevel`
if [ x"$securelevel" = x0 ]; then
if [ "$osecurelevel" = 0 ]; then
echo -n "Setting securelevel: "
sysctl -w kern.securelevel=1
fi