#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= email=$(ynh_user_get_info --username=$admin --key=mail) timezone="$(cat /etc/timezone)" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Upgrading source files..." --weight=2 ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="app/inc/config.php" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3 ynh_add_fpm_config ynh_add_nginx_config #================================================= # SPECIFIC UPGRADE #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=2 ynh_add_config --template="config.php" --destination="$install_dir/app/inc/config.php" chmod 400 "$install_dir/app/inc/config.php" chown $app:$app "$install_dir/app/inc/config.php" #================================================= # REPLACE LOGO IMAGE (DEFAULT IS FRAMADATE) #================================================= cp ../sources/logo.png "$install_dir/images" #================================================= # CREATE LOG FILE #================================================= touch "$install_dir/admin/stdout.log" #================================================= # RUN DATABASE UPGRADE #================================================= ynh_script_progression --message="Upgrading database..." --weight=2 ynh_install_composer ynh_exec_warn_less php$phpversion "$install_dir/admin/migration.php" chown -R $app: "$install_dir/"{tpl_c,admin/stdout.log} #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed" --last