mirror of
https://github.com/YunoHost-Apps/vikunja_ynh.git
synced 2024-09-03 18:06:26 +02:00
92 lines
3 KiB
Bash
92 lines
3 KiB
Bash
#!/bin/bash
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
|
|
timezone="$(cat /etc/timezone)"
|
|
secret=$(ynh_string_random --length=32)
|
|
redis_db=$(ynh_redis_get_free_db)
|
|
|
|
#=================================================
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
#=================================================
|
|
ynh_script_progression "Ensuring downward compatibility..."
|
|
|
|
ynh_app_setting_set_default --key=set_motd --value=""
|
|
|
|
ynh_app_setting_set_default --key=enable_registration --value="true"
|
|
|
|
ynh_app_setting_set_default --key=enable_linksharing --value="true"
|
|
|
|
ynh_app_setting_set_default --key=enable_taskattachments --value="true"
|
|
|
|
ynh_app_setting_set_default --key=enable_taskcomments --value="true"
|
|
|
|
ynh_app_setting_set_default --key=enable_emailreminders --value="true"
|
|
|
|
ynh_app_setting_set_default --key=enable_userdeletion --value="true"
|
|
|
|
ynh_app_setting_set_default --key=maxavatarsize --value=1024
|
|
|
|
ynh_app_setting_set_default --key=maxitemsperpage --value=50
|
|
|
|
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"
|
|
fi
|
|
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression "Stopping $app's systemd service..."
|
|
|
|
ynh_systemctl --service=$app --action=stop --log_path=systemd
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression "Upgrading source files..."
|
|
|
|
ynh_setup_source --dest_dir="$install_dir" --full_replace
|
|
executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")"
|
|
mv "$executable" "$install_dir/vikunja"
|
|
|
|
chmod +x "$install_dir/vikunja"
|
|
|
|
#=================================================
|
|
# UPDATE A CONFIG FILE
|
|
#=================================================
|
|
ynh_script_progression "Updating $app's configuration files..."
|
|
|
|
ynh_config_add --template="config.yml" --destination="$install_dir/config.yml"
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
|
|
|
ynh_config_add_nginx
|
|
|
|
ynh_config_add_systemd
|
|
|
|
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..."
|
|
|
|
ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="server started on"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Upgrade of $app completed"
|