From: Sergey Ponomarev Date: Sat, 15 Jul 2023 14:27:39 +0000 (+0300) Subject: tor-hs: tor-hs.init handle_hs_ports_conf split ports X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=c709e7a09feef4e0bb8033c3c4d671d41e8cfe4f;p=openwrt-packages.git tor-hs: tor-hs.init handle_hs_ports_conf split ports Using substring instead of awk. It changes behaviour when only one port is specified. Previously: value="80" => public="80" local="" Now: value="80" => public="80" local="80" It simplifies configuration of one-to-one ports. Signed-off-by: Sergey Ponomarev --- diff --git a/net/tor-hs/files/tor-hs.init b/net/tor-hs/files/tor-hs.init index 7486bb7fa..28cbeca38 100755 --- a/net/tor-hs/files/tor-hs.init +++ b/net/tor-hs/files/tor-hs.init @@ -43,8 +43,8 @@ handle_hs_ports_conf() { local value="$1" local ipv4="$2" - public_port=$(echo "$value"|awk -F';' '{print $1}') - local_port=$(echo "$value"|awk -F';' '{print $2}') + public_port="${value#*;}" + local_port="${value%;*}" echo "HiddenServicePort $public_port $ipv4:$local_port">>$TORRC_FILE }