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

66 lines
3.3 KiB
Bash

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression "Installing NodeJS..."
# Install Nodejs
ynh_nodejs_install
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/source"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
#=================================================
# BUILD APP
#=================================================
ynh_script_progression "Building app... (this will take some time and resources!)"
pushd "$install_dir/source"
ynh_hide_warnings ynh_exec_as_app node_load_PATH" npm install
ynh_hide_warnings env node_load_PATH" npm install gulp -g
ynh_hide_warnings ynh_exec_as_app node_load_PATH" npm run build
popd
ynh_exec_as_app mv "$install_dir/source/dist" "$install_dir/live"
ynh_safe_rm "$install_dir/source"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression "Adding $app's configuration..."
ynh_config_add --template="config.example.js" --destination="$install_dir/live/config.js"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/live/config.js"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/live/config.js"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config
ynh_config_add_nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Installation of $app completed"