diff --git a/config_panel.toml b/config_panel.toml index e69de29..f321441 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -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" diff --git a/scripts/install b/scripts/install index cf24677..e18ee0a 100644 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/upgrade b/scripts/upgrade index 33de52e..3e6dff7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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