#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # STANDARD UPGRADE STEPS #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If prefix doesn't exist, create it if [ -z "${prefix:-}" ]; then prefix="lime_" ynh_app_setting_set --app=$app --key=prefix --value=$prefix fi # if install_dir/upload is not a symlink, moving data... if [ ! -L "$install_dir/upload" ]; then if [ -z "$(ls -A "$data_dir/upload")" ]; then rmdir "$data_dir/upload" else ynh_warn "$data_dir/upload is not empty, moving to $data_dir/upload_backup. You can decide to remove it or merge it with the new upload dir." mv "$data_dir/upload" "$data_dir/upload_backup" fi mv "$install_dir/upload" "$data_dir/upload" fi #================================================= # 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" --full_replace=1 --keep="plugins/ application/config/config.php upload" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" # Set permissions just in case chmod 750 "$data_dir" chown -R "$app:www-data" "$data_dir" #================================================= # SPECIFIC UPGRADE #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_add_config --template="../conf/config.php" --destination="$install_dir/application/config/config.php" chmod 400 "$install_dir/application/config/config.php" chown "$app:$app" "$install_dir/application/config/config.php" #================================================= # UPGRADE DB #================================================= ynh_script_progression --message="Running Database migrations..." # Migrate DB ynh_exec_as "$app" "php$phpversion" "$install_dir/application/commands/console.php" updatedb #================================================= # 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