From 7d887f6bc1e29ce94de703517d5302580cbb8a7e Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 3 Mar 2018 18:39:57 +0100 Subject: [PATCH 1/2] Add acl dependency --- scripts/install | 2 +- scripts/remove | 3 +-- scripts/restore | 2 +- scripts/upgrade | 6 ++++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 3cfff11..219a2d3 100644 --- a/scripts/install +++ b/scripts/install @@ -66,7 +66,7 @@ ynh_app_setting_set $app peer_port $peer_port # INSTALL TRANSMISSION #================================================= -ynh_package_install transmission-daemon +ynh_install_app_dependencies transmission-daemon acl #================================================= # NGINX CONFIGURATION diff --git a/scripts/remove b/scripts/remove index f89c7f8..969905b 100644 --- a/scripts/remove +++ b/scripts/remove @@ -25,8 +25,7 @@ peer_port=$(ynh_app_setting_get $app peer_port) # REMOVE TRANSMISSION-DAEMON #================================================= -ynh_apt purge transmission-daemon -ynh_package_autoremove transmission-common +ynh_remove_app_dependencies #================================================= # DISABLE SERVICE IN ADMIN PANEL diff --git a/scripts/restore b/scripts/restore index bb6e1ce..7cddedd 100644 --- a/scripts/restore +++ b/scripts/restore @@ -60,7 +60,7 @@ yunohost firewall allow TCP $peer_port >/dev/null 2>&1 # REINSTALL TRANSMISSION #================================================= -ynh_package_install transmission-daemon +ynh_install_app_dependencies transmission-daemon acl #================================================= # RESTORE TRANSMISSION CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 45f99fa..f7d03f3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,6 +63,12 @@ path_url=$(ynh_normalize_url_path $path_url) [ "$path_url" = "/" ] || path_url=${path_url}/ ynh_add_nginx_config +#================================================= +# INSTALL DEPENDENCIES +#================================================= + +ynh_install_app_dependencies transmission-daemon acl + #================================================= # SPECIFIC UPGRADE #================================================= From 5d75aa4a75749558bc16045dd79925d8c0dc172a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 3 Mar 2018 18:53:33 +0100 Subject: [PATCH 2/2] peer_port also on UDP --- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 2 +- scripts/upgrade | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 3cfff11..ca6a5ec 100644 --- a/scripts/install +++ b/scripts/install @@ -59,7 +59,7 @@ ynh_app_setting_set $app port $port # Find a free port peer_port=$(ynh_find_port 51413) # Open this port -yunohost firewall allow TCP $peer_port >/dev/null 2>&1 +yunohost firewall allow Both $peer_port >/dev/null 2>&1 ynh_app_setting_set $app peer_port $peer_port #================================================= diff --git a/scripts/remove b/scripts/remove index f89c7f8..ccac21f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -51,7 +51,7 @@ fi if yunohost firewall list | grep -q "\- $peer_port$" then echo "Close port $peer_port" - yunohost firewall disallow TCP $peer_port 2>&1 + yunohost firewall disallow Both $peer_port 2>&1 fi #================================================= diff --git a/scripts/restore b/scripts/restore index bb6e1ce..b9ccb69 100644 --- a/scripts/restore +++ b/scripts/restore @@ -52,7 +52,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= yunohost firewall allow --no-upnp TCP $port >/dev/null 2>&1 -yunohost firewall allow TCP $peer_port >/dev/null 2>&1 +yunohost firewall allow Both $peer_port >/dev/null 2>&1 #================================================= # SPECIFIC RESTORE diff --git a/scripts/upgrade b/scripts/upgrade index 45f99fa..7ebcab0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,6 +33,9 @@ if [ -z $peer_port ]; then ynh_app_setting_set $app peer_port $peer_port fi +# Add peer_port also on UDP. +yunohost firewall allow UDP $peer_port >/dev/null 2>&1 + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #=================================================