1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00

Distinguish between first and last passes of rc.sysctl, and only set

mibs whose values are not already what is specified in sysctl.conf.
This commit is contained in:
Doug Barton 2002-03-17 20:14:11 +00:00
parent 6de2a2e8a5
commit c84f8c0e17
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92516
3 changed files with 36 additions and 5 deletions

5
etc/rc
View File

@ -404,8 +404,7 @@ esac
# Early pass to set the variables we can
#
if [ -r /etc/rc.sysctl ]; then
echo 'Warnings here may be due to modules that have not been loaded yet'
. /etc/rc.sysctl
. /etc/rc.sysctl first
fi
# Configure serial devices
@ -918,7 +917,7 @@ fi
# Late pass to set variables we missed the first time
#
if [ -r /etc/rc.sysctl ]; then
. /etc/rc.sysctl
. /etc/rc.sysctl last
fi
# Raise kernel security level. This should be done only after `fsck' has

View File

@ -38,7 +38,23 @@ if [ -f /etc/sysctl.conf ]; then
\#*|'')
;;
*)
sysctl ${var}
mib=${var%=*}
val=${var#*=}
if current_value=`sysctl -n ${mib} 2>/dev/null`; then
case ${current_value} in
${val}) ;;
*)
sysctl ${var}
;;
esac
else
case ${1} in
last)
echo "Warning: sysctl ${mib} does not exist"
;;
esac
fi
;;
esac
done < /etc/sysctl.conf

View File

@ -38,7 +38,23 @@ if [ -f /etc/sysctl.conf ]; then
\#*|'')
;;
*)
sysctl ${var}
mib=${var%=*}
val=${var#*=}
if current_value=`sysctl -n ${mib} 2>/dev/null`; then
case ${current_value} in
${val}) ;;
*)
sysctl ${var}
;;
esac
else
case ${1} in
last)
echo "Warning: sysctl ${mib} does not exist"
;;
esac
fi
;;
esac
done < /etc/sysctl.conf