2019-02-16 15:00:20 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2020-04-14 21:23:42 +02:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=6
|
2019-02-16 15:00:20 +01:00
|
|
|
|
2023-08-16 18:11:35 +02:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2023-11-11 23:14:52 +01:00
|
|
|
mv $install_dir/gotify-linux-* $install_dir/gotify
|
2022-07-29 00:43:33 +02:00
|
|
|
|
2023-08-16 18:11:35 +02:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2023-11-11 23:15:41 +01:00
|
|
|
chmod +x "$install_dir/gotify"
|
2019-02-16 15:00:20 +01:00
|
|
|
|
|
|
|
#=================================================
|
2023-11-23 18:55:43 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2019-02-16 15:00:20 +01:00
|
|
|
#=================================================
|
2023-11-23 18:55:43 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2019-02-16 15:00:20 +01:00
|
|
|
|
2022-07-29 00:43:33 +02:00
|
|
|
# Create a dedicated NGINX config
|
2019-02-16 15:00:20 +01:00
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2023-08-16 18:27:39 +02:00
|
|
|
# Create a dedicated systemd config
|
|
|
|
ynh_add_systemd_config
|
|
|
|
|
2023-11-11 23:10:34 +01:00
|
|
|
yunohost service add $app --description="Simple server for sending and receiving messages" --log="/var/log/$app/$app.log"
|
2023-08-16 18:27:39 +02:00
|
|
|
|
2019-02-16 15:00:20 +01:00
|
|
|
#=================================================
|
2022-07-29 00:43:33 +02:00
|
|
|
# SPECIFIC SETUP
|
2019-02-16 15:00:20 +01:00
|
|
|
#=================================================
|
2022-07-29 00:43:33 +02:00
|
|
|
# ADD A CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
2019-02-16 15:00:20 +01:00
|
|
|
|
2023-11-11 23:10:34 +01:00
|
|
|
ynh_add_config --template="config.yml" --destination="$install_dir/config.yml"
|
2022-07-29 00:43:33 +02:00
|
|
|
|
2023-08-16 18:11:35 +02:00
|
|
|
chmod 400 "$install_dir/config.yml"
|
|
|
|
chown $app:$app "$install_dir/config.yml"
|
2019-02-16 15:00:20 +01:00
|
|
|
|
|
|
|
#=================================================
|
2022-07-29 00:43:33 +02:00
|
|
|
# START SYSTEMD SERVICE
|
2019-02-16 15:00:20 +01:00
|
|
|
#=================================================
|
2022-10-05 22:54:13 +02:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
2019-02-16 15:00:20 +01:00
|
|
|
|
2022-07-29 00:43:33 +02:00
|
|
|
# Start a systemd service
|
2023-11-11 23:16:43 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
2019-02-16 15:00:20 +01:00
|
|
|
|
2022-07-29 00:43:33 +02:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2019-02-16 15:00:20 +01:00
|
|
|
|
2020-05-31 23:38:48 +02:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|