2017-07-15 11:39:52 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-03-19 23:23:41 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK VERSION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Stopping a systemd service..."
|
|
|
|
|
|
|
|
ynh_systemd_action --service_name=$app --action="stop"
|
|
|
|
ynh_systemd_action --service_name=$app-rtorrent --action="stop"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Upgrading 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"
|
2017-07-19 22:40:20 +02:00
|
|
|
fi
|
2017-07-18 23:04:22 +02:00
|
|
|
|
2023-10-31 21:25:40 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2022-03-19 23:23:41 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# UPGRADE DEPENDENCIES
|
|
|
|
#=================================================
|
2023-10-31 21:39:18 +01:00
|
|
|
ynh_script_progression --message="Upgrading dependencies..."
|
2022-03-19 23:23:41 +01:00
|
|
|
|
2022-03-25 20:27:34 +01:00
|
|
|
tmpdir="$(mktemp -d)"
|
2024-03-11 16:04:35 +01:00
|
|
|
ynh_setup_source --dest_dir="$tmpdir" --full_replace=1
|
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
|
|
|
#=================================================
|
|
|
|
# SPECIFIC UPGRADE
|
|
|
|
#=================================================
|
|
|
|
# SETUP SYSTEMD
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrading systemd configuration..."
|
|
|
|
|
|
|
|
# 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
|
2023-10-31 21:44:21 +01:00
|
|
|
yunohost service add $app-rtorrent --needs_exposed_ports $port_rt
|
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="Upgrade of $app completed"
|