2020-03-01 11:28:28 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2024-01-17 11:23:28 +01:00
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=3
|
2020-03-01 11:28:28 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
|
|
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=
|
2022-07-17 03:21:03 +02:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
2022-07-17 03:21:03 +02:00
|
|
|
|
2020-03-01 11:28:28 +01:00
|
|
|
#=================================================
|
|
|
|
# STORE THE CONFIG FILE CHECKSUM
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
|
|
|
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
2024-01-17 11:23:28 +01:00
|
|
|
ynh_backup_if_checksum_is_different --file="$install_dir/config.php"
|
|
|
|
ynh_backup_if_checksum_is_different --file="$install_dir/config.t2t"
|
|
|
|
ynh_backup_if_checksum_is_different --file="$install_dir/menu.php"
|
2020-03-01 11:28:28 +01:00
|
|
|
# Recalculate and store the checksum of the file for the next upgrade.
|
2024-01-17 11:23:28 +01:00
|
|
|
ynh_store_file_checksum --file="$install_dir/config.php"
|
|
|
|
ynh_store_file_checksum --file="$install_dir/config.t2t"
|
|
|
|
ynh_store_file_checksum --file="$install_dir/menu.php"
|
2020-04-28 08:57:06 +02:00
|
|
|
|
2021-12-05 21:36:29 +01:00
|
|
|
#ynh_restore_file -o "conf/config.php"
|
|
|
|
|
2020-03-01 11:28:28 +01:00
|
|
|
#=================================================
|
2024-01-17 11:23:28 +01:00
|
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
2020-03-01 11:28:28 +01:00
|
|
|
#=================================================
|
2024-01-17 11:23:28 +01:00
|
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
2020-03-01 11:28:28 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
# Create a dedicated PHP-FPM config
|
|
|
|
ynh_add_fpm_config
|
2020-03-01 11:28:28 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
2020-03-01 11:28:28 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-11-27 10:49:00 +01:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|