Patchwork [1/5] initscripts: bootmisc.sh: Make sysctl -p honor VERBOSE

login
register
mail settings
Submitter Ben Shelton
Date July 16, 2014, 8:59 p.m.
Message ID <47a6fa0baf855ec8ffa563f01ea97a46e116648c.1405542432.git.ben.shelton@ni.com>
Download mbox | patch
Permalink /patch/75863/
State New
Headers show

Comments

Ben Shelton - July 16, 2014, 8:59 p.m.
From: Richard Tollerton <rich.tollerton@ni.com>

busybox sysctl may lack the "-q" setting, so simulate it with redirects.

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
---
 meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Saul Wold - July 16, 2014, 10:10 p.m.
On 07/16/2014 01:59 PM, Ben Shelton wrote:
> From: Richard Tollerton <rich.tollerton@ni.com>
>
> busybox sysctl may lack the "-q" setting, so simulate it with redirects.
>
> Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
> Signed-off-by: Ben Shelton <ben.shelton@ni.com>
> ---
>   meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
> index 3b5a47f..5211824 100755
> --- a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
> @@ -36,7 +36,12 @@ if [ -f "${SYSCTL_CONF}" ]
>   then
>   	if [ -x "/sbin/sysctl" ]
>   	then
> -		/sbin/sysctl -p "${SYSCTL_CONF}"
> +		# busybox sysctl does not support -q

Will this work if procps's sysctl is used instead, I think it will but 
wanted to verify it.

Sau!

> +		VERBOSE_REDIR="1>/dev/null"
> +		if [ "${VERBOSE}" != "no" ]; then
> +			VERBOSE_REDIR="1>&1"
> +		fi
> +		eval /sbin/sysctl -p "${SYSCTL_CONF}" $VERBOSE_REDIR
>   	else
>   		echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>."
>   	fi
>
Ben Shelton - July 17, 2014, 3:02 p.m.
On 07/16, Saul Wold wrote:
> On 07/16/2014 01:59 PM, Ben Shelton wrote:
> >From: Richard Tollerton <rich.tollerton@ni.com>
> >
> >busybox sysctl may lack the "-q" setting, so simulate it with redirects.
> >
> >Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
> >Signed-off-by: Ben Shelton <ben.shelton@ni.com>
> >---
> >  meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> >diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
> >index 3b5a47f..5211824 100755
> >--- a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
> >+++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
> >@@ -36,7 +36,12 @@ if [ -f "${SYSCTL_CONF}" ]
> >  then
> >  	if [ -x "/sbin/sysctl" ]
> >  	then
> >-		/sbin/sysctl -p "${SYSCTL_CONF}"
> >+		# busybox sysctl does not support -q
> 
> Will this work if procps's sysctl is used instead, I think it will
> but wanted to verify it.
> 
> Sau!
> 

Yes, it will work.  I just installed the procps package on an ARM target
and verified that the output is as expected for both settings of
VERBOSE.

Best,
Ben

> >+		VERBOSE_REDIR="1>/dev/null"
> >+		if [ "${VERBOSE}" != "no" ]; then
> >+			VERBOSE_REDIR="1>&1"
> >+		fi
> >+		eval /sbin/sysctl -p "${SYSCTL_CONF}" $VERBOSE_REDIR
> >  	else
> >  		echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>."
> >  	fi
> >

Patch

diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
index 3b5a47f..5211824 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
@@ -36,7 +36,12 @@  if [ -f "${SYSCTL_CONF}" ]
 then
 	if [ -x "/sbin/sysctl" ]
 	then
-		/sbin/sysctl -p "${SYSCTL_CONF}"
+		# busybox sysctl does not support -q
+		VERBOSE_REDIR="1>/dev/null"
+		if [ "${VERBOSE}" != "no" ]; then
+			VERBOSE_REDIR="1>&1"
+		fi
+		eval /sbin/sysctl -p "${SYSCTL_CONF}" $VERBOSE_REDIR
 	else
 		echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>."
 	fi