From 13c5a4efdd53445e0d92d71d630402a2a20d689e Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 28 Feb 2011 16:56:40 -0500 Subject: Move sysctl.conf/sysctl.d handling to a function, call it where appropriate. (#593211, continued) --- rc.d/init.d/functions | 9 +++++++++ rc.d/init.d/network | 4 ++-- rc.d/rc.sysinit | 6 +----- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'rc.d') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 17df7382..8df93d06 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -604,6 +604,15 @@ is_false() { return 1 } +# Apply sysctl settings, including files in /etc/sysctl.d +apply_sysctl() { + sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 + for file in /etc/sysctl.d/* ; do + is_ignored_file "$file" && continue + test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1 + done +} + key_is_random() { [ "$1" = "/dev/urandom" -o "$1" = "/dev/hw_random" \ -o "$1" = "/dev/random" ] diff --git a/rc.d/init.d/network b/rc.d/init.d/network index 558b98f7..2cab6860 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -58,7 +58,7 @@ case "$1" in /etc/sysconfig/network-scripts/init.ipv6-global start pre fi - sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 + apply_sysctl # bring up loopback interface action $"Bringing up loopback interface: " ./ifup ifcfg-lo @@ -142,7 +142,7 @@ case "$1" in /etc/sysconfig/network-scripts/init.ipv6-global start post fi # Run this again to catch any interface-specific actions - sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 + apply_sysctl touch /var/lock/subsys/network diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 99c488c3..ecccd21c 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -151,11 +151,7 @@ mount -n /dev/pts >/dev/null 2>&1 # Configure kernel parameters update_boot_stage RCkernelparam -sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 -for file in /etc/sysctl.d/* ; do - is_ignored_file "$file" && continue - test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1 -done +apply_sysctl # Set the hostname. update_boot_stage RChostname -- cgit v1.2.1