2017-07-15 11:39:52 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-03-19 23:23:41 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-19 23:33:47 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2022-03-19 23:23:41 +01:00
|
|
|
#=================================================
|
|
|
|
# INSTALL DEPENDENCIES
|
|
|
|
#=================================================
|
2023-10-31 21:39:18 +01:00
|
|
|
ynh_script_progression --message="Installing dependencies..."
|
2022-03-19 23:23:41 +01:00
|
|
|
|
2022-03-25 20:27:34 +01:00
|
|
|
tmpdir="$(mktemp -d)"
|
2023-10-31 21:39:18 +01:00
|
|
|
ynh_setup_source --dest_dir="$tmpdir"
|
2022-03-25 20:27:34 +01:00
|
|
|
dpkg -i $tmpdir/flood-linux.deb
|
|
|
|
ynh_secure_remove --file="$tmpdir"
|
|
|
|
|
2022-03-19 23:23:41 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Setting up source files..."
|
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-10-31 21:25:40 +01:00
|
|
|
mkdir -p "$install_dir"
|
2022-03-19 23:23:41 +01:00
|
|
|
|
2023-10-31 21:25:40 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:$app "$install_dir"
|
2022-03-19 23:23:41 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring NGINX web server..."
|
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
2018-02-11 20:23:54 +01:00
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2022-03-19 23:23:41 +01:00
|
|
|
#=================================================
|
|
|
|
# ADD A CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding a configuration file..."
|
|
|
|
|
2023-10-31 21:39:18 +01:00
|
|
|
ynh_add_config --template="rtorrent.rc" --destination="$install_dir/rtorrent.rc"
|
2022-03-19 23:23:41 +01:00
|
|
|
|
2023-10-31 21:25:40 +01:00
|
|
|
chmod 400 "$install_dir/rtorrent.rc"
|
|
|
|
chown $app:$app "$install_dir/rtorrent.rc"
|
2022-03-19 23:23:41 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SETUP SYSTEMD
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring a systemd service..."
|
|
|
|
|
|
|
|
# Create a dedicated systemd config
|
|
|
|
ynh_add_systemd_config --service=$app --template="flood.service"
|
|
|
|
ynh_add_systemd_config --service=$app-rtorrent --template="rtorrent.service"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
|
|
|
|
|
|
yunohost service add $app
|
2022-03-20 01:41:52 +01:00
|
|
|
yunohost service add $app-rtorrent --needs_exposed_ports $rt_port
|
2022-03-19 23:23:41 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..."
|
|
|
|
|
|
|
|
# Start a systemd service
|
|
|
|
ynh_systemd_action --service_name=$app --action="start"
|
|
|
|
ynh_systemd_action --service_name=$app-rtorrent --action="start"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Installation of $app completed"
|