From 6eb67133aa5cef12d91df6f66c2731156c8ad52d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 25 Feb 2024 22:20:47 +0100 Subject: [PATCH] Use jq instead of sed --- scripts/change_url | 6 +++--- scripts/install | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index a06d0a3..5d07d15 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,9 +28,9 @@ ynh_change_url_nginx_config # Change the path in the NGINX config file if [ "$change_path" -eq 1 ]; then - match_string=$(echo \"BasePathOverride\": \"$old_path\") - target_string=$(echo \"BasePathOverride\": \"$new_path\") - sed --in-place "s@${match_string}@${target_string}@g" "$install_dir/.config/Jackett/ServerConfig.json" + jq ".BasePathOverride = \"$path\"" "$install_dir/.config/Jackett/ServerConfig.json" \ + > "$install_dir/.config/Jackett/ServerConfig.json.tmp" + mv "$install_dir/.config/Jackett/ServerConfig.json.tmp" "$install_dir/.config/Jackett/ServerConfig.json" fi #================================================= diff --git a/scripts/install b/scripts/install index 7c0f657..8c78155 100755 --- a/scripts/install +++ b/scripts/install @@ -41,12 +41,13 @@ ynh_use_logrotate ynh_script_progression --message="Configuring Jackett..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Hosting environment: Production" --timeout=30 +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Application started." --timeout=30 # Start a systemd service ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" -target_string=$(echo \"BasePathOverride\": \"$path\") -sed --in-place "s@\"BasePathOverride\": null@${target_string}@g" "$install_dir/.config/Jackett/ServerConfig.json" +jq ".BasePathOverride = \"$path\"" "$install_dir/.config/Jackett/ServerConfig.json" \ + > "$install_dir/.config/Jackett/ServerConfig.json.tmp" +mv "$install_dir/.config/Jackett/ServerConfig.json.tmp" "$install_dir/.config/Jackett/ServerConfig.json" #================================================= # START SYSTEMD SERVICE