From d7822289a13590d3727e446667afa462dae3f58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 1 May 2023 19:02:55 +0200 Subject: [PATCH 1/8] v2 --- conf/systemd.service | 4 ++-- manifest.toml | 37 +++++++++++++++++++++++++++++++++++ scripts/_common.sh | 2 +- scripts/backup | 14 +++++++------- scripts/install | 46 ++++++++++++++++++++++---------------------- scripts/remove | 22 ++++++++++----------- scripts/restore | 26 ++++++++++++------------- scripts/upgrade | 40 +++++++++++++++++++------------------- 8 files changed, 114 insertions(+), 77 deletions(-) create mode 100644 manifest.toml diff --git a/conf/systemd.service b/conf/systemd.service index 59ff1b9..c04b968 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,8 +7,8 @@ User=__APP__ Group=__APP__ Type=simple UMask=000 -WorkingDirectory=__FINALPATH__ -ExecStart=__FINALPATH__/opentracker & +WorkingDirectory=__INSTALL_DIR__ +ExecStart=__INSTALL_DIR__/opentracker & RestartSec=15 Restart=always diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..404fa0d --- /dev/null +++ b/manifest.toml @@ -0,0 +1,37 @@ +packaging_format = 2 + +id = "opentracker" +name = "OpenTracker" +description.en = "Bittorrent tracker" +description.fr = "Tracker Bittorrent" + +version = "1.0~ynh3" + +maintainers = ["liberodark"] + +[upstream] +license = "Beerware" +website = "http://erdgeist.org/arts/software/opentracker/" +demo = "https://dispatch.khlieng.com/connect" +admindoc = "http://erdgeist.org/arts/software/opentracker/" +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 = ">= 4.3.0" +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] + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] diff --git a/scripts/_common.sh b/scripts/_common.sh index 6119194..c8c4184 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="libowfat-dev zlib1g-dev make build-essential" +#REMOVEME? pkg_dependencies="libowfat-dev zlib1g-dev make build-essential" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index cc98370..d6cea6e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,21 +14,21 @@ 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_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 -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -39,7 +39,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP SYSTEMD diff --git a/scripts/install b/scripts/install index be8668e..2ad13b1 100644 --- a/scripts/install +++ b/scripts/install @@ -13,43 +13,43 @@ 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 #================================================= # Retrieve arguments -#domain=$YNH_APP_ARG_DOMAIN -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? #domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/opt/yunohost/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" +#REMOVEME? install_dir=/opt/yunohost/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die "This path already contains a folder" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 -#ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? #ynh_app_setting_set --app=$app --key=domain --value=$domain #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 +#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 # Find a free port -port=$(ynh_find_port --port=6969) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=6969) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port # Open the port ynh_exec_warn_less yunohost firewall allow Both $port @@ -57,28 +57,28 @@ ynh_exec_warn_less yunohost firewall allow Both $port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=2 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=2 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Installing OpenTracker..." --weight=5 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -git clone git://erdgeist.org/opentracker "$final_path" --quiet -cp ../conf/Makefile $final_path/Makefile -cp ../conf/opentracker.conf.sample $final_path/opentracker.conf -pushd $final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir +git clone git://erdgeist.org/opentracker "$install_dir" --quiet +cp ../conf/Makefile $install_dir/Makefile +cp ../conf/opentracker.conf.sample $install_dir/opentracker.conf +pushd $install_dir ynh_exec_warn_less make popd @@ -97,8 +97,8 @@ ynh_add_systemd_config #================================================= # Set permissions to app files -chown -R $app: $final_path -chmod +x $final_path/$app +chown -R $app: $install_dir +chmod +x $install_dir/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/remove b/scripts/remove index 11f4b5c..35e74ab 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,13 +12,13 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -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) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#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) #================================================= # STANDARD REMOVE @@ -44,18 +44,18 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=2 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=2 # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # CLOSE A PORT @@ -72,10 +72,10 @@ fi #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=2 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=2 # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 7d4c56b..9678167 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,53 +13,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..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? app=$YNH_APP_INSTANCE_NAME +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=2 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +#REMOVEME? ynh_system_user_create --username=$app #================================================= # RESTORE USER RIGHTS #================================================= # Restore permissions on app files -chown -R $app: $final_path -chmod +x $final_path/$app +chown -R $app: $install_dir +chmod +x $install_dir/$app #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=2 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=2 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 8607eb4..d848c84 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,12 +12,12 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION @@ -28,16 +28,16 @@ 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=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # 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 @@ -51,10 +51,10 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$ #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=5 +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=5 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -63,12 +63,12 @@ ynh_system_user_create --username=$app --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 - ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" # Download, check integrity, uncompress and patch the source from app.src - git clone git://erdgeist.org/opentracker "$final_path" --quiet - cp ../conf/Makefile $final_path/Makefile - cp ../conf/opentracker.conf.sample $final_path/opentracker.conf - pushd $final_path + git clone git://erdgeist.org/opentracker "$install_dir" --quiet + cp ../conf/Makefile $install_dir/Makefile + cp ../conf/opentracker.conf.sample $install_dir/opentracker.conf + pushd $install_dir ynh_exec_warn_less make popd fi @@ -76,9 +76,9 @@ fi #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=2 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=2 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # SETUP SYSTEMD @@ -95,8 +95,8 @@ ynh_add_systemd_config #================================================= # Set permissions on app files -chown -R $app: $final_path -chmod +x $final_path/$app +chown -R $app: $install_dir +chmod +x $install_dir/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST From 0d492e1066cd9cecd9a3012d7f70236394bd1567 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 1 May 2023 17:03:00 +0000 Subject: [PATCH 2/8] Auto-update README --- README.md | 3 ++- README_fr.md | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 19a56b5..61c12a8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # OpenTracker for YunoHost -[![Integration level](https://dash.yunohost.org/integration/opentracker.svg)](https://dash.yunohost.org/appci/app/opentracker) ![Working status](https://ci-apps.yunohost.org/ci/badges/opentracker.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/opentracker.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/opentracker.svg)](https://dash.yunohost.org/appci/app/opentracker) ![Working status](https://ci-apps.yunohost.org/ci/badges/opentracker.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/opentracker.maintain.svg) + [![Install OpenTracker with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=opentracker) *[Lire ce readme en français.](./README_fr.md)* diff --git a/README_fr.md b/README_fr.md index dcd5d5a..dbe2077 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,15 +5,16 @@ It shall NOT be edited by hand. # OpenTracker pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/opentracker.svg)](https://dash.yunohost.org/appci/app/opentracker) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/opentracker.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/opentracker.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/opentracker.svg)](https://dash.yunohost.org/appci/app/opentracker) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/opentracker.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/opentracker.maintain.svg) + [![Installer OpenTracker avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=opentracker) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer OpenTracker rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* +> *Ce package vous permet d’installer OpenTracker rapidement et simplement sur un serveur YunoHost. +Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* -## Vue d'ensemble +## Vue d’ensemble Tracker Bittorrent @@ -32,8 +33,8 @@ visitez `http://serverIP:6969/stats` pour afficher les statistiques du tracker. ## Documentations et ressources -* Site officiel de l'app : -* Documentation officielle de l'admin : +* Site officiel de l’app : +* Documentation officielle de l’admin : * Documentation YunoHost pour cette app : * Signaler un bug : @@ -49,4 +50,4 @@ ou sudo yunohost app upgrade opentracker -u https://github.com/YunoHost-Apps/opentracker_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file From 82e4f12c2192739cf6ae2b06b2f41c2b7baca9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 1 May 2023 19:12:55 +0200 Subject: [PATCH 3/8] fix --- doc/{DISCLAIMER.md => ADMIN.md} | 0 doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 0 manifest.json | 33 --------------- manifest.toml | 25 +++++++---- scripts/_common.sh | 3 -- scripts/backup | 20 --------- scripts/install | 60 --------------------------- scripts/remove | 47 --------------------- scripts/restore | 37 ----------------- scripts/upgrade | 41 +----------------- 10 files changed, 17 insertions(+), 249 deletions(-) rename doc/{DISCLAIMER.md => ADMIN.md} (100%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (100%) delete mode 100644 manifest.json diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 46be125..0000000 --- a/manifest.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "OpenTracker", - "id": "opentracker", - "packaging_format": 1, - "description": { - "en": "Bittorrent tracker", - "fr": "Tracker Bittorrent" - }, - "version": "1.0~ynh3", - "url": "http://erdgeist.org/arts/software/opentracker/", - "upstream": { - "license": "Beerware", - "website": "http://erdgeist.org/arts/software/opentracker/", - "demo": "https://dispatch.khlieng.com/connect", - "admindoc": "http://erdgeist.org/arts/software/opentracker/" - }, - "license": "Beerware", - "maintainer": { - "name": "liberodark", - "email": "liberodark@gmail.com" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - ] - } -} diff --git a/manifest.toml b/manifest.toml index 404fa0d..4403c99 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,24 +14,31 @@ license = "Beerware" website = "http://erdgeist.org/arts/software/opentracker/" demo = "https://dispatch.khlieng.com/connect" admindoc = "http://erdgeist.org/arts/software/opentracker/" -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 = ">= 4.3.0" -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.18" +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] [resources] + + [resources.ports] + + main.default = 6969 + main.exposed = "Both" + [resources.system_user] [resources.install_dir] [resources.permissions] + + [resources.apt] + packages = "libowfat-dev zlib1g-dev make build-essential" diff --git a/scripts/_common.sh b/scripts/_common.sh index c8c4184..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="libowfat-dev zlib1g-dev make build-essential" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index d6cea6e..ac5b947 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,26 +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_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? port=$(ynh_app_setting_get --app=$app --key=port) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/install b/scripts/install index 2ad13b1..ef3fbe6 100644 --- a/scripts/install +++ b/scripts/install @@ -9,66 +9,6 @@ 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 -#================================================= - -# Retrieve arguments -#REMOVEME? #domain=$YNH_APP_ARG_DOMAIN -#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 - -#REMOVEME? install_dir=/opt/yunohost/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die "This path already contains a folder" - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 - -#REMOVEME? #ynh_app_setting_set --app=$app --key=domain --value=$domain - -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find a free port -#REMOVEME? port=$(ynh_find_port --port=6969) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - -# Open the port -ynh_exec_warn_less yunohost firewall allow Both $port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=2 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# 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" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/remove b/scripts/remove index 35e74ab..7288418 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,17 +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) - #================================================= # STANDARD REMOVE #================================================= @@ -41,42 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=2 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow Both $port -fi - -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=2 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 9678167..f3bd89e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,25 +9,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..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -35,14 +16,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -#================================================= -# 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 - #================================================= # RESTORE USER RIGHTS #================================================= @@ -51,16 +24,6 @@ ynh_restore_file --origin_path="$install_dir" chown -R $app: $install_dir chmod +x $install_dir/$app -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=2 - -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d848c84..5b72ccf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,36 +9,12 @@ 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? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) - #================================================= # 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=1 - -# 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 - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -48,14 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=5 ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=5 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -63,7 +31,7 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 -#REMOVEME? ynh_secure_remove --file="$install_dir" + ynh_secure_remove --file="$install_dir" # Download, check integrity, uncompress and patch the source from app.src git clone git://erdgeist.org/opentracker "$install_dir" --quiet cp ../conf/Makefile $install_dir/Makefile @@ -73,13 +41,6 @@ then popd fi -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=2 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # SETUP SYSTEMD #================================================= From 0dca12ebe5a625f36cbeabc630ee8b38adf382c1 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 1 May 2023 17:13:05 +0000 Subject: [PATCH 4/8] Auto-update README --- README.md | 10 ---------- README_fr.md | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/README.md b/README.md index 61c12a8..abbb063 100644 --- a/README.md +++ b/README.md @@ -21,16 +21,6 @@ Bittorrent tracker **Shipped version:** 1.0~ynh3 **Demo:** https://dispatch.khlieng.com/connect -## Disclaimers / important information - -## Configuration - -`udp://serverIP:6969` - -by default the tracker will run on 6969 port on both UDP and TCP. - -visit `http://serverIP:6969/stats` to view the tracker stats. - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index dbe2077..dac3290 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,16 +21,6 @@ Tracker Bittorrent **Version incluse :** 1.0~ynh3 **Démo :** https://dispatch.khlieng.com/connect -## Avertissements / informations importantes - -## Configuration - -`udp://serverIP:6969` - -par défaut, le tracker s'exécutera sur le port 6969 à la fois sur UDP et TCP. - -visitez `http://serverIP:6969/stats` pour afficher les statistiques du tracker. - ## Documentations et ressources * Site officiel de l’app : From 905cfa85d1b50e16713188bd430bae2fb7e82b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 1 May 2023 19:14:03 +0200 Subject: [PATCH 5/8] fix --- scripts/install | 1 - tests.toml | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests.toml diff --git a/scripts/install b/scripts/install index ef3fbe6..5c8ee36 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Installing OpenTracker..." --weight=5 -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir git clone git://erdgeist.org/opentracker "$install_dir" --quiet cp ../conf/Makefile $install_dir/Makefile cp ../conf/opentracker.conf.sample $install_dir/opentracker.conf diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..55d5cb2 --- /dev/null +++ b/tests.toml @@ -0,0 +1,8 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ + \ No newline at end of file From 8d1b88a99f1d68261698770dec59e30159a06b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 1 May 2023 19:15:32 +0200 Subject: [PATCH 6/8] Update systemd.service --- conf/systemd.service | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/conf/systemd.service b/conf/systemd.service index c04b968..1bff240 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -12,5 +12,39 @@ ExecStart=__INSTALL_DIR__/opentracker & RestartSec=15 Restart=always +# Sandboxing options to harden security +# Depending on specificities of your service/app, you may need to tweak these +# .. but this should be a good baseline +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectClock=yes +ProtectHostname=yes +ProtectProc=invisible +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallArchitectures=native +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG + [Install] WantedBy=multi-user.target From 51c047e9c720b05c8c8504236c3e885540d5af04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 1 May 2023 19:30:56 +0200 Subject: [PATCH 7/8] Create DESCRIPTION.md --- doc/DESCRIPTION.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/DESCRIPTION.md diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..727b391 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +Bittorrent tracker \ No newline at end of file From 2abf6007f36edd3114b403722c291eb940410915 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 1 May 2023 17:31:00 +0000 Subject: [PATCH 8/8] Auto-update README --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index dac3290..af75b29 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -Tracker Bittorrent +Bittorrent tracker **Version incluse :** 1.0~ynh3