2023-10-05 15:34:34 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2023-10-06 14:19:55 +02:00
|
|
|
#=================================================
|
|
|
|
# INSTALL DEPENDENCIES
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installing dependencies..." --weight=10
|
|
|
|
|
|
|
|
# Install Nodejs
|
|
|
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
|
|
|
|
2023-10-05 15:34:34 +02:00
|
|
|
#=================================================
|
|
|
|
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2023-10-06 14:19:55 +02:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
2023-10-05 15:34:34 +02:00
|
|
|
|
2023-10-06 14:19:55 +02:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2023-10-05 15:34:34 +02:00
|
|
|
|
|
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
|
2023-10-06 14:19:55 +02:00
|
|
|
# if [ "$path" = "/" ]; then
|
|
|
|
# conf_path=""
|
|
|
|
# else
|
|
|
|
# conf_path=$path
|
|
|
|
# fi
|
2023-10-05 15:34:34 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SYSTEM CONFIGURATION
|
|
|
|
#=================================================
|
2023-10-06 14:45:01 +02:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2023-10-05 15:34:34 +02:00
|
|
|
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2023-10-05 16:05:01 +02:00
|
|
|
ynh_add_systemd_config
|
|
|
|
|
2023-10-06 14:19:55 +02:00
|
|
|
yunohost service add $app --description="Emojiwall for Owncast" --log="/var/log/$app/$app.log"
|
|
|
|
|
2023-10-05 15:34:34 +02:00
|
|
|
#=================================================
|
2023-10-06 14:19:55 +02:00
|
|
|
# ADD A CONFIGURATION
|
2023-10-05 15:34:34 +02:00
|
|
|
#=================================================
|
2023-10-06 14:19:55 +02:00
|
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
|
|
|
2023-10-06 14:49:51 +02:00
|
|
|
ynh_add_config --template="../conf/default.json" --destination="$install_dir/config/default.json"
|
2023-10-06 14:19:55 +02:00
|
|
|
|
|
|
|
chmod 400 "$install_dir/config/default.json"
|
|
|
|
chown $app:$app "$install_dir/config/default.json"
|
|
|
|
|
2023-10-05 15:34:34 +02:00
|
|
|
#=================================================
|
2023-10-06 14:19:55 +02:00
|
|
|
# CONFIGURE THE APP
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring the app..." --weight=15
|
2023-10-05 15:34:34 +02:00
|
|
|
|
2023-10-06 14:19:55 +02:00
|
|
|
pushd $install_dir
|
|
|
|
ynh_use_nodejs
|
|
|
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install
|
|
|
|
popd
|
2023-10-05 15:34:34 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2023-10-06 14:19:55 +02:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
2023-10-05 15:34:34 +02:00
|
|
|
|
2023-10-06 14:19:55 +02:00
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
2023-10-05 15:34:34 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2023-10-06 14:19:55 +02:00
|
|
|
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|