1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wekan_ynh.git synced 2024-09-03 20:36:09 +02:00
wekan_ynh/scripts/upgrade

84 lines
2.7 KiB
Text
Raw Normal View History

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _future.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path_url)
is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path)
2017-11-08 21:25:42 +01:00
port=$(ynh_app_setting_get $app port)
#=================================================
# Check version
#=================================================
abort_if_up_to_date
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_backup_before_upgrade # Backup the current version of the app
ynh_clean_setup () {
ynh_restore_upgradebackup # restore it if the upgrade fails
}
ynh_abort_if_errors # Exit if an error occurs during the execution of the script
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
2017-11-08 21:43:16 +01:00
if ynh_version_gt "0.45-2" "${version}" ; then
2017-11-08 21:25:42 +01:00
ynh_replace_string "Environment=ROOT_URL=http://127.0.0.1:$port$path_url" "Environment=ROOT_URL=https://$domain$path_url/" "/etc/systemd/system/$app.service"
systemctl daemon-reload
fi
2017-11-08 21:43:16 +01:00
if ynh_version_gt "0.45-3" "${version}" ; then
2017-11-09 12:13:38 +01:00
yunohost service add $app
2017-11-08 21:43:16 +01:00
fi
if ynh_version_gt "0.54-2" "${version}" ; then
systemctl enable mongod
systemctl restart mongod
fi
2017-12-14 21:55:35 +01:00
if ynh_version_gt "0.54-3" "${version}" ; then
apt-key del EA312927
2017-12-23 00:05:14 +01:00
apt-key adv --fetch-keys https://www.mongodb.org/static/pgp/server-3.2.asc
2017-12-14 21:55:35 +01:00
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
# For this app sources are in app subdirectory
ynh_setup_source "$final_path"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set strong right permissions to app files
chown -R $app: "$final_path"
chmod -R 640 "$final_path"
find "$final_path" -type d -print0 | xargs -0 chmod 750
#=================================================
# RELOAD NGINX
#=================================================
2017-11-08 21:25:42 +01:00
systemctl restart $app
systemctl reload nginx