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
2024-08-29 14:42:37 +02:00

78 lines
2.4 KiB
Bash

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
main_domain=$(cat /etc/yunohost/current_host)
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service=$app --action="stop" --log_path=systemd
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
# If mongo_version doesn't exist, create it
if [ -z "$mongo_version" ]; then
mongo_version="$(mongod --version | grep -oP 'db version v\K.{0,3}')"
ynh_app_setting_set --key=mongo_version --value=$mongo_version
fi
ynh_safe_rm "/etc/apt/sources.list.d/mongodb-org-3.2.list"
ynh_safe_rm "/etc/apt/sources.list.d/mongodb-org-4.4.list"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep=".env"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression "Upgrading dependencies..."
ynh_nodejs_install
ynh_install_mongo
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression "Upgrading NGINX web server configuration..."
ynh_config_add_nginx
ynh_config_add_systemd
yunohost service add $app --description="Wekan daemon" --log="/var/log/$app/$app.log"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression "Updating configuration..."
ynh_config_add --template=".env" --destination="$install_dir/.env"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service=$app --action="start" --log_path=systemd --wait_until="Enabling LDAP Background Sync"
#if ynh_in_ci_tests; then
# sleep 60
#fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"