2022-02-16 10:25:34 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-01-17 16:04:18 +01:00
|
|
|
# INSTALL NODEJS
|
2022-02-16 10:25:34 +01:00
|
|
|
#=================================================
|
2024-01-17 16:04:18 +01:00
|
|
|
ynh_script_progression --message="Installing NodeJS..." --weight=1
|
2022-02-16 10:25:34 +01:00
|
|
|
|
2024-01-17 16:04:18 +01:00
|
|
|
ynh_install_nodejs --nodejs_version="$nodejs_version"
|
2022-02-16 10:25:34 +01:00
|
|
|
|
|
|
|
#=================================================
|
2024-01-17 16:04:18 +01:00
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
2022-02-16 10:25:34 +01:00
|
|
|
#=================================================
|
2024-01-17 16:04:18 +01:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
2022-02-16 10:25:34 +01:00
|
|
|
|
2024-01-17 16:04:18 +01:00
|
|
|
# Download, check integrity, uncompress and patch the source
|
|
|
|
ynh_setup_source --dest_dir="$install_dir/source"
|
2022-02-16 10:25:34 +01:00
|
|
|
|
2024-01-17 16:04:18 +01:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
2022-02-16 10:25:34 +01:00
|
|
|
|
|
|
|
#=================================================
|
2024-01-17 16:04:18 +01:00
|
|
|
# NODEJS BUILD
|
2022-02-16 10:25:34 +01:00
|
|
|
#=================================================
|
2024-01-17 16:04:18 +01:00
|
|
|
ynh_script_progression --message="Building $app..." --weight=3
|
2022-02-16 10:25:34 +01:00
|
|
|
|
2024-01-17 16:04:18 +01:00
|
|
|
pushd "$install_dir/source"
|
|
|
|
echo VUE_APP_PIXABAY_API_KEY="$api_key_pixabay" >> .env
|
|
|
|
echo VUE_APP_GOOGLE_API_KEY="$api_key_google_youtube" >> .env
|
2022-02-16 10:25:34 +01:00
|
|
|
|
2024-01-17 16:04:18 +01:00
|
|
|
ynh_use_nodejs
|
|
|
|
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install
|
|
|
|
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" run build
|
|
|
|
popd
|
2022-11-06 00:28:09 +01:00
|
|
|
|
2024-01-17 16:04:18 +01:00
|
|
|
mv "$install_dir/source/dist" "$install_dir/www"
|
|
|
|
ynh_secure_remove --file="$install_dir/source"
|
2022-11-06 00:40:07 +01:00
|
|
|
|
2024-01-17 16:04:18 +01:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
2022-02-16 10:25:34 +01:00
|
|
|
|
|
|
|
#=================================================
|
2024-01-17 16:04:18 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2022-02-16 10:25:34 +01:00
|
|
|
#=================================================
|
2024-01-17 16:04:18 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2022-02-16 10:25:34 +01:00
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
|
|
ynh_add_fpm_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-03-13 01:20:51 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|