summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2002-03-17 20:14:11 +0000
committerdougb <dougb@FreeBSD.org>2002-03-17 20:14:11 +0000
commitffa228092d8f802a7033232a2fd2729576431d6b (patch)
treef7138699f813eeaef053897d02a89ef59ec66f51 /etc
parent02b4c46fb1f879af2191c83af47b3d005d8393cb (diff)
downloadFreeBSD-src-ffa228092d8f802a7033232a2fd2729576431d6b.zip
FreeBSD-src-ffa228092d8f802a7033232a2fd2729576431d6b.tar.gz
Distinguish between first and last passes of rc.sysctl, and only set
mibs whose values are not already what is specified in sysctl.conf.
Diffstat (limited to 'etc')
-rw-r--r--etc/rc5
-rw-r--r--etc/rc.d/sysctl18
-rw-r--r--etc/rc.sysctl18
3 files changed, 36 insertions, 5 deletions
diff --git a/etc/rc b/etc/rc
index db41a8a..763ce47 100644
--- a/etc/rc
+++ b/etc/rc
@@ -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
diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl
index bedddb6..1e315f2 100644
--- a/etc/rc.d/sysctl
+++ b/etc/rc.d/sysctl
@@ -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
diff --git a/etc/rc.sysctl b/etc/rc.sysctl
index bedddb6..1e315f2 100644
--- a/etc/rc.sysctl
+++ b/etc/rc.sysctl
@@ -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
OpenPOWER on IntegriCloud