2023-05-29 11:46:05 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|
|
|
|
|
|
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY URL IN NGINX CONF
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
|
|
|
|
|
|
|
ynh_change_url_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHANGE THE URL IN .ENV.LOCAL AND REBUILD THE APP
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Setting the new URL..." --weight=1
|
|
|
|
|
|
|
|
if [ $change_domain -eq 1 ]
|
|
|
|
then
|
|
|
|
ynh_replace_string --match_string="NEXT_PUBLIC_SITE_DOMAIN=$old_domain" --replace_string="NEXT_PUBLIC_SITE_DOMAIN=$new_domain" --target_file="$install_dir/.env.local"
|
|
|
|
fi
|
|
|
|
|
2023-05-29 12:24:24 +02:00
|
|
|
#=================================================
|
|
|
|
# REBUILDING AND INSTALL THE APP
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Rebuilding the app..." --weight=1
|
|
|
|
|
2023-05-29 13:24:24 +02:00
|
|
|
ynh_use_nodejs
|
2023-05-29 13:52:52 +02:00
|
|
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install
|
2023-05-29 11:46:05 +02:00
|
|
|
npx next telemetry disable
|
2023-05-29 13:52:52 +02:00
|
|
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm build
|
2023-05-29 11:46:05 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
|
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|