From b70c0d73288c754529751acdd3e9552abad726f4 Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Wed, 17 Dec 2014 20:10:42 +0100
Subject: [PATCH] userspace: bugfix in apply-dot-config

The shell we have in the switch, unfortunately, reports variables
in "set" as quoted.  This means we had all our substitutions wrong
in snmpd.conf. This commit removes the quotes, and stuff now works better.

I got this in my syslog, for example:

   /wr/etc/snmpd.conf: line 10: Error: cannot create trapsink: '192.168.16.1'
   getaddrinfo: 'morgana' Name or service not known

Because it had to be "morgana" not "'morgana'", same for IP address.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
 userspace/rootfs_override/wr/bin/apply_dot-config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/userspace/rootfs_override/wr/bin/apply_dot-config b/userspace/rootfs_override/wr/bin/apply_dot-config
index 8194a2dfb..063dd1e09 100755
--- a/userspace/rootfs_override/wr/bin/apply_dot-config
+++ b/userspace/rootfs_override/wr/bin/apply_dot-config
@@ -60,7 +60,7 @@ copy_conf /etc/rsyslog.conf /usr/etc/rsyslog.conf
 
 # Fix SNMP values: for all not-empty configs remove comment and replace value
 cp /wr/etc/snmpd.conf.in $T
-set | grep CONFIG_SNMP | sed 's/=/ /' | while read varname value; do
+set | tr -d \' | grep CONFIG_SNMP | sed 's/=/ /' | while read varname value; do
     if [ -z "$value" ]; then continue; fi
     sed -i "/$varname/ s/^#//" $T
     sed -i "/$varname/ s/$varname/$value/" $T
@@ -69,7 +69,7 @@ copy_conf /wr/etc/snmpd.conf
 
 # Fix log values
 cp /wr/sbin/start-daemons.sh.in $T
-set | grep CONFIG_WRS_LOG | sed 's/=/ /' | while read varname value; do
+set | tr -d \' | grep CONFIG_WRS_LOG | sed 's/=/ /' | while read varname value; do
     if [ -z "$value" ]; then continue; fi
     sed -i "/$varname/ s,$varname,$value," $T
 done
-- 
GitLab