#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 # Move sources to subdir if [ ! -d "$install_dir/sources" ]; then mkdir "$install_dir/sources" find . -mindepth 1 -maxdepth 1 ! -name "sources" -exec mv -t "$install_dir/sources" "{}" + fi #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Upgrading NodeJS..." --weight=1 ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Upgrading source files..." --weight=7 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/sources" --full_replace=1 --keep="config.php" mkdir -p "$install_dir/sources/"{cache,uploads} chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # INSTALL AND INITIALIZE COMPOSER #================================================= ynh_script_progression --message="Building $app with Composer..." --weight=30 pushd "$install_dir/sources" ynh_install_composer --workdir="$install_dir/sources" --install_args="--no-dev" ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile --prod ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn run buildall ynh_composer_exec --workdir="$install_dir/sources" --commands="install --prefer-dist --no-cache --no-progress --no-dev -a" ynh_secure_remove node_modules ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean ynh_exec_as "$app" "php$phpversion" "bin/console" db:update popd chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config # Create a dedicated PHP-FPM config ynh_add_fpm_config #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed" --last