Closed stokito closed 2 years ago
Another option would be print by line:
Index: openwrt/kadnode/files/kadnode.init
===================================================================
diff --git a/openwrt/kadnode/files/kadnode.init b/openwrt/kadnode/files/kadnode.init
--- a/openwrt/kadnode/files/kadnode.init
+++ b/openwrt/kadnode/files/kadnode.init
@@ -14,8 +14,7 @@
xappend() {
local name="$2" value="$1"
- OPTS="$OPTS--${name//_/-} ${value//'/\\'}
-"
+ echo "--${name//_/-} ${value//'/\\'}" >> $CONFIG_FILE
}
append_opts_list() {
@@ -49,12 +48,11 @@
start_instance() {
local cfg="$1"
local CONFIG_FILE=/tmp/kadnode.${cfg}.conf
+ rm -f $CONFIG_FILE
section_enabled "$cfg" || return
. /lib/functions/network.sh
- OPTS=""
-
append_opts "$cfg" lpd_addr dns_server dns_port verbosity peerfile config \
query_tld user port cmd_port
@@ -74,8 +72,6 @@
xappend "" "cmd_disable_stdin"
fi
- echo "$OPTS" > $CONFIG_FILE
-
procd_open_instance
procd_set_param command $PROG
procd_set_param file $CONFIG_FILE
If this is a problem, then you can use \n
instead of |
and then use echo -e
to turn \n
into newlines.
I tried before but added to end and it didn't worked for a some reason.
OPTS="$OPTS--${name//_/-} ${value//'/\\'}\n"
The same was for the pipe. I moved the pipe to begin and it finally worked. I have no idea why it doesn't work when at the end.
Now I tried again the \n but in the begin and it worked. Force pushed, please merge and release a new version
I have been able to confirm the error and your fix.
Could you please change the commit message to openwrt: fix newline in config file
? Then I can merge it right away.
done
Changes are updated here: https://github.com/openwrt/packages/pull/19737 A new kadnode release takes a bit of time.
BTW why do the temp config is created instead of just passing these options to the program itself? The uhttpd and emailrelay just read opts but can additionally read them from a config file.
True, it does not matter.
The kadnode doesn't start on OpenWrt because it's generates a file where all options are written into a single line.
We can't store a newline to the OPTS var. But without the newline config parsing is failed. The simplest fix is to use | instead of \n but then replace it on printing