mirror of
https://github.com/YunoHost-Apps/transmission_ynh.git
synced 2024-09-04 01:46:12 +02:00
Version 2 (#99)
* Update install * v2 * Auto-update README * v2 * fix * Auto-update README * Delete updater.sh * fix * fix * Update restore * fix * Update manifest.toml * add sudirs * Update install * cleaning * Update upgrade * Update tests.toml * Update manifest.toml * Update manifest.toml * cleaning * Auto-update README * cleaning * fix --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org>
This commit is contained in:
parent
b69e386166
commit
898d34dbd1
20 changed files with 157 additions and 674 deletions
137
.github/workflows/updater.sh
vendored
137
.github/workflows/updater.sh
vendored
|
@ -1,137 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PACKAGE UPDATING HELPER
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# This script is meant to be run by GitHub Actions
|
|
||||||
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
|
||||||
# Since each app is different, maintainers can adapt its contents so as to perform
|
|
||||||
# automatic actions when a new upstream release is detected.
|
|
||||||
|
|
||||||
# Remove this exit command when you are ready to run this Action
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Fetching information
|
|
||||||
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
|
||||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
|
||||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
|
||||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
|
||||||
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
|
|
||||||
|
|
||||||
# Later down the script, we assume the version has only digits and dots
|
|
||||||
# Sometimes the release name starts with a "v", so let's filter it out.
|
|
||||||
# You may need more tweaks here if the upstream repository has different naming conventions.
|
|
||||||
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
|
|
||||||
version=${version:1}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Setting up the environment variables
|
|
||||||
echo "Current version: $current_version"
|
|
||||||
echo "Latest release from upstream: $version"
|
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
|
||||||
echo "REPO=$repo" >> $GITHUB_ENV
|
|
||||||
# For the time being, let's assume the script will fail
|
|
||||||
echo "PROCEED=false" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Proceed only if the retrieved version is greater than the current one
|
|
||||||
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
|
||||||
echo "::warning ::No new version available"
|
|
||||||
exit 0
|
|
||||||
# Proceed only if a PR for this new version does not already exist
|
|
||||||
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
|
||||||
echo "::warning ::A branch already exists for this update"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
|
|
||||||
echo "${#assets[@]} available asset(s)"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPDATE SOURCE FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Here we use the $assets variable to get the resources published in the upstream release.
|
|
||||||
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
|
|
||||||
|
|
||||||
# Let's loop over the array of assets URLs
|
|
||||||
for asset_url in ${assets[@]}; do
|
|
||||||
|
|
||||||
echo "Handling asset at $asset_url"
|
|
||||||
|
|
||||||
# Assign the asset to a source file in conf/ directory
|
|
||||||
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
|
|
||||||
# Leave $src empty to ignore the asset
|
|
||||||
case $asset_url in
|
|
||||||
*"admin"*)
|
|
||||||
src="app"
|
|
||||||
;;
|
|
||||||
*"update"*)
|
|
||||||
src="app-upgrade"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
src=""
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# If $src is not empty, let's process the asset
|
|
||||||
if [ ! -z "$src" ]; then
|
|
||||||
|
|
||||||
# Create the temporary directory
|
|
||||||
tempdir="$(mktemp -d)"
|
|
||||||
|
|
||||||
# Download sources and calculate checksum
|
|
||||||
filename=${asset_url##*/}
|
|
||||||
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
|
|
||||||
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
|
||||||
|
|
||||||
# Delete temporary directory
|
|
||||||
rm -rf $tempdir
|
|
||||||
|
|
||||||
# Get extension
|
|
||||||
if [[ $filename == *.tar.gz ]]; then
|
|
||||||
extension=tar.gz
|
|
||||||
else
|
|
||||||
extension=${filename##*.}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rewrite source file
|
|
||||||
cat <<EOT > conf/$src.src
|
|
||||||
SOURCE_URL=$asset_url
|
|
||||||
SOURCE_SUM=$checksum
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=$extension
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=
|
|
||||||
EOT
|
|
||||||
echo "... conf/$src.src updated"
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "... asset ignored"
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPDATE STEPS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Any action on the app's source code can be done.
|
|
||||||
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Replace new version in manifest
|
|
||||||
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
|
||||||
|
|
||||||
# No need to update the README, yunohost-bot takes care of it
|
|
||||||
|
|
||||||
# The Action will proceed only if the PROCEED environment variable is set to true
|
|
||||||
echo "PROCEED=true" >> $GITHUB_ENV
|
|
||||||
exit 0
|
|
29
README.md
29
README.md
|
@ -6,6 +6,7 @@ It shall NOT be edited by hand.
|
||||||
# Transmission for YunoHost
|
# Transmission for YunoHost
|
||||||
|
|
||||||
[![Integration level](https://dash.yunohost.org/integration/transmission.svg)](https://dash.yunohost.org/appci/app/transmission) ![Working status](https://ci-apps.yunohost.org/ci/badges/transmission.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/transmission.maintain.svg)
|
[![Integration level](https://dash.yunohost.org/integration/transmission.svg)](https://dash.yunohost.org/appci/app/transmission) ![Working status](https://ci-apps.yunohost.org/ci/badges/transmission.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/transmission.maintain.svg)
|
||||||
|
|
||||||
[![Install Transmission with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=transmission)
|
[![Install Transmission with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=transmission)
|
||||||
|
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
@ -17,6 +18,10 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
Transmission is a fast, easy, and free BitTorrent client.
|
Transmission is a fast, easy, and free BitTorrent client.
|
||||||
|
|
||||||
|
### YunoHost specific features
|
||||||
|
|
||||||
|
* Integration with YunoHost Multimedia directories
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 3.00~ynh1
|
**Shipped version:** 3.00~ynh1
|
||||||
|
|
||||||
|
@ -24,30 +29,6 @@ Transmission is a fast, easy, and free BitTorrent client.
|
||||||
|
|
||||||
![Screenshot of Transmission](./doc/screenshots/transmission.jpg)
|
![Screenshot of Transmission](./doc/screenshots/transmission.jpg)
|
||||||
|
|
||||||
## Disclaimers / important information
|
|
||||||
|
|
||||||
## YunoHost specific features
|
|
||||||
|
|
||||||
* Integration with YunoHost Multimedia directories
|
|
||||||
|
|
||||||
## Additionnal informations
|
|
||||||
Alternative to WebUI :
|
|
||||||
|
|
||||||
You can use remote client on different platforms to manage your Transmission server:
|
|
||||||
|
|
||||||
* Dekstop: Transmission-remote-GUI: https://github.com/transmission-remote-gui/transgui
|
|
||||||
* Mobile: Transdroid: http://www.transdroid.org/
|
|
||||||
* More clients here: https://transmissionbt.com/resources/
|
|
||||||
|
|
||||||
You can use the following information to connect your server:
|
|
||||||
|
|
||||||
* Remote host: Your domain or IP address (don't add folder)
|
|
||||||
* Port: 443
|
|
||||||
* SSL: Enabled
|
|
||||||
* User: Your Yunohost Username
|
|
||||||
* Password: Password of the Yunohost User above
|
|
||||||
* RPC Path: /torrent/transmission/rpc (if you used the standard folder)
|
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: <https://www.transmissionbt.com>
|
* Official app website: <https://www.transmissionbt.com>
|
||||||
|
|
49
README_fr.md
49
README_fr.md
|
@ -5,54 +5,35 @@ It shall NOT be edited by hand.
|
||||||
|
|
||||||
# Transmission pour YunoHost
|
# Transmission pour YunoHost
|
||||||
|
|
||||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/transmission.svg)](https://dash.yunohost.org/appci/app/transmission) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/transmission.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/transmission.maintain.svg)
|
[![Niveau d’intégration](https://dash.yunohost.org/integration/transmission.svg)](https://dash.yunohost.org/appci/app/transmission) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/transmission.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/transmission.maintain.svg)
|
||||||
|
|
||||||
[![Installer Transmission avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=transmission)
|
[![Installer Transmission avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=transmission)
|
||||||
|
|
||||||
*[Read this readme in english.](./README.md)*
|
*[Read this readme in english.](./README.md)*
|
||||||
|
|
||||||
> *Ce package vous permet d'installer Transmission rapidement et simplement sur un serveur YunoHost.
|
> *Ce package vous permet d’installer Transmission 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.*
|
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
|
||||||
|
|
||||||
Transmission est un client BitTorrent libre, efficace et simple.
|
Transmission est un client BitTorrent libre, efficace et simple.
|
||||||
|
|
||||||
|
### Caractéristiques spécifiques YunoHost
|
||||||
|
|
||||||
|
* Intégration avec les répertoires Multimédias de YunoHost
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 3.00~ynh1
|
**Version incluse :** 3.00~ynh1
|
||||||
|
|
||||||
## Captures d'écran
|
## Captures d’écran
|
||||||
|
|
||||||
![Capture d'écran de Transmission](./doc/screenshots/transmission.jpg)
|
![Capture d’écran de Transmission](./doc/screenshots/transmission.jpg)
|
||||||
|
|
||||||
## Avertissements / informations importantes
|
|
||||||
|
|
||||||
## Caractéristiques spécifiques YunoHost
|
|
||||||
|
|
||||||
* Intégration avec les répertoires Multimédias de YunoHost
|
|
||||||
|
|
||||||
## Informations additionnelles
|
|
||||||
Alternative à WebUI :
|
|
||||||
|
|
||||||
Vous pouvez utiliser le client de contrôle à distance des différentes plateformes pour gérer votre serveur Transmission :
|
|
||||||
|
|
||||||
* Bureau : Transmission-remote-GUI : https://github.com/transmission-remote-gui/transgui
|
|
||||||
* Mobile : Transdroid : http://www.transdroid.org/
|
|
||||||
* Plus de clients ici : https://transmissionbt.com/resources/
|
|
||||||
|
|
||||||
Vous pouvez utiliser les informations suivantes pour vous connecter à votre serveur :
|
|
||||||
|
|
||||||
* Hôte distant : Votre domaine ou adresse IP (n'ajoutez pas le répertoire)
|
|
||||||
* Port : 443
|
|
||||||
* SSL : Activé
|
|
||||||
* Utilisateur : Votre nom d'utilisateur YunoHost
|
|
||||||
* Mot de passe : Le mot de passe de l'utilisateur YunoHost utilisé
|
|
||||||
* Répertoire RPC : `/torrent/transmission/rpc` (si vous utilisez le répertoire par défaut)
|
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l'app : <https://www.transmissionbt.com>
|
* Site officiel de l’app : <https://www.transmissionbt.com>
|
||||||
* Documentation officielle de l'admin : <https://github.com/transmission/transmission/wiki>
|
* Documentation officielle de l’admin : <https://github.com/transmission/transmission/wiki>
|
||||||
* Dépôt de code officiel de l'app : <https://github.com/transmission/transmission>
|
* Dépôt de code officiel de l’app : <https://github.com/transmission/transmission>
|
||||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_transmission>
|
* Documentation YunoHost pour cette app : <https://yunohost.org/app_transmission>
|
||||||
* Signaler un bug : <https://github.com/YunoHost-Apps/transmission_ynh/issues>
|
* Signaler un bug : <https://github.com/YunoHost-Apps/transmission_ynh/issues>
|
||||||
|
|
||||||
|
@ -68,4 +49,4 @@ ou
|
||||||
sudo yunohost app upgrade transmission -u https://github.com/YunoHost-Apps/transmission_ynh/tree/testing --debug
|
sudo yunohost app upgrade transmission -u https://github.com/YunoHost-Apps/transmission_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
|
@ -1,26 +0,0 @@
|
||||||
;; Test complet
|
|
||||||
; Manifest
|
|
||||||
domain="domain.tld"
|
|
||||||
path="/path"
|
|
||||||
; Checks
|
|
||||||
pkg_linter=1
|
|
||||||
setup_sub_dir=1
|
|
||||||
setup_root=1
|
|
||||||
setup_nourl=0
|
|
||||||
setup_private=1
|
|
||||||
setup_public=0
|
|
||||||
upgrade=1
|
|
||||||
# 2.94~ynh1
|
|
||||||
upgrade=1 from_commit=c07a09d875cf11b4e3a3147e9e35ef5e06788cff
|
|
||||||
backup_restore=1
|
|
||||||
multi_instance=0
|
|
||||||
port_already_use=0
|
|
||||||
change_url=1
|
|
||||||
;;; Options
|
|
||||||
Email=
|
|
||||||
Notification=none
|
|
||||||
;;; Upgrade options
|
|
||||||
; commit=c07a09d875cf11b4e3a3147e9e35ef5e06788cff
|
|
||||||
name=2.94~ynh1
|
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666&
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ location __PATH__/ {
|
||||||
}
|
}
|
||||||
|
|
||||||
location __PATH__/downloads/ {
|
location __PATH__/downloads/ {
|
||||||
alias __DATADIR__/completed/;
|
alias __DATA_DIR__/completed/;
|
||||||
charset UTF-8;
|
charset UTF-8;
|
||||||
autoindex on;
|
autoindex on;
|
||||||
autoindex_exact_size off;
|
autoindex_exact_size off;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"blocklist-url": "http://www.example.com/blocklist",
|
"blocklist-url": "http://www.example.com/blocklist",
|
||||||
"cache-size-mb": 4,
|
"cache-size-mb": 4,
|
||||||
"dht-enabled": true,
|
"dht-enabled": true,
|
||||||
"download-dir": "__DATADIR__/completed",
|
"download-dir": "__DATA_DIR__/completed",
|
||||||
"download-limit": 100,
|
"download-limit": 100,
|
||||||
"download-limit-enabled": 0,
|
"download-limit-enabled": 0,
|
||||||
"download-queue-enabled": true,
|
"download-queue-enabled": true,
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
"encryption": 1,
|
"encryption": 1,
|
||||||
"idle-seeding-limit": 30,
|
"idle-seeding-limit": 30,
|
||||||
"idle-seeding-limit-enabled": false,
|
"idle-seeding-limit-enabled": false,
|
||||||
"incomplete-dir": "__DATADIR__/progress",
|
"incomplete-dir": "__DATA_DIR__/progress",
|
||||||
"incomplete-dir-enabled": true,
|
"incomplete-dir-enabled": true,
|
||||||
"lpd-enabled": false,
|
"lpd-enabled": false,
|
||||||
"max-peers-global": 200,
|
"max-peers-global": 200,
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
"peer-id-ttl-hours": 6,
|
"peer-id-ttl-hours": 6,
|
||||||
"peer-limit-global": 200,
|
"peer-limit-global": 200,
|
||||||
"peer-limit-per-torrent": 50,
|
"peer-limit-per-torrent": 50,
|
||||||
"peer-port": __PEER_PORT__,
|
"peer-port": __PORT_PEER__,
|
||||||
"peer-port-random-high": 65535,
|
"peer-port-random-high": 65535,
|
||||||
"peer-port-random-low": 49152,
|
"peer-port-random-low": 49152,
|
||||||
"peer-port-random-on-start": false,
|
"peer-port-random-on-start": false,
|
||||||
|
@ -70,6 +70,6 @@
|
||||||
"upload-limit-enabled": 0,
|
"upload-limit-enabled": 0,
|
||||||
"upload-slots-per-torrent": 14,
|
"upload-slots-per-torrent": 14,
|
||||||
"utp-enabled": true,
|
"utp-enabled": true,
|
||||||
"watch-dir": "__DATADIR__/watched",
|
"watch-dir": "__DATA_DIR__/watched",
|
||||||
"watch-dir-enabled": true
|
"watch-dir-enabled": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
## YunoHost specific features
|
|
||||||
|
|
||||||
* Integration with YunoHost Multimedia directories
|
|
||||||
|
|
||||||
## Additionnal informations
|
## Additionnal informations
|
||||||
Alternative to WebUI :
|
Alternative to WebUI :
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
## Caractéristiques spécifiques YunoHost
|
|
||||||
|
|
||||||
* Intégration avec les répertoires Multimédias de YunoHost
|
|
||||||
|
|
||||||
## Informations additionnelles
|
## Informations additionnelles
|
||||||
Alternative à WebUI :
|
Alternative à WebUI :
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
Transmission is a fast, easy, and free BitTorrent client.
|
Transmission is a fast, easy, and free BitTorrent client.
|
||||||
|
|
||||||
|
### YunoHost specific features
|
||||||
|
|
||||||
|
* Integration with YunoHost Multimedia directories
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
Transmission est un client BitTorrent libre, efficace et simple.
|
Transmission est un client BitTorrent libre, efficace et simple.
|
||||||
|
|
||||||
|
### Caractéristiques spécifiques YunoHost
|
||||||
|
|
||||||
|
* Intégration avec les répertoires Multimédias de YunoHost
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Transmission",
|
|
||||||
"id": "transmission",
|
|
||||||
"packaging_format": 1,
|
|
||||||
"description": {
|
|
||||||
"en": "Fast, Easy, and Free BitTorrent Client",
|
|
||||||
"fr": "Client BitTorrent libre et rapide"
|
|
||||||
},
|
|
||||||
"version": "3.00~ynh1",
|
|
||||||
"url": "https://www.transmissionbt.com",
|
|
||||||
"upstream": {
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"website": "https://www.transmissionbt.com",
|
|
||||||
"admindoc": "https://github.com/transmission/transmission/wiki",
|
|
||||||
"code": "https://github.com/transmission/transmission",
|
|
||||||
"cpe": "cpe:2.3:a:transmissionbt:transmission"
|
|
||||||
},
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"maintainer": {
|
|
||||||
"name": "",
|
|
||||||
"email": ""
|
|
||||||
},
|
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">= 11.0.9"
|
|
||||||
},
|
|
||||||
"multi_instance": false,
|
|
||||||
"services": [
|
|
||||||
"nginx",
|
|
||||||
"transmission-daemon"
|
|
||||||
],
|
|
||||||
"arguments": {
|
|
||||||
"install": [
|
|
||||||
{
|
|
||||||
"name": "domain",
|
|
||||||
"type": "domain"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"type": "path",
|
|
||||||
"example": "/torrent",
|
|
||||||
"default": "/torrent"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
64
manifest.toml
Normal file
64
manifest.toml
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "transmission"
|
||||||
|
name = "Transmission"
|
||||||
|
description.en = "Fast, Easy, and Free BitTorrent Client"
|
||||||
|
description.fr = "Client BitTorrent libre et rapide"
|
||||||
|
|
||||||
|
version = "3.00~ynh1"
|
||||||
|
|
||||||
|
maintainers = []
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "GPL-3.0"
|
||||||
|
website = "https://www.transmissionbt.com"
|
||||||
|
admindoc = "https://github.com/transmission/transmission/wiki"
|
||||||
|
code = "https://github.com/transmission/transmission"
|
||||||
|
cpe = "cpe:2.3:a:transmissionbt:transmission"
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">= 11.2"
|
||||||
|
architectures = "all"
|
||||||
|
multi_instance = false
|
||||||
|
ldap = false
|
||||||
|
sso = false
|
||||||
|
disk = "50M"
|
||||||
|
ram.build = "200M"
|
||||||
|
ram.runtime = "50M"
|
||||||
|
|
||||||
|
[install]
|
||||||
|
[install.domain]
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.path]
|
||||||
|
type = "path"
|
||||||
|
default = "/torrent"
|
||||||
|
|
||||||
|
[install.init_main_permission]
|
||||||
|
type = "group"
|
||||||
|
default = "visitors"
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
|
||||||
|
[resources.ports]
|
||||||
|
main.default = 9091
|
||||||
|
main.exposed = "TCP"
|
||||||
|
peer.default = 51413
|
||||||
|
peer.exposed = "Both"
|
||||||
|
|
||||||
|
[resources.system_user]
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.data_dir]
|
||||||
|
subdirs = [ "progress", "completed", "watched" ]
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
||||||
|
rpc.url = "/transmission/rpc"
|
||||||
|
rpc.allowed = "visitors"
|
||||||
|
rpc.show_tile = false
|
||||||
|
rpc.protected = true
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = "transmission-daemon, transmission-cli, transmission-common, acl"
|
|
@ -4,9 +4,6 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
|
||||||
pkg_dependencies="transmission-daemon transmission-cli transmission-common acl"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,23 +10,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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
|
|
||||||
|
|
||||||
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
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -36,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
ynh_backup --src_path="$data_dir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
|
|
@ -9,64 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
|
||||||
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..."
|
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
ynh_clean_check_starting
|
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
|
|
||||||
# Restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
change_domain=0
|
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
|
||||||
then
|
|
||||||
change_domain=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
change_path=0
|
|
||||||
if [ "$old_path" != "$new_path" ]
|
|
||||||
then
|
|
||||||
change_path=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -81,29 +23,7 @@ ynh_systemd_action --service_name=transmission-daemon --action="stop"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
ynh_change_url_nginx_config
|
||||||
|
|
||||||
# Change the path in the NGINX config file
|
|
||||||
if [ $change_path -eq 1 ]
|
|
||||||
then
|
|
||||||
# Make a backup of the original NGINX config file if modified
|
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
|
||||||
# Set global variables for NGINX helper
|
|
||||||
domain="$old_domain"
|
|
||||||
path_url="$new_path"
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the domain for NGINX
|
|
||||||
if [ $change_domain -eq 1 ]
|
|
||||||
then
|
|
||||||
# Delete file checksum for the old conf file location
|
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
|
||||||
# Store file checksum for the new config file location
|
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# SPECIFIC MODIFICATIONS
|
||||||
|
@ -126,13 +46,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --service_name=transmission-daemon --action="start"
|
ynh_systemd_action --service_name=transmission-daemon --action="start"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
104
scripts/install
104
scripts/install
|
@ -9,80 +9,13 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
|
||||||
path_url=$YNH_APP_ARG_PATH
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
rpcpassword=$(ynh_string_random)
|
rpcpassword=$(ynh_string_random)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating installation parameters..."
|
|
||||||
|
|
||||||
# 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
|
|
||||||
ynh_app_setting_set --app=$app --key=rpcpassword --value="$rpcpassword"
|
ynh_app_setting_set --app=$app --key=rpcpassword --value="$rpcpassword"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# FIND AND OPEN A PORT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Finding an available port..." --weight=16
|
|
||||||
|
|
||||||
# Find an available port
|
|
||||||
port=$(ynh_find_port --port=9091)
|
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
|
||||||
peer_port=$(ynh_find_port --port=51413)
|
|
||||||
ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port
|
|
||||||
|
|
||||||
# Open the port
|
|
||||||
ynh_script_progression --message="Configuring firewall..."
|
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
|
||||||
ynh_exec_warn_less yunohost firewall allow Both $peer_port
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=16
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
# Fix a stupid issue which happens sometimes ...
|
|
||||||
# transmission-common is installed (it's a dependency of
|
|
||||||
# transmission-daemon) but somehow the files it's supposed
|
|
||||||
# to add ain't there ... and possibly also the transmission user
|
|
||||||
# is missing.
|
|
||||||
# Explicitly reinstalling the packages fixes the issue :|
|
|
||||||
if [ ! -d /usr/share/transmission/ ]
|
|
||||||
then
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies --reinstall
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -90,15 +23,10 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..."
|
ynh_script_progression --message="Creating a data directory..."
|
||||||
|
|
||||||
datadir=/home/yunohost.transmission
|
chmod -R 764 $data_dir
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
chmod -R 775 $data_dir/watched
|
||||||
|
chown -R debian-transmission:www-data "$data_dir"
|
||||||
mkdir -p $datadir/{progress,completed,watched}
|
chown -R debian-transmission: $data_dir/{progress,watched}
|
||||||
|
|
||||||
chmod -R 764 $datadir
|
|
||||||
chmod -R 777 $datadir/watched
|
|
||||||
chown -R debian-transmission:www-data "$datadir"
|
|
||||||
chown -R debian-transmission: $datadir/{progress,watched}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -116,11 +44,11 @@ ynh_script_progression --message="Adding a configuration file..." --weight=2
|
||||||
# Transmission has to be stopped before modifying its config
|
# Transmission has to be stopped before modifying its config
|
||||||
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
||||||
|
|
||||||
if [ "$path_url" != "/" ]
|
if [ "$path" != "/" ]
|
||||||
then
|
then
|
||||||
path_less="$path_url/"
|
path_less="$path/"
|
||||||
else
|
else
|
||||||
path_less="$path_url"
|
path_less="$path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
|
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
|
||||||
|
@ -144,12 +72,15 @@ fi
|
||||||
ynh_script_progression --message="Adding multimedia directories..." --weight=4
|
ynh_script_progression --message="Adding multimedia directories..." --weight=4
|
||||||
|
|
||||||
ynh_multimedia_build_main_dir
|
ynh_multimedia_build_main_dir
|
||||||
|
|
||||||
# Set rights on transmission directory (parent need to be readable by other, and progress need to be writable by multimedia. Because files will move)
|
# Set rights on transmission directory (parent need to be readable by other, and progress need to be writable by multimedia. Because files will move)
|
||||||
ynh_multimedia_addfolder --source_dir="$datadir" --dest_dir="share/Torrents"
|
ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="share/Torrents"
|
||||||
|
|
||||||
# And share completed directory
|
# And share completed directory
|
||||||
ynh_multimedia_addfolder --source_dir="$datadir/completed" --dest_dir="share/Torrents"
|
ynh_multimedia_addfolder --source_dir="$data_dir/completed" --dest_dir="share/Torrents"
|
||||||
|
|
||||||
# Share also watched directory, to allow to use it easily
|
# Share also watched directory, to allow to use it easily
|
||||||
ynh_multimedia_addfolder --source_dir="$datadir/watched" --dest_dir="share/Torrent to download"
|
ynh_multimedia_addfolder --source_dir="$data_dir/watched" --dest_dir="share/Torrent to download"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PATCH SOURCE TO ADD A DOWNLOAD BUTTON
|
# PATCH SOURCE TO ADD A DOWNLOAD BUTTON
|
||||||
|
@ -166,7 +97,7 @@ ynh_replace_string "<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></d
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add transmission-daemon --description="BitTorrent Client" --log=systemd --needs_exposed_ports="$peer_port"
|
yunohost service add transmission-daemon --description="BitTorrent Client" --log=systemd --needs_exposed_ports="$port_peer"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -176,13 +107,6 @@ ynh_script_progression --message="Starting a systemd service..."
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=transmission-daemon --action="start"
|
ynh_systemd_action --service_name=transmission-daemon --action="start"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,23 +9,12 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if yunohost service status transmission-daemon >/dev/null 2>&1
|
if yunohost service status transmission-daemon >/dev/null 2>&1
|
||||||
|
@ -34,49 +23,15 @@ then
|
||||||
yunohost service remove transmission-daemon
|
yunohost service remove transmission-daemon
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=9
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CLOSE A PORT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Closing port $port..."
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
|
||||||
fi
|
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $peer_port$"
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Closing port $peer_port..."
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow Both $peer_port
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing various files..."
|
|
||||||
|
|
||||||
# Web interface
|
# Web interface
|
||||||
ynh_secure_remove --file=/usr/share/transmission
|
ynh_secure_remove --file=/usr/share/transmission
|
||||||
|
|
||||||
# And data
|
# And data
|
||||||
ynh_secure_remove --file=/var/lib/transmission-daemon
|
ynh_secure_remove --file=/var/lib/transmission-daemon
|
||||||
|
|
||||||
# Kernel parameters
|
# Kernel parameters
|
||||||
if [ -e /proc/sys/net/core/rmem_max ]
|
if [ -e /proc/sys/net/core/rmem_max ]
|
||||||
then
|
then
|
||||||
|
@ -84,16 +39,6 @@ then
|
||||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the dedicated system user..."
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username=debian-transmission
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,57 +10,17 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
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..."
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=16
|
|
||||||
|
|
||||||
# Define and install dependencies
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..."
|
ynh_script_progression --message="Restoring the data directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $datadir/{progress,completed,watched}
|
chmod -R 764 $data_dir
|
||||||
|
chmod -R 775 $data_dir/watched
|
||||||
chmod -R 764 $datadir
|
chown -R debian-transmission:www-data "$data_dir"
|
||||||
chmod -R 777 $datadir/watched
|
chown -R debian-transmission: $data_dir/{progress,watched}
|
||||||
chown -R debian-transmission:www-data "$datadir"
|
|
||||||
chown -R debian-transmission: $datadir/{progress,watched}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
@ -92,33 +52,28 @@ ynh_restore_file --origin_path=/usr/share/transmission
|
||||||
ynh_secure_remove --file=/var/lib/transmission-daemon
|
ynh_secure_remove --file=/var/lib/transmission-daemon
|
||||||
ynh_restore_file --origin_path=/var/lib/transmission-daemon
|
ynh_restore_file --origin_path=/var/lib/transmission-daemon
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# OPEN PORTS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring firewall..." --weight=13
|
|
||||||
|
|
||||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
|
||||||
ynh_exec_warn_less yunohost firewall allow Both $peer_port
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding multimedia directories..." --weight=4
|
ynh_script_progression --message="Adding multimedia directories..." --weight=4
|
||||||
|
|
||||||
ynh_multimedia_build_main_dir
|
ynh_multimedia_build_main_dir
|
||||||
|
|
||||||
# Set rights on transmission directory (parent need to be readable by other, and progress need to be writable by multimedia. Because files will move)
|
# Set rights on transmission directory (parent need to be readable by other, and progress need to be writable by multimedia. Because files will move)
|
||||||
ynh_multimedia_addfolder --source_dir="$datadir" --dest_dir="share/Torrents"
|
ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="share/Torrents"
|
||||||
|
|
||||||
# And share completed directory
|
# And share completed directory
|
||||||
ynh_multimedia_addfolder --source_dir="$datadir/completed" --dest_dir="share/Torrents"
|
ynh_multimedia_addfolder --source_dir="$data_dir/completed" --dest_dir="share/Torrents"
|
||||||
|
|
||||||
# Share also watched directory, to allow to use it easily
|
# Share also watched directory, to allow to use it easily
|
||||||
ynh_multimedia_addfolder --source_dir="$datadir/watched" --dest_dir="share/Torrent to download"
|
ynh_multimedia_addfolder --source_dir="$data_dir/watched" --dest_dir="share/Torrent to download"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add transmission-daemon --description="BitTorrent Client" --log=systemd --needs_exposed_ports="$peer_port"
|
yunohost service add transmission-daemon --description="BitTorrent Client" --log=systemd --needs_exposed_ports="$port_peer"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -9,41 +9,12 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
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)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
rpcpassword=$(ynh_app_setting_get --app=$app --key=rpcpassword)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
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=3
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
ynh_clean_check_starting
|
|
||||||
# Restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -53,37 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=transmission-daemon --action="stop"
|
ynh_systemd_action --service_name=transmission-daemon --action="stop"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=4
|
|
||||||
|
|
||||||
if [ -z "$port" ]; then
|
|
||||||
port=9091
|
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$peer_port" ]; then
|
|
||||||
peer_port=51413
|
|
||||||
ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add peer_port also on UDP.
|
|
||||||
ynh_exec_warn_less yunohost firewall allow UDP $peer_port
|
|
||||||
|
|
||||||
# If datadir doesn't exist, create it
|
|
||||||
if [ -z "$datadir" ]; then
|
|
||||||
datadir=/home/yunohost.transmission
|
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=7
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -99,12 +39,10 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..."
|
ynh_script_progression --message="Creating a data directory..."
|
||||||
|
|
||||||
mkdir -p $datadir/{progress,completed,watched}
|
chmod -R 764 $data_dir
|
||||||
|
chmod -R 775 $data_dir/watched
|
||||||
chmod -R 764 $datadir
|
chown -R debian-transmission:www-data "$data_dir"
|
||||||
chmod -R 777 $datadir/watched
|
chown -R debian-transmission: $data_dir/{progress,watched}
|
||||||
chown -R debian-transmission:www-data "$datadir"
|
|
||||||
chown -R debian-transmission: $datadir/{progress,watched}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
|
@ -114,11 +52,11 @@ ynh_script_progression --message="Updating a configuration file..." --weight=2
|
||||||
# Transmission has to be stopped before modifying its config
|
# Transmission has to be stopped before modifying its config
|
||||||
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
||||||
|
|
||||||
if [ "$path_url" != "/" ]
|
if [ "$path" != "/" ]
|
||||||
then
|
then
|
||||||
path_less="$path_url/"
|
path_less="$path/"
|
||||||
else
|
else
|
||||||
path_less="$path_url"
|
path_less="$path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
|
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
|
||||||
|
@ -142,12 +80,15 @@ fi
|
||||||
ynh_script_progression --message="Adding multimedia directories..." --weight=3
|
ynh_script_progression --message="Adding multimedia directories..." --weight=3
|
||||||
|
|
||||||
ynh_multimedia_build_main_dir
|
ynh_multimedia_build_main_dir
|
||||||
|
|
||||||
# Set rights on transmission directory (parent need to be readable by other, and progress need to be writable by multimedia. Because files will move)
|
# Set rights on transmission directory (parent need to be readable by other, and progress need to be writable by multimedia. Because files will move)
|
||||||
ynh_multimedia_addfolder --source_dir="$datadir" --dest_dir="share/Torrents"
|
ynh_multimedia_addfolder --source_dir="$data_dir" --dest_dir="share/Torrents"
|
||||||
|
|
||||||
# And share completed directory
|
# And share completed directory
|
||||||
ynh_multimedia_addfolder --source_dir="$datadir/completed" --dest_dir="share/Torrents"
|
ynh_multimedia_addfolder --source_dir="$data_dir/completed" --dest_dir="share/Torrents"
|
||||||
|
|
||||||
# Share also watched directory, to allow to use it easily
|
# Share also watched directory, to allow to use it easily
|
||||||
ynh_multimedia_addfolder --source_dir="$datadir/watched" --dest_dir="share/Torrent to download"
|
ynh_multimedia_addfolder --source_dir="$data_dir/watched" --dest_dir="share/Torrent to download"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PATCH SOURCE TO ADD A DOWNLOAD BUTTON
|
# PATCH SOURCE TO ADD A DOWNLOAD BUTTON
|
||||||
|
@ -158,6 +99,7 @@ if ! grep --quiet "Inserted by Yunohost install script" /usr/share/transmission/
|
||||||
then
|
then
|
||||||
cat ../sources/extra_files/app/ynh_common.css >> /usr/share/transmission/web/style/transmission/common.css
|
cat ../sources/extra_files/app/ynh_common.css >> /usr/share/transmission/web/style/transmission/common.css
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_replace_string "<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div>$" "<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div><div id=\"toolbar-separator\"></div><a href=\"../../downloads/\" id=\"toolbar-downloads\" title=\"Downloads\" target=\"_blank\"></a>" /usr/share/transmission/web/index.html
|
ynh_replace_string "<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div>$" "<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div><div id=\"toolbar-separator\"></div><a href=\"../../downloads/\" id=\"toolbar-downloads\" title=\"Downloads\" target=\"_blank\"></a>" /usr/share/transmission/web/index.html
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -167,7 +109,7 @@ ynh_replace_string "<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></d
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add transmission-daemon --description="BitTorrent Client" --log=systemd --needs_exposed_ports="$peer_port"
|
yunohost service add transmission-daemon --description="BitTorrent Client" --log=systemd --needs_exposed_ports="$port_peer"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -176,13 +118,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --service_name=transmission-daemon --action="start"
|
ynh_systemd_action --service_name=transmission-daemon --action="start"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
13
tests.toml
Normal file
13
tests.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
||||||
|
|
||||||
|
# ------------
|
||||||
|
# Tests to run
|
||||||
|
# ------------
|
||||||
|
|
||||||
|
exclude = ["install.multi"]
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Commits to test upgrade from
|
||||||
|
# -------------------------------
|
Loading…
Reference in a new issue