From: Bart vdr. Meulen <bartvdrmeu...@gmail.com>

Add sysctl.conf to busybox configuration

Add option to install an generic, or project specific sysctl.conf file on the
target filesystem.
Also add the option to read the file during boot-time

Signed-of-by: Bart vdr. Meulen <bartvdrmeu...@gmail.com>
---
 config/busybox/procps/Config.in |   14 ++++++++++++++
 generic/etc/init.d/sysctl       |   23 +++++++++++++++++++++++
 rules/busybox.make              |    8 ++++++++
 rules/initmethod-bbinit.in      |    6 ++++++
 rules/initmethod-bbinit.make    |    6 ++++++
 5 files changed, 57 insertions(+), 0 deletions(-)
 create mode 100644 generic/etc/init.d/sysctl

diff --git a/config/busybox/procps/Config.in b/config/busybox/procps/Config.in
index 32ddf23..7c51c6b 100644
--- a/config/busybox/procps/Config.in
+++ b/config/busybox/procps/Config.in
@@ -134,6 +134,20 @@ config BUSYBOX_BB_SYSCTL
        help
          Configure kernel parameters at runtime.
 
+config BUSYBOX_BB_SYSCTL_FEATURE_CONFIG
+       bool "Install /etc/sysctl.conf"
+       default n
+       depends on BUSYBOX_BB_SYSCTL
+       help
+         Install the /etc/sysctl.conf file.
+
+config BUSYBOX_BB_SYSCTL_FEATURE_STARTSCRIPT
+       bool "Install /etc/init.d/sysctl"
+       default n
+       depends on BUSYBOX_BB_SYSCTL
+       help
+         Install a start script to read /etc/sysctl.conf at startup
+
 config BUSYBOX_TOP
        bool "top"
        default n
diff --git a/generic/etc/init.d/sysctl b/generic/etc/init.d/sysctl
new file mode 100644
index 0000000..d23f9d5
--- /dev/null
+++ b/generic/etc/init.d/sysctl
@@ -0,0 +1,23 @@
+#! /bin/sh
+# /etc/init.d/sysctl: Set kernel variables from /etc/sysctl.conf
+#
+
+PATH=/sbin:$PATH
+which sysctl > /dev/null || exit 0
+
+case "$1" in
+       start|restart|force-reload)
+               for file in /etc/sysctl.conf /etc/sysctl.d/*.conf ; do
+                       if [ -r "$file" ] ; then
+                               sysctl -p "$file" > /dev/null 2>&1
+                       fi
+               done
+               ;;
+       stop)
+               ;;
+       *)
+               echo "Usage: /etc/init.d/sysctl 
{start|stop|restart|force-reload}" >&2
+               exit 3
+               ;;
+esac
+exit 0
diff --git a/rules/busybox.make b/rules/busybox.make
index 1616ab1..7fcc55e 100644
--- a/rules/busybox.make
+++ b/rules/busybox.make
@@ -135,6 +135,10 @@ endif
 ifdef PTXCONF_BUSYBOX_HWCLOCK_STARTSCRIPT
        @$(call install_alternative, busybox, 0, 0, 0755, /etc/init.d/hwclock)
 endif
+
+ifdef PTXCONF_BUSYBOX_BB_SYSCTL_FEATURE_STARTSCRIPT
+       @$(call install_alternative, busybox, 0, 0, 0755, /etc/init.d/sysctl)
+endif
 endif # PTXCONF_INITMETHOD_BBINIT
 
 #      #
@@ -151,6 +155,10 @@ ifdef PTXCONF_BUSYBOX_CROND
        @$(call install_copy, busybox, 0, 0, 0755, /var/spool/cron/crontabs/)
 endif
 
+ifdef PTXCONF_BUSYBOX_BB_SYSCTL_FEATURE_CONFIG
+       @$(call install_alternative, busybox, 0, 0, 0755, /etc/sysctl.conf)
+endif
+
        @$(call install_finish, busybox)
 
        @$(call touch)
diff --git a/rules/initmethod-bbinit.in b/rules/initmethod-bbinit.in
index 4012924..a7f1147 100644
--- a/rules/initmethod-bbinit.in
+++ b/rules/initmethod-bbinit.in
@@ -297,6 +297,12 @@ config INITMETHOD_BBINIT_LINK_LVM2
        prompt "lvm2"
        default "S20lvm2"
 
+config INITMETHOD_BBINIT_LINK_SYSCTL
+       string
+       depends on BUSYBOX_BB_SYSCTL_FEATURE_STARTSCRIPT
+       prompt "sysctl"
+       default "S17sysctl"
+
 endmenu
 
 endif
diff --git a/rules/initmethod-bbinit.make b/rules/initmethod-bbinit.make
index c8540cd..d435fcb 100644
--- a/rules/initmethod-bbinit.make
+++ b/rules/initmethod-bbinit.make
@@ -363,6 +363,12 @@ ifneq ($(call 
remove_quotes,$(PTXCONF_INITMETHOD_BBINIT_LINK_LVM2)),)
                /etc/rc.d/$(PTXCONF_INITMETHOD_BBINIT_LINK_LVM2))
 endif
 
+ifneq ($(call remove_quotes,$(PTXCONF_INITMETHOD_BBINIT_LINK_SYSCTL)),)
+       @$(call install_link, initmethod-bbinit, \
+               ../init.d/sysctl, \
+               /etc/rc.d/$(PTXCONF_INITMETHOD_BBINIT_LINK_SYSCTL))
+endif
+
 ifneq ($(call remove_quotes,$(PTXCONF_INITMETHOD_BBINIT_LINK_FAKE_OVERLAYFS)),)
        @$(call install_link, initmethod-bbinit, \
                ../init.d/fake-overlayfs, \
-- 
1.7.0.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to