Author: glen
Date: Wed Jul 17 22:52:15 2013
New Revision: 12700

Modified:
   rc-scripts/trunk/lib/functions
   rc-scripts/trunk/rc.d/init.d/network
   rc-scripts/trunk/rc.d/rc.sysinit
   rc-scripts/trunk/sysctl.conf
Log:
add apply_sysctl() to load sysctl parameters

uses systemd-sysctl(8) to load, if present, otherwise
loads files in same way as systemd-sysctl(8):
/usr/lib/sysctl.d, /run/sysctl.d, /etc/sysctl.d, /etc/sysctl.conf
where matching files from .d files are not loaded

see sysctl.d(5) for description


Modified: rc-scripts/trunk/lib/functions
==============================================================================
--- rc-scripts/trunk/lib/functions      (original)
+++ rc-scripts/trunk/lib/functions      Wed Jul 17 22:52:15 2013
@@ -169,6 +169,29 @@
        return 0
 }
 
+# Apply sysctl settings, including files in /etc/sysctl.d
+apply_sysctl() {
+       if [ -x /lib/systemd/systemd-sysctl ]; then
+               /lib/systemd/systemd-sysctl
+               return
+       fi
+
+       local file
+       for file in /usr/lib/sysctl.d/*.conf; do
+               [ -f /run/sysctl.d/${file##*/} ] && continue
+               [ -f /etc/sysctl.d/${file##*/} ] && continue
+               test -f "$file" && sysctl -q -e -p "$file"
+       done
+       for file in /run/sysctl.d/*.conf; do
+               [ -f /etc/sysctl.d/${file##*/} ] && continue
+               test -f "$file" && sysctl -q -e -p "$file"
+       done
+       for file in /etc/sysctl.d/*.conf; do
+               test -f "$file" && sysctl -q -e -p "$file"
+       done
+       sysctl -q -e -p /etc/sysctl.conf
+}
+
 if is_yes "$FASTRC" || is_yes "$IN_SHUTDOWN"; then
        RC_LOGGING=no
 fi

Modified: rc-scripts/trunk/rc.d/init.d/network
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/network        (original)
+++ rc-scripts/trunk/rc.d/init.d/network        Wed Jul 17 22:52:15 2013
@@ -47,6 +47,9 @@
        # Modprobe needed devices
        modprobe_net
 
+       # load sysctl params
+       apply_sysctl
+
        # Setup interfaces names
        if ! is_empty_file /etc/mactab && [ -x /sbin/nameif ]; then
                run_cmd "Setting interfaces names (nameif)" /sbin/nameif
@@ -87,6 +90,9 @@
 }
 
 network_postinit() {
+       # Run this again to catch any interface-specific actions
+       apply_sysctl
+
        # Set static RARP table
        static_rarp
 

Modified: rc-scripts/trunk/rc.d/rc.sysinit
==============================================================================
--- rc-scripts/trunk/rc.d/rc.sysinit    (original)
+++ rc-scripts/trunk/rc.d/rc.sysinit    Wed Jul 17 22:52:15 2013
@@ -366,7 +366,7 @@
        fi
 
        # Early sysctls
-       sysctl -q -e -p /etc/sysctl.conf
+       apply_sysctl
 
        # sysfs is also needed before any other things (under kernel > 2.5)
        if ! is_fsmounted sysfs /sys; then
@@ -456,9 +456,8 @@
                /sbin/blogd
        fi
 
-       # Configure Linux kernel (initial configuration, some required modules 
still
-       # may be missing).
-       sysctl -q -e -p /etc/sysctl.conf
+       # Configure Linux kernel (initial configuration, some required modules 
still may be missing).
+       apply_sysctl
 
        # Check if timezone definition is available
        if [ -e /etc/localtime ] && [ -e /dev/rtc -o -e /dev/rtc0 ] ; then
@@ -925,7 +924,7 @@
        fi
 
        # ... and here finish configuring parameters
-       sysctl -q -e -p /etc/sysctl.conf
+       apply_sysctl
 else
        emit --no-wait root-filesystem
        emit --no-wait virtual-filesystems

Modified: rc-scripts/trunk/sysctl.conf
==============================================================================
--- rc-scripts/trunk/sysctl.conf        (original)
+++ rc-scripts/trunk/sysctl.conf        Wed Jul 17 22:52:15 2013
@@ -208,7 +208,3 @@
 # for mplayer
 #dev.rtc.max-user-freq = 1024
 #
-
-# protect hard/symlins
-fs.protected_hardlinks = 1
-fs.protected_symlinks = 1
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to