1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/thelounge_ynh.git synced 2024-09-03 20:35:54 +02:00
thelounge_ynh/scripts/install

87 lines
2.9 KiB
Text
Raw Normal View History

2015-08-22 20:24:46 +02:00
#!/bin/bash
2018-05-01 12:25:53 +02:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
#=================================================
2023-03-14 16:52:36 +01:00
ynh_script_progression --message="Installing dependencies..." --weight=7
2018-05-01 12:25:53 +02:00
2020-05-27 17:03:30 +02:00
# Install Nodejs
2020-05-30 19:29:45 +02:00
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
2020-05-27 17:03:30 +02:00
2018-05-01 12:25:53 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2021-11-23 08:28:18 +01:00
ynh_script_progression --message="Setting up source files..." --weight=4
2015-08-22 20:24:46 +02:00
2018-05-01 12:25:53 +02:00
# Download, check integrity, uncompress and patch the source from app.src
2023-03-14 16:44:09 +01:00
ynh_setup_source --dest_dir=$install_dir
2019-10-25 11:04:41 +02:00
2023-03-14 16:44:09 +01:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2021-08-02 08:23:59 +02:00
2019-10-25 11:04:41 +02:00
#=================================================
2020-05-30 19:18:05 +02:00
# NGINX CONFIGURATION
2019-10-25 11:04:41 +02:00
#=================================================
2021-11-23 08:28:18 +01:00
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
2020-05-30 19:18:05 +02:00
2020-08-09 14:48:13 +02:00
# Create a dedicated NGINX config
2020-05-30 19:18:05 +02:00
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# MODIFY A CONFIG FILE
#=================================================
2021-11-23 08:28:18 +01:00
ynh_script_progression --message="Modifying a config file..." --weight=1
2020-05-30 19:18:05 +02:00
2024-04-07 09:46:39 +02:00
ynh_add_config --template="config.js" --destination="$data_dir/config.js"
2020-05-27 18:18:11 +02:00
2019-10-25 11:04:41 +02:00
#=================================================
# INSTALL THE LOUNGE
#=================================================
2024-04-07 09:46:39 +02:00
ynh_script_progression --message="Installing $app..." --weight=10
2019-10-25 11:04:41 +02:00
2023-03-14 16:44:09 +01:00
pushd $install_dir
2021-08-30 15:16:17 +02:00
ynh_use_nodejs
2022-01-04 11:14:17 +01:00
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install
2022-01-04 14:22:30 +01:00
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production yarn build
2019-10-25 11:04:41 +02:00
popd
2015-08-22 20:24:46 +02:00
2018-05-01 12:25:53 +02:00
#=================================================
# SETUP SYSTEMD
#=================================================
2021-11-23 08:28:18 +01:00
ynh_script_progression --message="Configuring a systemd service..." --weight=1
2018-05-01 12:25:53 +02:00
2022-03-27 10:59:38 +02:00
env_path="$PATH"
2018-05-01 18:04:42 +02:00
ynh_add_systemd_config
2018-05-01 15:02:11 +02:00
2018-05-01 12:25:53 +02:00
#=================================================
2020-05-30 19:18:05 +02:00
# INTEGRATE SERVICE IN YUNOHOST
2018-05-01 12:25:53 +02:00
#=================================================
2021-11-23 08:28:18 +01:00
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
2018-05-01 12:25:53 +02:00
2020-12-14 11:14:10 +01:00
yunohost service add $app --description="Client Web IRC" --log="/var/log/$app/$app.log"
2018-05-01 12:25:53 +02:00
2019-10-25 11:04:41 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2021-11-23 08:28:18 +01:00
ynh_script_progression --message="Starting a systemd service..." --weight=1
2019-10-25 11:04:41 +02:00
# Start a systemd service
2021-08-30 22:37:35 +02:00
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
2018-05-01 12:25:53 +02:00
2019-10-25 11:04:41 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2021-11-23 08:28:18 +01:00
ynh_script_progression --message="Installation of $app completed" --last