#!/bin/bash #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= ynh_script_progression --message="Stopping $app's systemd service..." ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." if [ -f "$install_dir/config/db.inc.php" ]; then ynh_secure_remove --file="$install_dir/config/db.inc.php" fi if [[ -n "${path:-}" ]] && [[ "${path:-}" != "/" ]]; then ynh_die --message="Movim can't be installed in a subdir anymore. Please change_url to the root of a domain before upgrading." fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env" # Patch call to php in composer ynh_replace_string -f "$install_dir/composer.json" --match_string='"vendor/bin/phinx' --replace_string='"@php vendor/bin/phinx' # Patch call to php in daemon code ynh_replace_string -f "$install_dir/src/Movim/Daemon/Session.php" --match_string="exec php" --replace_string="exec php$phpversion" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating $app's configuration file..." ynh_add_config --template="dot_env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown "$app:$app" "$install_dir/.env" #================================================= # BUILD MOVIM #================================================= ynh_script_progression --message="Building $app..." ynh_exec_warn_less ynh_install_composer COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn_less ynh_composer_exec --commands="config --global discard-changes true --quiet" COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn_less ynh_composer_exec --commands="update --no-interaction --quiet" COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn_less ynh_composer_exec --commands="movim:migrate --quiet" #================================================= # 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 # Create a dedicated systemd config ynh_add_systemd_config yunohost service add "$app" --description="Responsive web-based XMPP client" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting $app's systemd service..." # Start a systemd service ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Movim daemon launched" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed"