From: Sergey Ponomarev Date: Wed, 7 Feb 2024 18:59:33 +0000 (+0200) Subject: tor-hs: create hs folder only if not exists X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=2f505ed7d8e3c2afcc931cc47886d905f14207cb;p=openwrt-packages.git tor-hs: create hs folder only if not exists Previously the chown/chmod was performed each time even if the folder already existed. Signed-off-by: Sergey Ponomarev --- diff --git a/net/tor-hs/files/tor-hs.init b/net/tor-hs/files/tor-hs.init index eb909480f..33e3b1a63 100755 --- a/net/tor-hs/files/tor-hs.init +++ b/net/tor-hs/files/tor-hs.init @@ -52,11 +52,12 @@ parse_hs_conf() { config_get ipv4 "$config" IPv4 if [ "$enable_hs" = "1" ]; then - mkdir -p "$HS_DIR_PATH/$name" - chown "$TOR_USER":"$TOR_USER" "$HS_DIR_PATH/" - chown "$TOR_USER:$TOR_USER" "$HS_DIR_PATH/$name" - chmod 700 "$HS_DIR_PATH/" - chmod 700 "$HS_DIR_PATH/$name/" + if [ ! -d "$HS_DIR_PATH/$name" ]; then + echo "New onion service dir is $HS_DIR_PATH/$name" + mkdir -p -m 700 "$HS_DIR_PATH/" + mkdir -m 700 "$HS_DIR_PATH/$name" + chown -R "$TOR_USER:$TOR_USER" "$HS_DIR_PATH/" + fi echo "HiddenServiceDir $HS_DIR_PATH/$name" >> "$TORRC_FILE" config_list_foreach "$config" PublicLocalPort handle_hs_ports_conf "$ipv4"