1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mumble-web_ynh.git synced 2024-09-03 19:46:16 +02:00
mumble-web_ynh/scripts/install

80 lines
2.7 KiB
Text
Raw Normal View History

2021-06-05 12:43:11 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
2024-01-13 11:57:51 +01:00
path="/"
2021-06-05 12:43:11 +02:00
2024-01-13 11:57:51 +01:00
# Testing if mumbleserver is installed
yunohost app list | grep -q "id: mumbleserver" || ynh_die "mumble-server is needed, but it is not installed."
2021-06-05 12:43:11 +02:00
#=================================================
# INSTALL DEPENDENCIES
#=================================================
2024-01-13 11:57:51 +01:00
ynh_script_progression --message="Installing NodeJS..." --weight=4
2021-06-05 12:43:11 +02:00
2024-01-13 11:57:51 +01:00
ynh_install_nodejs --nodejs_version="$nodejs_version"
2021-06-05 12:43:11 +02:00
#=================================================
# INSTALL Mumble-web
#=================================================
2021-06-05 16:01:44 +02:00
ynh_script_progression --message="Setting up source files..." --weight=1
2021-06-05 12:43:11 +02:00
2024-01-13 11:57:51 +01:00
# Download, check integrity, uncompress and patch the source
ynh_setup_source --dest_dir="$install_dir"
2021-06-05 12:43:11 +02:00
2024-01-13 11:57:51 +01:00
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
2021-06-05 12:43:11 +02:00
#=================================================
2024-01-13 11:57:51 +01:00
# BUILD CODE
2021-06-05 12:43:11 +02:00
#=================================================
2024-01-13 11:57:51 +01:00
ynh_script_progression --message="Building Mumble web client..." --weight=1
2021-06-05 12:43:11 +02:00
2024-01-13 11:57:51 +01:00
pushd "$install_dir"
2024-01-13 13:58:15 +01:00
ynh_use_nodejs
2024-01-13 11:57:51 +01:00
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --save --loglevel warn
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" run build
popd
2021-06-05 12:43:11 +02:00
2021-06-05 15:32:05 +02:00
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
2024-01-13 13:58:15 +01:00
ynh_add_config --template="config.local.js" --destination="$install_dir/dist/config.local.js"
2024-01-13 11:57:51 +01:00
chmod 400 "$install_dir/dist/config.local.js"
chown "$app" "$install_dir/dist/config.local.js"
2021-06-05 15:32:05 +02:00
2021-06-05 12:43:11 +02:00
#=================================================
2024-01-13 11:57:51 +01:00
# SYSTEM CONFIGURATION
2021-06-05 12:43:11 +02:00
#=================================================
2024-01-13 11:57:51 +01:00
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
2021-06-05 12:43:11 +02:00
2024-01-13 11:57:51 +01:00
# Create a dedicated NGINX config
ynh_add_nginx_config
2021-06-05 12:43:11 +02:00
2024-01-13 11:57:51 +01:00
# Create a dedicated systemd config
2021-06-05 12:43:11 +02:00
ynh_add_systemd_config
2024-01-13 13:58:15 +01:00
2024-01-13 11:57:51 +01:00
yunohost service add "$app" --description="Mumble web client" --log="/var/log/$app/$app.log"
2021-06-05 12:43:11 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3
2024-01-13 11:57:51 +01:00
ynh_systemd_action --service_name="$app" --action=restart --log_path="systemd"
2021-06-05 12:43:11 +02:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last