[v2,09/13] package/openrc: add patch to supportbusybox version of sysctl
diff mbox series

Message ID 20190512195550.24457-9-michal.lyszczek@bofc.pl
State Accepted
Headers show
Series
  • [v2,01/13] package/openrc: new package (v0.41.2)
Related show

Commit Message

Michał Łyszczek May 12, 2019, 7:55 p.m. UTC
Busybox version of sysctl does not support --system argument, and
files need to be loaded one by one. This patch adds code to sysctl
service in openrc to recognize busybox sysctl and execute proper
function based on that.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>

---
Changes v1 -> v2
  None
---
 ...tl.in-add-support-for-busybox-sysctl.patch | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch

Comments

Thomas Petazzoni May 18, 2019, 9:25 p.m. UTC | #1
On Sun, 12 May 2019 21:55:46 +0200
Michał Łyszczek <michal.lyszczek@bofc.pl> wrote:

> Busybox version of sysctl does not support --system argument, and
> files need to be loaded one by one. This patch adds code to sysctl
> service in openrc to recognize busybox sysctl and execute proper
> function based on that.
> 
> Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
> 
> ---
> Changes v1 -> v2
>   None
> ---
>  ...tl.in-add-support-for-busybox-sysctl.patch | 66 +++++++++++++++++++
>  1 file changed, 66 insertions(+)
>  create mode 100644 package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch

Applied to next, thanks. Please submit this patch to upstream OpenRC if
not already done. Thanks!

Thomas

Patch
diff mbox series

diff --git a/package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch b/package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch
new file mode 100644
index 0000000000..da8cf042c6
--- /dev/null
+++ b/package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch
@@ -0,0 +1,66 @@ 
+From ec1a0c8fa2e7a7c6cf70f68bdabc07cbb1a567cf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20=C5=81yszczek?= <michal.lyszczek@bofc.pl>
+Date: Sun, 5 May 2019 23:43:40 +0200
+Subject: [PATCH] init.d/sysctl.in: add support for busybox sysctl
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Busybox version of sysctl does not support --system argument,
+and files need to be loaded one by one. This patch adds code
+to recognize busybox sysctl and execute proper function based
+on that.
+
+Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
+---
+ init.d/sysctl.in | 27 ++++++++++++++++++++++++++-
+ 1 file changed, 26 insertions(+), 1 deletion(-)
+
+diff --git a/init.d/sysctl.in b/init.d/sysctl.in
+index e49f4db2..a705b3d4 100644
+--- a/init.d/sysctl.in
++++ b/init.d/sysctl.in
+@@ -37,6 +37,23 @@ BSD_sysctl()
+ 	return $retval
+ }
+ 
++Busybox_sysctl()
++{
++	local quiet
++	yesno $rc_verbose || quiet=-q
++
++	eindent
++	for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
++		if [ -r "$conf" ]; then
++			vebegin "applying $conf"
++			sysctl $quiet -p "$conf" || retval=1
++			veend $retval
++		fi
++	done
++	eoutdent
++	return $retval
++}
++
+ Linux_sysctl()
+ {
+ 	local quiet
+@@ -52,7 +69,15 @@ start()
+ 	ebegin "Configuring kernel parameters"
+ 	case "$RC_UNAME" in
+ 	*BSD|GNU) BSD_sysctl; rc=$? ;;
+-	Linux) Linux_sysctl; rc=$? ;;
++	Linux)
++		sysctl -h > /dev/null 2>&1
++		if [ $? -ne 0 ]; then
++			# busybox version of sysctl does not recognize -h option
++			Busybox_sysctl
++		else
++			Linux_sysctl
++		fi
++		rc=$? ;;
+ 	esac
+ 	eend $rc "Unable to configure some kernel parameters"
+ }
+-- 
+2.18.1
+