#!/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 [ ! -d "$install_dir/libreto/.git" ]; then # Move git repository one step down" mkdir "$install_dir/__new__" find "$install_dir" -mindepth 1 -maxdepth 1 -not -name "__new__" -print0 | xargs -0 mv -t "$install_dir/__new__" mv "$install_dir/__new__" "$install_dir/libreto" fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Upgrading source files..." --weight=5 chown -R $app:www-data "$install_dir" # Download, check integrity, uncompress and patch the source from app.src ynh_exec_as "$app" git -C "$install_dir/libreto" checkout master ynh_exec_as "$app" git -C "$install_dir/libreto" pull --quiet ynh_exec_as "$app" git -C "$install_dir/libreto" checkout "$COMMIT" --quiet ynh_exec_as "$app" git -C "$install_dir/libreto" submodule update --init --recursive --quiet chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # SPECIFIC UPGRADE #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." ynh_backup_if_checksum_is_different --file="$install_dir/config.php" provider="__PROVIDER__" default_provider="framapad" commented_provider="// CUSTOM_PROVIDER" if [ "$etherpad_instance" != "https://annuel2.framapad.org" ]; then provider="${domain%%.*}" default_provider="$provider" commented_provider="" fi ynh_add_config --template="config.dist.php" --destination="$install_dir/libreto/config.php" chown "$app:www-data" "$install_dir/libreto/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 --usage=low --footprint=low # Create a dedicated NGINX config ynh_add_nginx_config #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed" --last