2014-06-02 13:38:03 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-29 00:55:27 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-02-03 12:59:58 +01:00
|
|
|
|
2018-01-29 00:55:27 +01:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
2014-06-02 13:38:03 +02:00
|
|
|
|
2018-01-29 00:55:27 +01:00
|
|
|
#=================================================
|
2022-03-25 01:09:30 +01:00
|
|
|
# INSTALL DEPENDENCIES
|
2018-01-29 00:55:27 +01:00
|
|
|
#=================================================
|
2023-06-11 18:39:46 +02:00
|
|
|
ynh_script_progression --message="Installing dependencies..."
|
2018-01-29 00:55:27 +01:00
|
|
|
|
2022-05-05 02:45:58 +02:00
|
|
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
2018-01-29 00:55:27 +01:00
|
|
|
|
|
|
|
#=================================================
|
2022-03-25 01:09:30 +01:00
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
2018-01-29 00:55:27 +01:00
|
|
|
#=================================================
|
2022-03-25 01:09:30 +01:00
|
|
|
ynh_script_progression --message="Setting up source files..."
|
2018-01-29 00:55:27 +01:00
|
|
|
|
2022-03-25 01:09:30 +01:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-06-11 18:30:58 +02:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2022-03-25 01:09:30 +01:00
|
|
|
|
2023-06-11 18:30:58 +02:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2018-01-29 00:55:27 +01:00
|
|
|
|
|
|
|
#=================================================
|
2022-03-25 01:09:30 +01:00
|
|
|
# NGINX CONFIGURATION
|
2018-01-29 00:55:27 +01:00
|
|
|
#=================================================
|
2022-03-25 01:09:30 +01:00
|
|
|
ynh_script_progression --message="Configuring NGINX web server..."
|
2018-01-29 00:55:27 +01:00
|
|
|
|
2022-03-25 01:09:30 +01:00
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
2018-01-29 00:55:27 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC SETUP
|
|
|
|
#=================================================
|
2022-03-25 01:09:30 +01:00
|
|
|
# REMOVE GOOGLE !!!
|
2018-01-29 00:55:27 +01:00
|
|
|
#=================================================
|
2022-05-05 02:45:58 +02:00
|
|
|
ynh_script_progression --message="Remobing Google..."
|
2014-06-02 13:38:03 +02:00
|
|
|
|
2023-06-11 18:30:58 +02:00
|
|
|
sed --in-place "/googlecode\|googleapis/d" "$install_dir/index.html"
|
2018-01-29 00:55:27 +01:00
|
|
|
|
|
|
|
#=================================================
|
2022-05-05 02:45:58 +02:00
|
|
|
# BUILD APP
|
2018-01-29 00:55:27 +01:00
|
|
|
#=================================================
|
2022-05-05 02:45:58 +02:00
|
|
|
ynh_script_progression --message="Building app..."
|
2018-01-29 00:55:27 +01:00
|
|
|
|
2023-06-11 18:30:58 +02:00
|
|
|
pushd "$install_dir"
|
2022-05-05 02:45:58 +02:00
|
|
|
ynh_use_nodejs
|
2023-06-11 20:02:30 +02:00
|
|
|
#ynh_exec_warn_less ynh_npm install --production
|
|
|
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --production
|
2022-05-05 02:45:58 +02:00
|
|
|
popd
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SETUP SYSTEMD
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring a systemd service..."
|
|
|
|
|
|
|
|
# Create a dedicated systemd config
|
|
|
|
ynh_add_supervisor_config
|
2018-01-29 00:55:27 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
2022-05-05 02:45:58 +02:00
|
|
|
#=================================================
|
|
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
|
|
|
|
|
|
yunohost service add $app --log="/var/log/$app/$app.log"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..."
|
|
|
|
|
|
|
|
# Start a systemd service
|
|
|
|
ynh_supervisor_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
|
|
|
|
2018-01-29 00:55:27 +01:00
|
|
|
#=================================================
|
2022-03-25 01:09:30 +01:00
|
|
|
# END OF SCRIPT
|
2018-01-29 00:55:27 +01:00
|
|
|
#=================================================
|
|
|
|
|
2022-03-25 01:09:30 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed"
|