mirror of
https://github.com/YunoHost-Apps/flood_ynh.git
synced 2024-09-03 18:36:20 +02:00
83 lines
2.7 KiB
Bash
Executable file
83 lines
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# INSTALL DEPENDENCIES
|
|
#=================================================
|
|
ynh_script_progression --message="Installing dependencies..."
|
|
|
|
tmpdir="$(mktemp -d)"
|
|
ynh_setup_source --dest_dir="$tmpdir"
|
|
dpkg -i $tmpdir/flood-linux.deb
|
|
ynh_secure_remove --file="$tmpdir"
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..."
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
mkdir -p "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:$app "$install_dir"
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring NGINX web server..."
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..."
|
|
|
|
ynh_add_config --template="rtorrent.rc" --destination="$install_dir/rtorrent.rc"
|
|
|
|
chmod 400 "$install_dir/rtorrent.rc"
|
|
chown $app:$app "$install_dir/rtorrent.rc"
|
|
|
|
#=================================================
|
|
# 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
|
|
yunohost service add $app-rtorrent --needs_exposed_ports $port_rt
|
|
|
|
#=================================================
|
|
# 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"
|