2023-10-04 19:05:58 +02:00
#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
2024-08-30 23:37:23 +02:00
ynh_app_setting_set_default --key=php_upload_max_filesize --value=500M
2023-10-04 19:05:58 +02:00
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
2024-08-30 23:37:23 +02:00
ynh_script_progression "Stopping $app's systemd service..."
2023-10-04 19:05:58 +02:00
2024-08-30 23:37:23 +02:00
ynh_systemctl --service=$app --action="stop"
2023-10-04 19:05:58 +02:00
#=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-08-30 23:37:23 +02:00
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
2023-10-04 19:05:58 +02:00
then
2024-08-30 23:37:23 +02:00
ynh_script_progression "Upgrading source files..."
2023-10-04 19:05:58 +02:00
# Download, check integrity, uncompress and patch the source from app.src
2024-08-30 23:37:23 +02:00
ynh_setup_source --dest_dir="$install_dir" # --full_replace --keep="config.php"
2023-10-04 19:05:58 +02:00
fi
2024-08-30 23:37:23 +02:00
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
2023-10-04 19:05:58 +02:00
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
2024-08-30 23:37:23 +02:00
ynh_script_progression "Upgrading system configurations related to $app..."
2023-10-04 19:05:58 +02:00
2024-08-30 23:37:23 +02:00
ynh_config_add_phpfpm
2023-10-04 19:05:58 +02:00
2024-08-30 23:37:23 +02:00
ynh_config_add_nginx
2023-10-04 19:05:58 +02:00
#=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
#=================================================
# UPDATE A CONFIG FILE
#=================================================
2024-08-30 23:37:23 +02:00
#ynh_script_progression "Updating configuration..."
2023-10-04 19:05:58 +02:00
2024-08-30 23:37:23 +02:00
#ynh_config_add --template="config.php" --destination="$install_dir/config.php"
2023-10-04 19:05:58 +02:00
2024-08-30 23:37:23 +02:00
##REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config.php"
##REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config.php"
2023-10-04 19:05:58 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2024-08-30 23:37:23 +02:00
ynh_script_progression "Upgrade of $app completed"