1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/transmission_ynh.git synced 2024-09-04 01:46:12 +02:00
This commit is contained in:
Éric Gaspar 2023-04-02 15:13:23 +02:00
parent 0d120f388c
commit 518d88c58e
9 changed files with 44 additions and 319 deletions

View file

@ -1,26 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
path="/path"
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=0
upgrade=1
# 2.94~ynh1
upgrade=1 from_commit=c07a09d875cf11b4e3a3147e9e35ef5e06788cff
backup_restore=1
multi_instance=0
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=c07a09d875cf11b4e3a3147e9e35ef5e06788cff
name=2.94~ynh1
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666&

View file

@ -29,7 +29,7 @@
"peer-id-ttl-hours": 6,
"peer-limit-global": 200,
"peer-limit-per-torrent": 50,
"peer-port": __PEER_PORT__,
"peer-port": __PORT_PEER__,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,

View file

@ -1,45 +0,0 @@
{
"name": "Transmission",
"id": "transmission",
"packaging_format": 1,
"description": {
"en": "Fast, Easy, and Free BitTorrent Client",
"fr": "Client BitTorrent libre et rapide"
},
"version": "3.00~ynh1",
"url": "https://www.transmissionbt.com",
"upstream": {
"license": "GPL-3.0",
"website": "https://www.transmissionbt.com",
"admindoc": "https://github.com/transmission/transmission/wiki",
"code": "https://github.com/transmission/transmission",
"cpe": "cpe:2.3:a:transmissionbt:transmission"
},
"license": "GPL-3.0",
"maintainer": {
"name": "",
"email": ""
},
"requirements": {
"yunohost": ">= 11.0.9"
},
"multi_instance": false,
"services": [
"nginx",
"transmission-daemon"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/torrent",
"default": "/torrent"
}
]
}
}

View file

@ -14,30 +14,34 @@ license = "GPL-3.0"
website = "https://www.transmissionbt.com"
admindoc = "https://github.com/transmission/transmission/wiki"
code = "https://github.com/transmission/transmission"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
cpe = "cpe:2.3:a:transmissionbt:transmission"
[integration]
yunohost = ">= 11.0.9"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
yunohost = ">= 11.1.15"
architectures = "all"
multi_instance = false
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path"
default = "/torrent"
[resources]
[resources.ports]
main.default = 9091
main.exposed = "TCP"
peer.default = 51413
peer.exposed = "Both"
[resources.system_user]
[resources.install_dir]
@ -46,3 +50,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.permissions]
main.url = "/"
rpc.url = "/transmission/rpc"
rpc.allowed = "visitors"
rpc.show_tile = false
rpc.protected = true
[resources.apt]
packages = "transmission-daemon transmission-cli transmission-common acl"

View file

@ -9,79 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
#REMOVEME? path=$YNH_APP_ARG_PATH
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
rpcpassword=$(ynh_string_random)
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
#REMOVEME? ynh_script_progression --message="Validating installation parameters..."
# Register (book) web path
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
#REMOVEME? ynh_app_setting_set --app=$app --key=rpcpassword --value="$rpcpassword"
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=16
# Find an available port
#REMOVEME? port=$(ynh_find_port --port=9091)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#REMOVEME? peer_port=$(ynh_find_port --port=51413)
#REMOVEME? ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port
# Open the port
ynh_script_progression --message="Configuring firewall..."
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
ynh_exec_warn_less yunohost firewall allow Both $peer_port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=16
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
# Fix a stupid issue which happens sometimes ...
# transmission-common is installed (it's a dependency of
# transmission-daemon) but somehow the files it's supposed
# to add ain't there ... and possibly also the transmission user
# is missing.
# Explicitly reinstalling the packages fixes the issue :|
if [ ! -d /usr/share/transmission/ ]
then
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies --reinstall
fi
ynh_app_setting_set --app=$app --key=rpcpassword --value="$rpcpassword"
#=================================================
# SPECIFIC SETUP
@ -90,9 +23,6 @@ fi
#=================================================
ynh_script_progression --message="Creating a data directory..."
#REMOVEME? data_dir=/home/yunohost.transmission
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
mkdir -p $data_dir/{progress,completed,watched}
chmod -R 764 $data_dir
@ -176,20 +106,6 @@ ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=transmission-daemon --action="start"
#=================================================
# SETUP SSOWAT
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
#REMOVEME? ynh_permission_create --permission="rpc" --url="/transmission/rpc" --allowed="visitors" --show_tile="false" --protected="true"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,18 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#=================================================
# STANDARD REMOVE
#=================================================
@ -42,30 +30,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=9
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
if yunohost firewall list | grep -q "\- $peer_port$"
then
ynh_script_progression --message="Closing port $peer_port..."
ynh_exec_warn_less yunohost firewall disallow Both $peer_port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
@ -84,16 +48,6 @@ then
sysctl --load=/etc/sysctl.d/90-transmission.conf
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
#REMOVEME? ynh_system_user_delete --username=debian-transmission
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,44 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=16
# Define and install dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================

View file

@ -9,41 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#REMOVEME? rpcpassword=$(ynh_app_setting_get --app=$app --key=rpcpassword)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -53,37 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=transmission-daemon --action="stop"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=4
if [ -z "$port" ]; then
port=9091
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
fi
if [ -z "$peer_port" ]; then
peer_port=51413
#REMOVEME? ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port
fi
# Add peer_port also on UDP.
ynh_exec_warn_less yunohost firewall allow UDP $peer_port
# If data_dir doesn't exist, create it
if [ -z "$data_dir" ]; then
data_dir=/home/yunohost.transmission
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=7
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -142,10 +82,13 @@ fi
ynh_script_progression --message="Adding multimedia directories..." --weight=3
ynh_multimedia_build_main_dir
# Set rights on transmission directory (parent need to be readable by other, and progress need to be writable by multimedia. Because files will move)
ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="share/Torrents"
# And share completed directory
ynh_multimedia_addfolder --source_dir="$data_dir/completed" --dest_dir="share/Torrents"
# Share also watched directory, to allow to use it easily
ynh_multimedia_addfolder --source_dir="$data_dir/watched" --dest_dir="share/Torrent to download"
@ -158,6 +101,7 @@ if ! grep --quiet "Inserted by Yunohost install script" /usr/share/transmission/
then
cat ../sources/extra_files/app/ynh_common.css >> /usr/share/transmission/web/style/transmission/common.css
fi
ynh_replace_string "<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div>$" "<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div><div id=\"toolbar-separator\"></div><a href=\"../../downloads/\" id=\"toolbar-downloads\" title=\"Downloads\" target=\"_blank\"></a>" /usr/share/transmission/web/index.html
#=================================================
@ -176,13 +120,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=transmission-daemon --action="start"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

16
tests.toml Normal file
View file

@ -0,0 +1,16 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------
exclude = ["install.multi"]
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.c07a09d8.name = "Upgrade from 2.94~ynh1"