#!/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=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/git_src" ynh_secure_remove $install_dir/www/install chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" find $install_dir/www -type d -exec chmod 755 {} \; find $install_dir/www -type f -exec chmod 644 {} \; ynh_secure_remove --file="$install_dir/www/public_html" ln -s $install_dir/git_src/public_html $install_dir/www #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating $app's configuration files..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config #================================================= # SPECIFIC UPGRADE #================================================= # UPGRADE MYSQL CONFIGURATION #================================================= ynh_script_progression --message="Upgrading MySQL configuration..." --weight=1 # Update MySQL entries upgrade_mysql_dir="../sources/patches/mysql/from_$src_version.sql" if [ -f "$upgrade_mysql_dir" ]; then ynh_mysql_execute_file_as_root --file=$upgrade_mysql_dir --database=$db_name cat $upgrade_mysql_dir fi updated_src_version=$(ynh_app_upstream_version) ynh_app_setting_set --app=$app --key=src_version --value=$updated_src_version #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed" --last