From e3addc15e5dd59de1acbb562768cf6397fd7c839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 4 Nov 2022 17:46:39 +0100 Subject: [PATCH] v2 --- check_process | 3 -- manifest.json | 51 -------------------------------- manifest.toml | 8 ++--- scripts/backup | 18 ------------ scripts/install | 77 ++++--------------------------------------------- scripts/remove | 33 --------------------- scripts/restore | 30 +------------------ scripts/upgrade | 50 ++------------------------------ 8 files changed, 12 insertions(+), 258 deletions(-) delete mode 100644 manifest.json diff --git a/check_process b/check_process index f3e8ed7..64c779f 100644 --- a/check_process +++ b/check_process @@ -13,7 +13,6 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=295026023fdb74f5bf210093f5b0622bae2982f3 upgrade=1 from_commit=bbce7cfa6cb8916671a4fec9e8a73095f74a0c9d backup_restore=1 multi_instance=1 @@ -22,8 +21,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=295026023fdb74f5bf210093f5b0622bae2982f3 - name= Upgrade to 1.2.12 (#10) ; commit=bbce7cfa6cb8916671a4fec9e8a73095f74a0c9d name= Upgrade to 1.3.7 (#63) manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=4533& diff --git a/manifest.json b/manifest.json deleted file mode 100644 index a113cff..0000000 --- a/manifest.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "Simple Torrent", - "id": "simple-torrent", - "packaging_format": 1, - "description": { - "en": "Self-hosted remote torrent client", - "fr": "Client torrent distant auto-hébergé" - }, - "version": "1.3.9~ynh4", - "url": "https://github.com/boypt/simple-torrent", - "upstream": { - "license": "AGPL-3.0-only", - "website": "https://github.com/boypt/simple-torrent", - "admindoc": "https://github.com/boypt/simple-torrent/wiki", - "code": "https://github.com/boypt/simple-torrent" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "eric_G" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/simple-torrent", - "default": "/simple-torrent" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, Simple Torrent will be accessible by people who do not have an account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, Simple Torrent sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 3504db6..fd03351 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,14 +14,12 @@ license = "AGPL-3.0-only" website = "https://github.com/boypt/simple-torrent" admindoc = "https://github.com/boypt/simple-torrent/wiki" code = "https://github.com/boypt/simple-torrent" -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/armel), for example: ["amd64", "i386"] +yunohost = ">= 11.1.0" +architectures = ["amd64","i386", "arm64"] multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant" +ldap = "false" # FIXME: replace with true, false, or "not_relevant" sso = "?" # FIXME: replace with true, false, or "not_relevant" 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, ... diff --git a/scripts/backup b/scripts/backup index 95adb05..2d322c2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,24 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#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 #================================================= diff --git a/scripts/install b/scripts/install index 16e3a23..84893aa 100644 --- a/scripts/install +++ b/scripts/install @@ -9,81 +9,28 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# 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? is_public=$YNH_APP_ARG_IS_PUBLIC - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -# Stop if architecture is 32-bit ARM -case $YNH_ARCH in - arm|armhf) ynh_die --message="Sorry, your architecture $YNH_ARCH is not supported by $app. Aborting.";; - *) ;; -esac - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# 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 - #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=0 +ynh_script_progression --message="Finding an available port..." --weight=0 # Find an available port -#REMOVEME? port=$(ynh_find_port --port=3000) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port +port=$(ynh_find_port --port=3000) +ynh_app_setting_set --app=$app --key=port --value=$port -# Find incoming port peers connect to -#REMOVEME? peer_port=$(ynh_find_port --port=50007) +peer_port=$(ynh_find_port --port=50007) # Open this port ynh_script_progression --message="Configuring firewall..." --weight=1 ynh_exec_warn_less yunohost firewall allow Both $peer_port -#REMOVEME? ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir +ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=4 -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir - # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$install_dir --source_id=$YNH_ARCH @@ -110,9 +57,6 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -#REMOVEME? data_dir=/home/yunohost.app/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir - mkdir -p $data_dir/{torrents,downloads} # Set permissions to app files @@ -149,17 +93,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service ynh_systemd_action --service_name=$app --action=start --log_path=systemd -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary or protect it -#REMOVEME? if [ $is_public -eq 1 ] -then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/remove b/scripts/remove index c7273b9..702a2fd 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,21 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#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? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#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 #================================================= # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= @@ -43,14 +28,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing $app main directory..." --weight=6 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE DATA DIR #================================================= @@ -80,16 +57,6 @@ then ynh_exec_warn_less yunohost firewall disallow Both $peer_port fi -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 17ae5ba..1a9c817 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,32 +9,12 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading settings..." --weight=1 -#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? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#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..." --weight=2 - -#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir " +peer_port=$(ynh_app_setting_get --app=$app --key=peer_port) #================================================= # STANDARD RESTORATION STEPS @@ -52,14 +32,6 @@ ynh_script_progression --message="Configuring firewall..." --weight=3 ynh_exec_warn_less yunohost firewall allow Both $peer_port -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir - #================================================= # RESTORE THE APP MAIN DIR #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6572357..1333a23 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,15 +12,10 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 +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? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? peer_port=$(ynh_app_setting_get --app=$app --key=peer_port) +port=$(ynh_app_setting_get --app=$app --key=port) +peer_port=$(ynh_app_setting_get --app=$app --key=peer_port) #================================================= # CHECK VERSION @@ -28,37 +23,6 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=4 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # 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 - -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -case $YNH_ARCH in - arm|armhf) ynh_die --message="Sorry, your architecture $YNH_ARCH is not supported by $app. Aborting.";; - *) ;; -esac - -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -68,14 +32,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=stop --log_path=systemd -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #=================================================