From 00747f7b97e68df3a475601606e7e403551d36d8 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 15 Oct 2021 15:59:50 +0800 Subject: [PATCH] rclone: fix logic err in service file - Corrected `enable` detection. - Granted config/log write permission for `rclone` user. Fixes: d51823988847fc ("rclone: initial package") Signed-off-by: Tianling Shen --- net/rclone/files/rclone.init | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/rclone/files/rclone.init b/net/rclone/files/rclone.init index 93ca19ff63..51c0060f70 100755 --- a/net/rclone/files/rclone.init +++ b/net/rclone/files/rclone.init @@ -21,8 +21,8 @@ start_service() { config_load "${CONFIGURATION}" local enabled - config_get enabled global enabled - if [ "$enabled" = "1" ]; then + config_get_bool enabled global enabled + if [ "$enabled" -ne "1" ]; then _info 'Instance "rclone" is disabled.' return 1 else @@ -43,7 +43,7 @@ start_service() { config_get username config username config_get password config password - config_get proxy_enable proxy enabled + config_get_bool proxy_enable proxy enabled config_get proxy_addr proxy proxy_addr if [ "${addr_type}" = "local" ]; then @@ -56,12 +56,15 @@ start_service() { local config_dir="${config_path%/*}" [ -d "$config_dir" ] || mkdir -p "$config_dir" + touch "${config_path}" + chown rclone "${config_path}" [ -d "/lib/upgrade/keep.d" ] || mkdir -p "/lib/upgrade/keep.d/" echo "$config_path" > "/lib/upgrade/keep.d/luci-app-rclone" local log_dir="${log_path%/*}" [ -d "$log_dir" ] || mkdir -p "$log_dir" + chown -R rclone:rclone "$log_dir" procd_open_instance @@ -71,7 +74,7 @@ start_service() { procd_append_param command "--config=$config_path" procd_append_param command "--rc-allow-origin=*" procd_append_param command "--log-file=${log_path}" - if [ "${proxy_enable}" = "1" ]; then + if [ "${proxy_enable}" -eq "1" ]; then procd_set_param env all_proxy="$proxy_addr" https_proxy="$proxy_addr" http_proxy="$proxy_addr" procd_append_param env ALL_PROXY="$proxy_addr" HTTPS_PROXY="$proxy_addr" HTTP_PROXY="$proxy_addr" fi -- 2.30.2