1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/luckysheet_ynh.git synced 2024-09-03 19:36:21 +02:00
luckysheet_ynh/scripts/install
2024-01-17 00:10:12 +01:00

74 lines
2.5 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=20
# Install Nodejs
ynh_install_nodejs --nodejs_version="$nodejs_version"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/source"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# BUILD APP
#=================================================
ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=20
pushd "$install_dir/source"
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install gulp -g
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" run build
popd
ynh_exec_as "$app" mv "$install_dir/source/dist" "$install_dir/live"
ynh_secure_remove --file="$install_dir/source"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_add_config --template="config.example.js" --destination="$install_dir/live/config.js"
chmod 400 "$install_dir/live/config.js"
chown "$app:$app" "$install_dir/live/config.js"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last