1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/vikunja_ynh.git synced 2024-09-03 18:06:26 +02:00
vikunja_ynh/scripts/upgrade

93 lines
3 KiB
Text
Raw Normal View History

2021-08-05 17:28:35 +02:00
#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
2023-03-02 19:24:51 +01:00
2021-08-05 17:28:35 +02:00
timezone="$(cat /etc/timezone)"
secret=$(ynh_string_random --length=32)
2023-10-27 09:20:57 +02:00
redis_db=$(ynh_redis_get_free_db)
2021-08-05 17:28:35 +02:00
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
2021-08-05 17:28:35 +02:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=set_motd --value=""
2022-01-16 16:12:55 +01:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=enable_registration --value="true"
2022-01-16 17:00:45 +01:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=enable_linksharing --value="true"
2022-08-20 22:21:33 +02:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=enable_taskattachments --value="true"
2022-08-20 22:21:33 +02:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=enable_taskcomments --value="true"
2022-08-20 22:21:33 +02:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=enable_emailreminders --value="true"
2022-08-20 22:21:33 +02:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=enable_userdeletion --value="true"
2022-08-20 22:21:33 +02:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=maxavatarsize --value=1024
2022-08-20 22:21:33 +02:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=maxitemsperpage --value=50
2022-08-20 22:21:33 +02:00
2024-08-31 09:04:32 +02:00
ynh_app_setting_set_default --key=language --value="en"
if ynh_app_upgrading_from_version_before 0.23.0~ynh1; then
mv "$backend_path/config.yml" "$install_dir/config.yml"
ynh_safe_rm "$backend_path"
ynh_app_setting_delete --key="backend_path"
2023-09-05 14:04:20 +02:00
fi
2021-08-05 17:28:35 +02:00
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
2021-08-05 17:28:35 +02:00
ynh_systemctl --service=$app --action=stop --log_path=systemd
2021-08-05 17:28:35 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
2021-08-05 17:28:35 +02:00
ynh_setup_source --dest_dir="$install_dir" --full_replace
2024-07-29 22:36:41 +02:00
executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")"
2024-07-29 22:52:18 +02:00
mv "$executable" "$install_dir/vikunja"
2021-08-05 17:28:35 +02:00
chmod +x "$install_dir/vikunja"
2021-08-05 17:28:35 +02:00
2022-08-22 20:55:02 +02:00
#=================================================
2024-07-29 22:43:11 +02:00
# UPDATE A CONFIG FILE
2022-08-22 20:55:02 +02:00
#=================================================
ynh_script_progression "Updating $app's configuration files..."
2022-08-22 20:55:02 +02:00
ynh_config_add --template="config.yml" --destination="$install_dir/config.yml"
2022-08-22 20:55:02 +02:00
2021-08-05 17:28:35 +02:00
#=================================================
2024-07-29 22:43:11 +02:00
# REAPPLY SYSTEM CONFIGURATIONS
2021-08-05 17:28:35 +02:00
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
2021-08-05 17:28:35 +02:00
ynh_config_add_nginx
2021-08-05 17:28:35 +02:00
ynh_config_add_systemd
2021-08-05 17:28:35 +02:00
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
2021-08-05 17:28:35 +02:00
ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="server started on"
2021-08-05 17:28:35 +02:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"