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

76 lines
2.6 KiB
Text
Raw Normal View History

2023-08-06 18:49:51 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
### This helper will compare the version of the currently installed app and the version of the upstream package.
### $upgrade_type can have 2 different values
### - UPGRADE_APP if the upstream app version has changed
### - UPGRADE_PACKAGE if only the YunoHost package has changed
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
#=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
2023-09-21 22:17:58 +02:00
ynh_setup_source --dest_dir="$install_dir"
2023-08-06 18:49:51 +02:00
fi
2023-09-21 19:05:38 +02:00
#=================================================
# ACTUAL UPDATE
#=================================================
ynh_script_progression --message="Proceeding to migration..."
2023-09-21 22:17:58 +02:00
pushd $install_dir
ynh_script_progression --message="Proceeding to migration..."
2023-09-21 22:42:30 +02:00
php$phpversion api/bin/console doctrine:migration:migrate
php$phpversion api/bin/console zusam:migration
2023-09-21 19:05:38 +02:00
2023-09-21 22:17:58 +02:00
ynh_script_progression --message="Pulling in external libraries with Composer..."
2023-09-21 22:50:18 +02:00
ynh_install_composer -c "2.4.2" -w $install_dir/api/
2023-09-21 22:17:58 +02:00
cp app/dist/* public/
popd
2023-09-21 19:05:38 +02:00
2023-08-06 18:49:51 +02:00
chown -R $app:www-data "$install_dir"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# This should be a literal copypasta of what happened in the install's "System configuration" section
ynh_add_fpm_config
ynh_add_nginx_config
2023-08-09 17:45:05 +02:00
# ynh_use_logrotate --non-append
2023-08-06 18:49:51 +02:00
2023-08-09 17:45:05 +02:00
# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
2023-08-06 18:49:51 +02:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last