2023-02-26 22:48:57 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SYSTEM CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1
|
|
|
|
|
|
|
|
# Create a dedicated NGINX config using the conf/nginx.conf template
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
# Create a dedicated systemd config
|
|
|
|
ynh_add_systemd_config
|
|
|
|
|
2023-02-26 22:48:15 +01:00
|
|
|
yunohost service add $app --description="qBittorrent-nox service" --log="$install_dir/.local/share/data/qBittorrent/logs/qbittorrent.log"
|
2023-02-26 22:48:57 +01:00
|
|
|
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
|
|
ynh_use_logrotate
|
|
|
|
|
2023-03-02 15:27:11 +01:00
|
|
|
mkdir -p "$install_dir/.config/qBittorrent/"
|
|
|
|
|
|
|
|
ynh_add_config --template="../conf/qBittorrent.conf" --destination="$install_dir/.config/qBittorrent/qBittorrent.conf"
|
|
|
|
|
|
|
|
chown $app: -R "$install_dir/.config/"
|
|
|
|
chmod 600 "$install_dir/.config/qBittorrent/qBittorrent.conf"
|
2023-02-26 22:48:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
2023-02-26 22:48:15 +01:00
|
|
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
2023-02-26 22:48:57 +01:00
|
|
|
#=================================================
|
2023-02-26 22:48:15 +01:00
|
|
|
ynh_script_progression --message="Adding multimedia directories..." --weight=6
|
2023-02-26 22:48:57 +01:00
|
|
|
|
2023-02-26 22:48:15 +01:00
|
|
|
# Build YunoHost multimedia directories
|
|
|
|
ynh_multimedia_build_main_dir
|
2023-02-26 22:48:57 +01:00
|
|
|
|
2023-03-02 15:27:11 +01:00
|
|
|
ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="share/Torrents"
|
2023-02-26 22:48:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
|
|
|
|
# Start a systemd service
|
2023-03-03 02:21:48 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action=start --line_match="Web UI: Now listening on IP: \*, port: $port" --log_path="$install_dir/.local/share/data/qBittorrent/logs/qbittorrent.log" --timeout=60
|
2023-02-26 22:48:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|