1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/simple-torrent_ynh.git synced 2024-09-03 20:26:18 +02:00
* Update upgrade

* Update manifest.json

* Auto-update README

* Update restore

* Update remove

* Create DESCRIPTION.md

* Auto-update README

* Update DESCRIPTION.md

* Auto-update README

* Create updater.sh

* Update arm64.src

* Update manifest.json

* Auto-update README

* Update updater.sh

* Update updater.sh

* Update manifest.json

* Upgrade to version 1.3.7 (#62)

* Upgrade to v1.3.7

* Auto-update README

Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: Yunohost-Bot <>

* Update manifest.json

* Update check_process

* keep config (#67)

* Update upgrade

* Update manifest.json

* Auto-update README

* Auto-update README

* 4.3

* Update manifest.json

* Auto-update README

* Update manifest.json

* Auto-update README

* Update upgrade

* fix linter (#72)

* Update manifest.json

* Auto-update README

* Auto-update README

* Fix linter

* Update manifest.json

* Delete .DS_Store

* Delete .DS_Store

* Delete .DS_Store

* V2 (#76)

* Auto-update README

* v2

* v2

* Update change_url

* Delete .DS_Store

* v2

* Auto-update README

* Auto-update README

* fix

* Update restore

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Auto-update README

* Auto-update README

* fix

* Update manifest.toml

* Auto-update README

---------

Co-authored-by: Yunohost-Bot <>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
This commit is contained in:
Éric Gaspar 2023-02-18 18:19:40 +01:00 committed by GitHub
parent ee81544326
commit dccb95d60b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 123 additions and 480 deletions

BIN
.DS_Store vendored

Binary file not shown.

View file

@ -6,6 +6,7 @@ It shall NOT be edited by hand.
# Simple Torrent for YunoHost
[![Integration level](https://dash.yunohost.org/integration/simple-torrent.svg)](https://dash.yunohost.org/appci/app/simple-torrent) ![Working status](https://ci-apps.yunohost.org/ci/badges/simple-torrent.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/simple-torrent.maintain.svg)
[![Install Simple Torrent with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=simple-torrent)
*[Lire ce readme en français.](./README_fr.md)*
@ -30,24 +31,12 @@ SimpleTorrent is a a self-hosted remote torrent client, written in Go (golang).
- Magnet RSS subscribing supported
**Shipped version:** 1.3.9~ynh5
**Shipped version:** 1.3.9~ynh6
## Screenshots
![Screenshot of Simple Torrent](./doc/screenshots/screenshot.png)
## Disclaimers / important information
## Configuration
Most of the items can be edited in Web-UI on the fly in the config board.
You can also configure Simple Torrent by editing this file `/var/www/simple-torrent/config.yml` using the [documentation](https://github.com/boypt/simple-torrent/wiki/Config-File).
## Limitations
- This app cannot be installed on a 32-bit ARM machine.
## Documentation and resources
* Official admin documentation: <https://github.com/boypt/simple-torrent/wiki>

View file

@ -6,6 +6,7 @@ It shall NOT be edited by hand.
# Simple Torrent pour YunoHost
[![Niveau dintégration](https://dash.yunohost.org/integration/simple-torrent.svg)](https://dash.yunohost.org/appci/app/simple-torrent) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/simple-torrent.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/simple-torrent.maintain.svg)
[![Installer Simple Torrent avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=simple-torrent)
*[Read this readme in english.](./README.md)*
@ -30,24 +31,12 @@ SimpleTorrent is a a self-hosted remote torrent client, written in Go (golang).
- Magnet RSS subscribing supported
**Version incluse :** 1.3.9~ynh5
**Version incluse :** 1.3.9~ynh6
## Captures décran
![Capture décran de Simple Torrent](./doc/screenshots/screenshot.png)
## Avertissements / informations importantes
## Configuration
La plupart des éléments peuvent être modifiés à la volée dans Web-UI dans la page de configuration.
Vous pouvez configurer Simple Torrent en modifiant le fichier `/var/www/simple-torrent/config.yml` en vous aidant de la [documentation](https://github.com/boypt/simple-torrent/wiki/Config-File).
## Limitations
- Cette application ne peut pas être installée sur une machine ARM 32 bits.
## Documentations et ressources
* Documentation officielle de ladmin : <https://github.com/boypt/simple-torrent/wiki>

View file

@ -1,30 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
path="/path"
is_public=1
admin="john"
password="pass"
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=295026023fdb74f5bf210093f5b0622bae2982f3
upgrade=1 from_commit=bbce7cfa6cb8916671a4fec9e8a73095f74a0c9d
backup_restore=1
multi_instance=1
change_url=1
;;; Options
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&

View file

@ -41,7 +41,7 @@ EnableUpload: true
EnableSeeding: true
# EnableSeeding Whether upload even after there's nothing further for us. By default uploading is not altruistic, we'll only upload to encourage the peer to reciprocate.
IncomingPort: __PEER_PORT__
IncomingPort: __PORT_PEER__
# IncomingPort The port SimpleTorrent listens to.
DoneCmd: ""

View file

@ -7,8 +7,8 @@ Type=simple
User=__APP__
Group=__APP__
Environment=PORT=__PORT__
WorkingDirectory=__FINALPATH__
ExecStart=__FINALPATH__/__APP__ -c __FINALPATH__/config.yml --host 127.0.0.1
WorkingDirectory=__INSTALL_DIR__
ExecStart=__INSTALL_DIR__/__APP__ -c __INSTALL_DIR__/config.yml --host 127.0.0.1
Restart=always
RestartSec=3

View file

@ -1,50 +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~ynh5",
"url": "https://github.com/boypt/simple-torrent",
"upstream": {
"license": "AGPL-3.0-only",
"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 nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
},
"default": true
}
]
}
}

54
manifest.toml Normal file
View file

@ -0,0 +1,54 @@
packaging_format = 2
id = "simple-torrent"
name = "Simple Torrent"
description.en = "Self-hosted remote torrent client"
description.fr = "Client torrent distant auto-hébergé"
version = "1.3.9~ynh6"
maintainers = ["eric_G"]
[upstream]
license = "AGPL-3.0-only"
admindoc = "https://github.com/boypt/simple-torrent/wiki"
code = "https://github.com/boypt/simple-torrent"
[integration]
yunohost = ">= 11.1.7"
architectures = ["amd64","i386", "arm64"]
multi_instance = true
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/simple-torrent"
[install.init_main_permission]
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."
help.fr = "Si cette case est cochée, Simple Torrent sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
type = "group"
default = "visitors"
[resources]
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
[resources.ports]
main.default = 3000
peer.default = 50007
peer.exposed = "Both"
[resources.permissions]
main.url = "/"

View file

@ -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
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@ -36,13 +18,13 @@ 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 DATA
#=================================================
ynh_backup --src_path="$datadir" --is_big
ynh_backup --src_path="$data_dir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -19,17 +19,6 @@ old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================

View file

@ -9,137 +9,57 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
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
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
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
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=0
# Find an available port
port=$(ynh_find_port --port=3000)
ynh_app_setting_set --app=$app --key=port --value=$port
# Find incoming port peers connect to
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
ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path --source_id=$YNH_ARCH
ynh_setup_source --dest_dir=$install_dir --source_id=$YNH_ARCH
pushd "$final_path"
pushd "$install_dir"
gzip --decompress $YNH_ARCH.gz
mv $YNH_ARCH $app
popd
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod +x $final_path/$app
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod +x $install_dir/$app
#=================================================
# NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=3
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_add_systemd_config
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$port_peer" --log="/var/log/$app/$app.log"
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir/{torrents,downloads}
mkdir -p $data_dir/{torrents,downloads}
# Set permissions to app files
chmod 755 $datadir/{torrents,downloads}
chmod -R o-rwx $datadir
chown -R $app:www-data $datadir
chmod 755 $data_dir/{torrents,downloads}
chmod -R o-rwx $data_dir
chown -R $app:www-data $data_dir
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1
ynh_add_config --template="../conf/config.default.yml" --destination="$final_path/config.yml"
ynh_add_config --template="../conf/config.default.yml" --destination="$install_dir/config.yml"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_add_systemd_config
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$peer_port" --log="/var/log/$app/$app.log"
chmod 400 "$install_dir/config.yml"
chown $app:$app "$install_dir/config.yml"
#=================================================
# START SYSTEMD SERVICE
@ -149,24 +69,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
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,23 +10,10 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
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)
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=5
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
@ -35,61 +22,12 @@ then
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# 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
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_secure_remove --file="$datadir"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $peer_port$"
then
ynh_script_progression --message="Closing port $peer_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow Both $peer_port
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,111 +9,50 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# OPEN PORTS
#=================================================
ynh_script_progression --message="Configuring firewall..." --weight=3
ynh_exec_warn_less yunohost firewall allow Both $peer_port
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring $app main directory..." --weight=4
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod +x $final_path/$app
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod +x $install_dir/$app
#=================================================
# RESTORE DATA
#=================================================
ynh_script_progression --message="Restoring $app data..." --weight=10
ynh_restore_file --origin_path="$datadir" --not_mandatory
ynh_restore_file --origin_path="$data_dir" --not_mandatory
mkdir -p $datadir/{torrents,downloads}
mkdir -p $data_dir/{torrents,downloads}
chmod 755 $datadir/{torrents,downloads}
chmod -R o-rwx $datadir
chown -R $app:www-data $datadir
chmod 755 $data_dir/{torrents,downloads}
chmod -R o-rwx $data_dir
chown -R $app:www-data $data_dir
#=================================================
# RESTORE SYSTEMD
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=5
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$peer_port" --log="/var/log/$app/$app.log"
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$port_peer" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================

View file

@ -9,56 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
#=================================================
# CHECK VERSION
#=================================================
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
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
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
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -68,14 +24,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
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -85,33 +33,37 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path --source_id=$YNH_ARCH --keep="config.yml"
ynh_setup_source --dest_dir=$install_dir --source_id=$YNH_ARCH --keep="config.yml"
pushd "$final_path"
pushd "$install_dir"
gzip --decompress $YNH_ARCH.gz
mv $YNH_ARCH $app
popd
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod +x $final_path/$app
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod +x $install_dir/$app
#=================================================
# NGINX CONFIGURATION
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_add_systemd_config
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$port_peer" --log="/var/log/$app/$app.log"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
# ynh_script_progression --message="Modifying a config file..." --weight=1
# ynh_add_config --template="../conf/config.default.yml" --destination="$final_path/config.yml"
# ynh_add_config --template="../conf/config.default.yml" --destination="$install_dir/config.yml"
#=================================================
# CREATE DIRECTORIES
@ -122,20 +74,6 @@ mkdir -p /home/yunohost.app/$app/{torrents,downloads}
chown -R $app:www-data /home/yunohost.app/$app
chmod 755 /home/yunohost.app/$app/{torrents,downloads}
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
ynh_add_systemd_config
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$peer_port" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
@ -143,13 +81,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

10
tests.toml Normal file
View file

@ -0,0 +1,10 @@
test_format = 1.0
[default]
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.bbce7cfa.name = "Upgrade from 1.3.7"