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

67 lines
2.2 KiB
Text
Raw Permalink Normal View History

2021-12-05 09:05:11 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
2023-03-03 19:32:45 +01:00
ynh_script_progression --message="Installing dependencies..." --weight=20
2021-12-05 09:05:11 +01:00
ynh_exec_warn_less 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
2023-03-03 19:25:41 +01:00
ynh_setup_source --dest_dir="$install_dir/build"
2021-12-05 09:05:11 +01:00
2023-03-03 19:25:41 +01:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2021-12-05 09:05:11 +01:00
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
2022-03-19 19:08:33 +01:00
# Create a dedicated NGINX config
2021-12-05 09:05:11 +01:00
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#==============================================
2022-03-19 19:08:33 +01:00
# BUILD APP
2021-12-05 09:05:11 +01:00
#==============================================
2022-03-19 19:08:33 +01:00
ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=40
2021-12-05 09:05:11 +01:00
2022-05-31 00:12:17 +02:00
ynh_use_nodejs
2023-03-03 19:25:41 +01:00
pushd "$install_dir/build"
2022-05-31 00:12:17 +02:00
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --ignore-optional
ynh_exec_warn_less ynh_exec_as $app env NODE_ENV=production $ynh_node_load_PATH yarn build
ynh_exec_warn_less ynh_exec_as $app env NODE_ENV=production $ynh_node_load_PATH yarn cache clean --all
2021-12-05 09:05:11 +01:00
popd
2023-03-03 19:25:41 +01:00
ynh_exec_as $app mv "$install_dir/build/build" "$install_dir/live"
2023-03-03 19:35:03 +01:00
ynh_secure_remove --file="$install_dir/build"
2021-12-05 09:05:11 +01:00
2023-03-03 19:25:41 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2021-12-05 09:05:11 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last