From 5f57eb6b464430e832494e7efa79791105e4d40f Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Tue, 22 Aug 2023 16:54:22 +0200 Subject: [PATCH 01/10] upgrade to v0.7.7 --- .manifest.toml.swp | Bin 0 -> 1024 bytes conf/appsettings.json.example | 3 ++- manifest.toml | 14 +++++++------- scripts/change_url | 8 ++++---- scripts/install | 10 +++++----- scripts/remove | 4 ++-- scripts/restore | 8 ++++---- scripts/upgrade | 12 ++++++------ 8 files changed, 30 insertions(+), 29 deletions(-) create mode 100644 .manifest.toml.swp diff --git a/.manifest.toml.swp b/.manifest.toml.swp new file mode 100644 index 0000000000000000000000000000000000000000..1af9b14b3cc1654fc460ccbbe65f395237a36702 GIT binary patch literal 1024 zcmYc?$V<%2S1{ExVL$/dev/null +if ynh_exec_warn_less yunohost service status "$app" >/dev/null then ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app + yunohost service remove "$app" fi # Remove the dedicated systemd config diff --git a/scripts/restore b/scripts/restore index 6d9970a..7a44c5a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -19,7 +19,7 @@ ynh_restore_file --origin_path="$install_dir" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app":www-data "$install_dir" #================================================= # RESTORE SYSTEM CONFIGURATIONS @@ -29,16 +29,16 @@ ynh_script_progression --message="Restoring system configurations related to $ap ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet +systemctl enable "$app".service --quiet -yunohost service add $app --description="Cross platform reading server" --log="/var/log/$app/$app.log" +yunohost service add "$app" --description="Cross platform reading server" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 02663c1..3ee5675 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,7 +22,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -37,8 +37,8 @@ then fi chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" -chmod +x $install_dir/Kavita +chown -R "$app":www-data "$install_dir" +chmod +x "$install_dir"/Kavita #================================================= # MODIFY A CONFIG FILE @@ -50,7 +50,7 @@ url_path=${path#/} ynh_add_config --template="../conf/appsettings.json.example" --destination="$install_dir/config/appsettings.json" chmod 600 "$install_dir/config/appsettings.json" -chown $app:$app "$install_dir/config/appsettings.json" +chown "$app":"$app" "$install_dir/config/appsettings.json" #================================================= # REAPPLY SYSTEM CONFIGURATIONS @@ -66,14 +66,14 @@ ynh_add_systemd_config # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -yunohost service add $app --description="Cross platform reading server" --log="/var/log/$app/$app.log" +yunohost service add "$app" --description="Cross platform reading server" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT From 12ee4c421e00d71a0a6d8a5e0add2a10cf16246b Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Tue, 22 Aug 2023 17:07:10 +0200 Subject: [PATCH 02/10] oupsi --- .manifest.toml.swp | Bin 1024 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .manifest.toml.swp diff --git a/.manifest.toml.swp b/.manifest.toml.swp deleted file mode 100644 index 1af9b14b3cc1654fc460ccbbe65f395237a36702..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 zcmYc?$V<%2S1{ExVL$ Date: Tue, 22 Aug 2023 17:32:13 +0200 Subject: [PATCH 03/10] fix data config not kept between updates --- scripts/change_url | 3 +++ scripts/install | 5 ++++- scripts/upgrade | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index c646e62..6d7e713 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,8 +32,11 @@ ynh_change_url_nginx_config #================================================= ynh_backup_if_checksum_is_different --file="$install_dir/config/appsettings.json" +key=$(ynh_app_setting_get --app="$app" --key=key) domain="$new_domain" +ynh_app_setting_set --app="$app" --key=domain --value="$domain" url_path=${new_path#/} +ynh_app_setting_set --app="$app" --key=url_path --value="$url_path" ynh_add_config --template="../conf/appsettings.json.example" --destination="$install_dir/config/appsettings.json" diff --git a/scripts/install b/scripts/install index e012aa5..857975b 100755 --- a/scripts/install +++ b/scripts/install @@ -39,8 +39,11 @@ yunohost service add "$app" --description="Cross platform reading server" --log= #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 -key=$(ynh_string_random --length=24) +key=$(ynh_string_random --length=70) +ynh_app_setting_set --app="$app" --key=key --value="$key" url_path=${path#/} +ynh_app_setting_set --app="$app" --key=url_path --value="$url_path" + ynh_add_config --template="../conf/appsettings.json.example" --destination="$install_dir/config/appsettings.json" chmod 600 "$install_dir/config/appsettings.json" diff --git a/scripts/upgrade b/scripts/upgrade index 3ee5675..40b2919 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -45,7 +45,14 @@ chmod +x "$install_dir"/Kavita #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 -key=$(ynh_string_random --length=24) +key=$(ynh_app_setting_get --app="$app" --key=storage_s3_bucket) + +if [ -z "$key" ] || [ "$key" == "super secret unguessable key that is longer because we require it" ] +then + key=$(ynh_string_random --length=70) + ynh_app_setting_set --app="$app" --key=key --value="$key" +fi + url_path=${path#/} ynh_add_config --template="../conf/appsettings.json.example" --destination="$install_dir/config/appsettings.json" From b553bb01f054258127f17050ce999f26c57c294c Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Tue, 22 Aug 2023 17:33:45 +0200 Subject: [PATCH 04/10] forgotten url_path --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 40b2919..7ca559a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -54,6 +54,8 @@ then fi url_path=${path#/} +ynh_app_setting_set --app="$app" --key=url_path --value="$url_path" + ynh_add_config --template="../conf/appsettings.json.example" --destination="$install_dir/config/appsettings.json" chmod 600 "$install_dir/config/appsettings.json" From b2ad933bc5cd97cb5f68e4b0af5e92a8d8d6fac7 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Tue, 22 Aug 2023 20:10:21 +0200 Subject: [PATCH 05/10] fix variable --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 7ca559a..4d49ea2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -45,7 +45,7 @@ chmod +x "$install_dir"/Kavita #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 -key=$(ynh_app_setting_get --app="$app" --key=storage_s3_bucket) +key=$(ynh_app_setting_get --app="$app" --key=key) if [ -z "$key" ] || [ "$key" == "super secret unguessable key that is longer because we require it" ] then From e9abb18813d7e6da8c60c34bc458cb6055540618 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Tue, 22 Aug 2023 20:13:19 +0200 Subject: [PATCH 06/10] getting url_path properly --- scripts/upgrade | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 4d49ea2..2736172 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -53,8 +53,7 @@ then ynh_app_setting_set --app="$app" --key=key --value="$key" fi -url_path=${path#/} -ynh_app_setting_set --app="$app" --key=url_path --value="$url_path" +url_path=$(ynh_app_setting_get --app="$app" --key=url_path) ynh_add_config --template="../conf/appsettings.json.example" --destination="$install_dir/config/appsettings.json" From d2268c03dfbab9b9055defa0b2125d282cdae0ea Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Tue, 22 Aug 2023 20:36:18 +0200 Subject: [PATCH 07/10] activate auto-update on latest_github_release --- manifest.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manifest.toml b/manifest.toml index 59fb15a..f5c27a2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -50,6 +50,9 @@ ram.runtime = "50M" armhf.url = "https://github.com/Kareadita/Kavita/releases/download/v0.7.7/kavita-linux-arm.tar.gz" armhf.sha256 = "283fc142ea9b281c2242dfe7e54774ce273d8990b8f0418dd90ec5bcac85e624" + # https://yunohost.org/fr/packaging_apps_resources#regarding-autoupdate + autoupdate.strategy = "latest_github_release" + [resources.ports] main.default = 5000 From 6f14938e7b32dc3330ee033d67e65caa1090cea9 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Tue, 22 Aug 2023 21:56:03 +0200 Subject: [PATCH 08/10] fix url_path storage --- scripts/upgrade | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 2736172..873d568 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,6 +55,11 @@ fi url_path=$(ynh_app_setting_get --app="$app" --key=url_path) +if [ -z "$url_path" ]; then + url_path=${path#/} + ynh_app_setting_set --app="$app" --key=url_path --value="$url_path" +fi + ynh_add_config --template="../conf/appsettings.json.example" --destination="$install_dir/config/appsettings.json" chmod 600 "$install_dir/config/appsettings.json" From ed06e0f5b53ab8edfd6511c41dee7cfd2ab72311 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 23 Aug 2023 06:20:07 +0200 Subject: [PATCH 09/10] keep config file while unpacking sources --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 873d568..a308897 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,7 +33,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="config" + ynh_setup_source --dest_dir="$install_dir" --keep="$install_dir/config/appsettings.json" fi chmod -R o-rwx "$install_dir" From 3878ed458350450fa6064c1d9ecf4a31df2fcd4c Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 23 Aug 2023 06:43:13 +0200 Subject: [PATCH 10/10] second attempt to keep config file while upgrading --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index a308897..87211f5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,7 +33,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="$install_dir/config/appsettings.json" + ynh_setup_source --dest_dir="$install_dir" --keep="config/appsettings.json" fi chmod -R o-rwx "$install_dir"