#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) #================================================= # STANDARD UPGRADE STEPS #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= #ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # Nothing to do yet... #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then # Enable maintenance mode while upgrading ynh_write_var_in_file --file="$install_dir/.env" --key="MAINTENANCE_MODE" --value="true" ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src # Keep .env and database.sqlite ! ynh_setup_source --dest_dir="$install_dir" --keep=".env database/database.sqlite" # Remove this file as the app is already installed ynh_secure_remove $install_dir/INSTALLING fi # $install_dir will automatically be initialized with some decent # permission by default ... however, you may need to recursively reapply # ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" chmod o-rwx "$install_dir" -R # Disable maintenance mode ynh_write_var_in_file --file="$install_dir/.env" --key="MAINTENANCE_MODE" --value="false" #================================================= # 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 --usage=medium --footprint=low ynh_add_nginx_config #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) #================================================= # Nothing to do yet... #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed" --last