mirror of
https://github.com/YunoHost-Apps/transmission_ynh.git
synced 2024-09-04 01:46:12 +02:00
v2
This commit is contained in:
parent
94110b4261
commit
0d120f388c
10 changed files with 195 additions and 145 deletions
|
@ -19,7 +19,7 @@ location __PATH__/ {
|
|||
}
|
||||
|
||||
location __PATH__/downloads/ {
|
||||
alias __DATADIR__/completed/;
|
||||
alias __DATA_DIR__/completed/;
|
||||
charset UTF-8;
|
||||
autoindex on;
|
||||
autoindex_exact_size off;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"blocklist-url": "http://www.example.com/blocklist",
|
||||
"cache-size-mb": 4,
|
||||
"dht-enabled": true,
|
||||
"download-dir": "__DATADIR__/completed",
|
||||
"download-dir": "__DATA_DIR__/completed",
|
||||
"download-limit": 100,
|
||||
"download-limit-enabled": 0,
|
||||
"download-queue-enabled": true,
|
||||
|
@ -20,7 +20,7 @@
|
|||
"encryption": 1,
|
||||
"idle-seeding-limit": 30,
|
||||
"idle-seeding-limit-enabled": false,
|
||||
"incomplete-dir": "__DATADIR__/progress",
|
||||
"incomplete-dir": "__DATA_DIR__/progress",
|
||||
"incomplete-dir-enabled": true,
|
||||
"lpd-enabled": false,
|
||||
"max-peers-global": 200,
|
||||
|
@ -70,6 +70,6 @@
|
|||
"upload-limit-enabled": 0,
|
||||
"upload-slots-per-torrent": 14,
|
||||
"utp-enabled": true,
|
||||
"watch-dir": "__DATADIR__/watched",
|
||||
"watch-dir": "__DATA_DIR__/watched",
|
||||
"watch-dir-enabled": true
|
||||
}
|
||||
|
|
48
manifest.toml
Normal file
48
manifest.toml
Normal file
|
@ -0,0 +1,48 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "transmission"
|
||||
name = "Transmission"
|
||||
description.en = "Fast, Easy, and Free BitTorrent Client"
|
||||
description.fr = "Client BitTorrent libre et rapide"
|
||||
|
||||
version = "3.00~ynh1"
|
||||
|
||||
maintainers = []
|
||||
|
||||
[upstream]
|
||||
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.
|
||||
|
||||
[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"]
|
||||
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, ...
|
||||
|
||||
[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.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.data_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="transmission-daemon transmission-cli transmission-common acl"
|
||||
#REMOVEME? pkg_dependencies="transmission-daemon transmission-cli transmission-common acl"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -15,17 +15,17 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
@ -36,7 +36,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
|
@ -13,58 +13,58 @@ source /usr/share/yunohost/helpers
|
|||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
|
||||
#REMOVEME? old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
|
||||
#REMOVEME? new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
#REMOVEME? # Needed for helper "ynh_add_nginx_config"
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
#REMOVEME? ynh_backup_before_upgrade
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
#REMOVEME? ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
#REMOVEME? change_domain=0
|
||||
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
#REMOVEME? change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
#REMOVEME? change_path=0
|
||||
#REMOVEME? if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
#REMOVEME? change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -81,28 +81,30 @@ ynh_systemd_action --service_name=transmission-daemon --action="stop"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
#REMOVEME? domain="$old_domain"
|
||||
#REMOVEME? path="$new_path"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
#REMOVEME? ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -129,9 +131,9 @@ ynh_systemd_action --service_name=transmission-daemon --action="start"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -13,52 +13,52 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
|
||||
#REMOVEME? path=$YNH_APP_ARG_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
rpcpassword=$(ynh_string_random)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
#REMOVEME? ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=2
|
||||
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=rpcpassword --value="$rpcpassword"
|
||||
#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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=16
|
||||
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=16
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=9091)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
peer_port=$(ynh_find_port --port=51413)
|
||||
ynh_app_setting_set --app=$app --key=peer_port --value=$peer_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..."
|
||||
|
@ -68,9 +68,9 @@ ynh_exec_warn_less yunohost firewall allow Both $peer_port
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=16
|
||||
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=16
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
# Fix a stupid issue which happens sometimes ...
|
||||
# transmission-common is installed (it's a dependency of
|
||||
|
@ -80,7 +80,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
# Explicitly reinstalling the packages fixes the issue :|
|
||||
if [ ! -d /usr/share/transmission/ ]
|
||||
then
|
||||
ynh_install_app_dependencies $pkg_dependencies --reinstall
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies --reinstall
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -90,15 +90,15 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
datadir=/home/yunohost.transmission
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
#REMOVEME? data_dir=/home/yunohost.transmission
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
|
||||
|
||||
mkdir -p $datadir/{progress,completed,watched}
|
||||
mkdir -p $data_dir/{progress,completed,watched}
|
||||
|
||||
chmod -R 764 $datadir
|
||||
chmod -R 777 $datadir/watched
|
||||
chown -R debian-transmission:www-data "$datadir"
|
||||
chown -R debian-transmission: $datadir/{progress,watched}
|
||||
chmod -R 764 $data_dir
|
||||
chmod -R 777 $data_dir/watched
|
||||
chown -R debian-transmission:www-data "$data_dir"
|
||||
chown -R debian-transmission: $data_dir/{progress,watched}
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -116,11 +116,11 @@ ynh_script_progression --message="Adding a configuration file..." --weight=2
|
|||
# Transmission has to be stopped before modifying its config
|
||||
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
||||
|
||||
if [ "$path_url" != "/" ]
|
||||
if [ "$path" != "/" ]
|
||||
then
|
||||
path_less="$path_url/"
|
||||
path_less="$path/"
|
||||
else
|
||||
path_less="$path_url"
|
||||
path_less="$path"
|
||||
fi
|
||||
|
||||
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
|
||||
|
@ -145,11 +145,11 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=4
|
|||
|
||||
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="$datadir" --dest_dir="share/Torrents"
|
||||
ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="share/Torrents"
|
||||
# And share completed directory
|
||||
ynh_multimedia_addfolder --source_dir="$datadir/completed" --dest_dir="share/Torrents"
|
||||
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="$datadir/watched" --dest_dir="share/Torrent to download"
|
||||
ynh_multimedia_addfolder --source_dir="$data_dir/watched" --dest_dir="share/Torrent to download"
|
||||
|
||||
#=================================================
|
||||
# PATCH SOURCE TO ADD A DOWNLOAD BUTTON
|
||||
|
@ -179,16 +179,16 @@ ynh_systemd_action --service_name=transmission-daemon --action="start"
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
ynh_permission_create --permission="rpc" --url="/transmission/rpc" --allowed="visitors" --show_tile="false" --protected="true"
|
||||
#REMOVEME? ynh_permission_create --permission="rpc" --url="/transmission/rpc" --allowed="visitors" --show_tile="false" --protected="true"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
#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
|
||||
|
@ -45,10 +45,10 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=9
|
||||
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=9
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
#REMOVEME? ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
|
@ -89,10 +89,10 @@ fi
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=debian-transmission
|
||||
#REMOVEME? ynh_system_user_delete --username=debian-transmission
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -14,53 +14,53 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
#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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=16
|
||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=16
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
|
||||
mkdir -p $datadir/{progress,completed,watched}
|
||||
mkdir -p $data_dir/{progress,completed,watched}
|
||||
|
||||
chmod -R 764 $datadir
|
||||
chmod -R 777 $datadir/watched
|
||||
chown -R debian-transmission:www-data "$datadir"
|
||||
chown -R debian-transmission: $datadir/{progress,watched}
|
||||
chmod -R 764 $data_dir
|
||||
chmod -R 777 $data_dir/watched
|
||||
chown -R debian-transmission:www-data "$data_dir"
|
||||
chown -R debian-transmission: $data_dir/{progress,watched}
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
|
@ -107,11 +107,11 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=4
|
|||
|
||||
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="$datadir" --dest_dir="share/Torrents"
|
||||
ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="share/Torrents"
|
||||
# And share completed directory
|
||||
ynh_multimedia_addfolder --source_dir="$datadir/completed" --dest_dir="share/Torrents"
|
||||
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="$datadir/watched" --dest_dir="share/Torrent to download"
|
||||
ynh_multimedia_addfolder --source_dir="$data_dir/watched" --dest_dir="share/Torrent to download"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
|
|
|
@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
rpcpassword=$(ynh_app_setting_get --app=$app --key=rpcpassword)
|
||||
#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
|
||||
|
@ -32,17 +32,17 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
|
||||
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_backup_before_upgrade
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
#REMOVEME? ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -60,29 +60,29 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=4
|
|||
|
||||
if [ -z "$port" ]; then
|
||||
port=9091
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
fi
|
||||
|
||||
if [ -z "$peer_port" ]; then
|
||||
peer_port=51413
|
||||
ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port
|
||||
#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 datadir doesn't exist, create it
|
||||
if [ -z "$datadir" ]; then
|
||||
datadir=/home/yunohost.transmission
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
# 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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=7
|
||||
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=7
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -99,12 +99,12 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
mkdir -p $datadir/{progress,completed,watched}
|
||||
mkdir -p $data_dir/{progress,completed,watched}
|
||||
|
||||
chmod -R 764 $datadir
|
||||
chmod -R 777 $datadir/watched
|
||||
chown -R debian-transmission:www-data "$datadir"
|
||||
chown -R debian-transmission: $datadir/{progress,watched}
|
||||
chmod -R 764 $data_dir
|
||||
chmod -R 777 $data_dir/watched
|
||||
chown -R debian-transmission:www-data "$data_dir"
|
||||
chown -R debian-transmission: $data_dir/{progress,watched}
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
|
@ -114,11 +114,11 @@ ynh_script_progression --message="Updating a configuration file..." --weight=2
|
|||
# Transmission has to be stopped before modifying its config
|
||||
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
||||
|
||||
if [ "$path_url" != "/" ]
|
||||
if [ "$path" != "/" ]
|
||||
then
|
||||
path_less="$path_url/"
|
||||
path_less="$path/"
|
||||
else
|
||||
path_less="$path_url"
|
||||
path_less="$path"
|
||||
fi
|
||||
|
||||
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
|
||||
|
@ -143,11 +143,11 @@ 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="$datadir" --dest_dir="share/Torrents"
|
||||
ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="share/Torrents"
|
||||
# And share completed directory
|
||||
ynh_multimedia_addfolder --source_dir="$datadir/completed" --dest_dir="share/Torrents"
|
||||
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="$datadir/watched" --dest_dir="share/Torrent to download"
|
||||
ynh_multimedia_addfolder --source_dir="$data_dir/watched" --dest_dir="share/Torrent to download"
|
||||
|
||||
#=================================================
|
||||
# PATCH SOURCE TO ADD A DOWNLOAD BUTTON
|
||||
|
@ -179,9 +179,9 @@ ynh_systemd_action --service_name=transmission-daemon --action="start"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Add table
Reference in a new issue