1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lionwiki-t2t_ynh.git synced 2024-09-03 19:36:27 +02:00
lionwiki-t2t_ynh/scripts/upgrade
2024-01-17 11:23:28 +01:00

54 lines
2 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# 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.
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"
# Recalculate and store the checksum of the file for the next upgrade.
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"
#ynh_restore_file -o "conf/config.php"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last