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

Fix packaging v2 migration (#18)

This commit is contained in:
tituspijean 2024-05-07 21:16:37 +02:00
parent 1e1140f8a3
commit c6389c1123
No known key found for this signature in database
GPG key ID: EF3B0D7CC0A94720
5 changed files with 16 additions and 5 deletions

View file

@ -10,7 +10,7 @@ location __PATH__ {
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection; proxy_set_header Connection $http_connection;
# Allow the Radarr API # Allow the Sonarr API
location __PATH__/api { location __PATH__/api {
auth_request off; auth_request off;
proxy_pass http://127.0.0.1:__PORT____PATH__/api; proxy_pass http://127.0.0.1:__PORT____PATH__/api;

View file

@ -57,7 +57,6 @@ ram.runtime = "50M"
[resources.install_dir] [resources.install_dir]
[resources.data_dir] [resources.data_dir]
dir = "/var/lib/__APP__"
[resources.ports] [resources.ports]

View file

@ -32,7 +32,7 @@ chown -R "$app:$app" "$install_dir"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring Radarr..." --weight=2 ynh_script_progression --message="Configuring Sonarr..." --weight=2
mkdir -p "/var/log/$app" mkdir -p "/var/log/$app"
ln -s "/var/log/$app" "$data_dir/logs" ln -s "/var/log/$app" "$data_dir/logs"

View file

@ -23,6 +23,15 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fixes specific to packaging v2 migration
if ynh_compare_current_package_version --comparison le --version 3.0.6.1196~ynh3
then
# In packaging v1, final_path=/var/lib/$app but actually held the data. No data_dir was defined
# Upon migration, the core moves /var/lib/$app to /var/www/$app, so let's move it to the data_dir
ynh_print_warn --message="Fix manivest v2 migration: moving contents of $install_dir to $data_dir... (this may take a while)"
mv $install_dir/* $data_dir
fi
if [ ! -L "$data_dir/logs" ]; then if [ ! -L "$data_dir/logs" ]; then
ynh_secure_remove --file="$data_dir/logs" ynh_secure_remove --file="$data_dir/logs"
ln -s "/var/log/$app" "$data_dir/logs" ln -s "/var/log/$app" "$data_dir/logs"

View file

@ -8,8 +8,11 @@ test_format = 1.0
# Default args to use for install # Default args to use for install
# ------------------------------- # -------------------------------
args.admin="john"
# ------------ # ------------
# Tests to run # Tests to run
# ------------ # ------------
test_upgrade_from.768c1ce.name = "Upgrade from 3.0.6.1196~ynh3 (packaging v1)"
test_upgrade_from.768c1ce.args.domain = "domain.tld"
test_upgrade_from.768c1ce.args.path = "/sonarr"
test_upgrade_from.768c1ce.args.admin = "package_checker"