1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jackett_ynh.git synced 2024-09-03 19:26:28 +02:00

Use jq instead of sed

This commit is contained in:
Salamandar 2024-02-25 22:20:47 +01:00
parent 49f103ac3d
commit 6eb67133aa
2 changed files with 7 additions and 6 deletions

View file

@ -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
#=================================================

View file

@ -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