diff mbox

[OpenWrt-Devel] sysctl: read settings from /etc/sysctl.d/*.conf

Message ID 20150527092317.GT26331@zirkel.wertarbyte.de
State Superseded
Headers show

Commit Message

Stefan Tomanek May 27, 2015, 9:23 a.m. UTC
This changes makes it possible to store custom settings
in individual files inside the directory /etc/sysctl.d/,
which take precedence over /etc/sysctl.conf.

Signed-off-by: Stefan Tomanek <stefan.tomanek+openwrt@wertarbyte.de>
---
 package/base-files/files/etc/init.d/sysctl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Jonathan Thibault May 27, 2015, 1:52 p.m. UTC | #1
You might want to adjust the hotplug script too.

On 27/05/15 05:23 AM, Stefan Tomanek wrote:
> This changes makes it possible to store custom settings
> in individual files inside the directory /etc/sysctl.d/,
> which take precedence over /etc/sysctl.conf.
>
> Signed-off-by: Stefan Tomanek <stefan.tomanek+openwrt@wertarbyte.de>
> ---
>  package/base-files/files/etc/init.d/sysctl |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/package/base-files/files/etc/init.d/sysctl b/package/base-files/files/etc/init.d/sysctl
> index 36e29ea..2dfbaf7 100755
> --- a/package/base-files/files/etc/init.d/sysctl
> +++ b/package/base-files/files/etc/init.d/sysctl
> @@ -3,5 +3,7 @@
>  
>  START=11
>  start() {
> -	[ -f /etc/sysctl.conf ] && sysctl -p -e >&-
> +	for CONF in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
> +		[ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
> +	done
>  }
diff mbox

Patch

diff --git a/package/base-files/files/etc/init.d/sysctl b/package/base-files/files/etc/init.d/sysctl
index 36e29ea..2dfbaf7 100755
--- a/package/base-files/files/etc/init.d/sysctl
+++ b/package/base-files/files/etc/init.d/sysctl
@@ -3,5 +3,7 @@ 
 
 START=11
 start() {
-	[ -f /etc/sysctl.conf ] && sysctl -p -e >&-
+	for CONF in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
+		[ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
+	done
 }