1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/simple-torrent_ynh.git synced 2024-09-03 20:26:18 +02:00
This commit is contained in:
ericgaspar 2022-01-19 15:19:41 +01:00
parent a19d3e8566
commit 98128ad54d
3 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,22 @@
version = "1.0"
[main]
name = "Simple Torrent configuration"
services = ["__APP__"]
[main.config]
name = "Configuration Options"
[main.config.download_directory]
ask = "Set download directory"
type = "string"
default = "/home/yunohost.app/__APP__/downloads"
help = "The directory where downloaded file saves."
bind = "DownloadDirectory:__FINALPATH__/config.yml"
[main.config.watch_directory]
ask = "Set watch directory"
type = "string"
default = "/home/yunohost.app/__APP__/torrents"
help = "The directory where downloaded file saves."
bind = "WatchDirectory:__FINALPATH__/config.yml"

View file

@ -27,6 +27,9 @@ architecture=$YNH_ARCH
app=$YNH_APP_INSTANCE_NAME
download_directory="/home/yunohost.app/$app/downloads"
watch_directory="/home/yunohost.app/$app/torrents"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
@ -51,6 +54,8 @@ 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=download_directory --value=$download_directory
ynh_app_setting_set --app=$app --key=watch_directory --value=$watch_directory
#=================================================
# STANDARD MODIFICATIONS

View file

@ -23,6 +23,9 @@ port=$(ynh_app_setting_get --app=$app --key=port)
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
architecture=$YNH_ARCH
download_directory=$(ynh_app_setting_get --app=$app --key=download_directory)
watch_directory=$(ynh_app_setting_get --app=$app --key=watch_directory)
#=================================================
# CHECK VERSION
#=================================================
@ -54,6 +57,16 @@ then
ynh_die --message="Sorry, this app cannot be installed on a 32-bit ARM machine."
fi
if [ -z "$download_directory" ]; then
download_directory="/home/yunohost.app/$app/downloads"
ynh_app_setting_set --app=$app --key=download_directory --value=$download_directory
fi
if [ -z "$watch_directory" ]; then
watch_directory="/home/yunohost.app/$app/torrents"
ynh_app_setting_set --app=$app --key=watch_directory --value=$watch_directory
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all