1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/digiscreen_ynh.git synced 2024-09-03 18:26:15 +02:00
digiscreen_ynh/scripts/install

70 lines
2.2 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=1
ynh_install_nodejs --nodejs_version="$nodejs_version"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source
ynh_setup_source --dest_dir="$install_dir/source"
# Patch broken dependency
sed -i 's|"v-calendar": "^2.3.0"|"v-calendar": "2.3.0"|' "$install_dir/source/package.json"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# NODEJS BUILD
#=================================================
ynh_script_progression --message="Building $app..." --weight=3
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
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
mv "$install_dir/source/dist" "$install_dir/www"
ynh_secure_remove --file="$install_dir/source"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding 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="Installation of $app completed" --last