mirror of
https://github.com/YunoHost-Apps/transmission_ynh.git
synced 2024-09-04 01:46:12 +02:00
commit
c07a09d875
24 changed files with 684 additions and 488 deletions
55
.github/ISSUE_TEMPLATE.md
vendored
Normal file
55
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
|
||||
|
||||
---
|
||||
|
||||
**How to post a meaningful bug report**
|
||||
1. *Read this whole template first.*
|
||||
2. *Determine if you are on the right place:*
|
||||
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
||||
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
|
||||
- *When in doubt, post here and we will figure it out together.*
|
||||
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
||||
---
|
||||
|
||||
### Describe the bug
|
||||
|
||||
*A clear and concise description of what the bug is.*
|
||||
|
||||
### Context
|
||||
|
||||
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
|
||||
- YunoHost version: x.x.x
|
||||
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
|
||||
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
|
||||
- If yes, please explain:
|
||||
- Using, or trying to install package version/branch:
|
||||
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
- *If you performed a command from the CLI, the command itself is enough. For example:*
|
||||
```sh
|
||||
sudo yunohost app install the_app
|
||||
```
|
||||
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
|
||||
- *If the error occurs in your browser, explain what you did:*
|
||||
1. *Go to '...'*
|
||||
2. *Click on '...'*
|
||||
3. *Scroll down to '...'*
|
||||
4. *See error*
|
||||
|
||||
### Expected behavior
|
||||
|
||||
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
|
||||
|
||||
### Logs
|
||||
|
||||
*When an operation fails, YunoHost provides a simple way to share the logs.*
|
||||
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
|
||||
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
|
||||
|
||||
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
|
||||
|
||||
*If applicable and useful, add screenshots to help explain your problem.*
|
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
## Problem
|
||||
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
|
||||
- *And how do you fix that problem*
|
||||
|
||||
## PR Status
|
||||
|
||||
- [ ] Code finished and ready to be reviewed/tested
|
||||
- [ ] The fix/enhancement were manually tested (if applicable)
|
||||
|
||||
## Automatic tests
|
||||
|
||||
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)
|
||||
w
|
137
.github/workflows/updater.sh
vendored
Normal file
137
.github/workflows/updater.sh
vendored
Normal file
|
@ -0,0 +1,137 @@
|
|||
#!/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
|
53
README.md
53
README.md
|
@ -1,42 +1,35 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Transmission for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/transmission)  
|
||||
[](https://dash.yunohost.org/appci/app/transmission)  
|
||||
[](https://install-app.yunohost.org/?app=transmission)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allow you to install Transmission quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||
> *This package allows you to install Transmission quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
|
||||
## Overview
|
||||
|
||||
Transmission is a fast, easy, and free BitTorrent client.
|
||||
|
||||
**Shipped version:** 2.94-2 (Debian repository version)
|
||||
|
||||
**Shipped version:** 2.94~ynh1
|
||||
|
||||
## Screenshots
|
||||

|
||||
|
||||
## Configuration
|
||||

|
||||
|
||||
## Documentation
|
||||
|
||||
* Official documentation: https://github.com/transmission/transmission/wiki
|
||||
* YunoHost documentation: https://yunohost.org/en/app_transmission
|
||||
## Disclaimers / important information
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
* Integration with YunoHost Multimedia directories
|
||||
|
||||
#### Multi-users support
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/transmission/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/transmission/)
|
||||
|
||||
## Limitations
|
||||
|
||||
## Additionnal informations
|
||||
Alternative to WebUI :
|
||||
|
||||
|
@ -55,22 +48,24 @@ You can use the following information to connect your server:
|
|||
* Password: Password of the Yunohost User above
|
||||
* RPC Path: /torrent/transmission/rpc (if you used the standard folder)
|
||||
|
||||
## Links
|
||||
## Documentation and resources
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/transmission_ynh/issues
|
||||
* Transmission website: https://transmissionbt.com/
|
||||
* Transmission repository: https://github.com/transmission/transmission
|
||||
* YunoHost website: https://yunohost.org/
|
||||
* Official app website: <https://www.transmissionbt.com>
|
||||
* Official admin documentation: <https://github.com/transmission/transmission/wiki>
|
||||
* Upstream app code repository: <https://github.com/transmission/transmission>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_transmission>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/transmission_ynh/issues>
|
||||
|
||||
---
|
||||
## Developer info
|
||||
|
||||
## Developers infos
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/transmission_ynh/tree/testing).
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/transmission_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/transmission_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade transmission -u https://github.com/YunoHost-Apps/transmission_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
50
README_fr.md
50
README_fr.md
|
@ -1,42 +1,35 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Transmission pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/transmission)  
|
||||
[](https://dash.yunohost.org/appci/app/transmission)  
|
||||
[](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.
|
||||
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
|
||||
> *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.*
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
Transmission est un client BitTorrent libre, efficace et simple.
|
||||
|
||||
**Version incluse :** 2.94-2 (La version du dépôt de Debian)
|
||||
|
||||
**Version incluse :** 2.94~ynh1
|
||||
|
||||
## Captures d'écran
|
||||

|
||||
|
||||
## Configuration
|
||||

|
||||
|
||||
## Documentation
|
||||
|
||||
* Documentation officielle : https://github.com/transmission/transmission/wiki
|
||||
* Documentation YunoHost : https://yunohost.org/fr/app_transmission
|
||||
## Avertissements / informations importantes
|
||||
|
||||
## Caractéristiques spécifiques YunoHost
|
||||
|
||||
* Intégration avec les répertoires Multimédias de YunoHost
|
||||
|
||||
#### Support multi-utilisateur
|
||||
|
||||
#### Architectures supportées
|
||||
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/transmission/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/transmission/)
|
||||
|
||||
## Limitations
|
||||
|
||||
## Informations additionnelles
|
||||
Alternative à WebUI :
|
||||
|
||||
|
@ -55,21 +48,24 @@ Vous pouvez utiliser les informations suivantes pour vous connecter à votre ser
|
|||
* 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)
|
||||
|
||||
## Liens
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/transmission_ynh/issues
|
||||
* Site de Transmission : https://transmissionbt.com/
|
||||
* Dépôt de Transmission : https://github.com/transmission/transmission
|
||||
* Site de YunoHost : https://yunohost.org/
|
||||
## Documentations et ressources
|
||||
|
||||
---
|
||||
* Site officiel de l'app : <https://www.transmissionbt.com>
|
||||
* 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>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_transmission>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/transmission_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/transmission_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/transmission_ynh/tree/testing --debug
|
||||
ou
|
||||
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>
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
;; Test complet
|
||||
auto_remove=1
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
|
@ -11,14 +10,14 @@
|
|||
setup_private=1
|
||||
setup_public=0
|
||||
upgrade=1
|
||||
# 1.0
|
||||
upgrade=1 from_commit=7d887f6bc1e29ce94de703517d5302580cbb8a7e
|
||||
# 1.0~ynh4
|
||||
upgrade=1 from_commit=c65b76e919089f3f88d2522cef2300db6f78201f
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=down
|
||||
;;; Upgrade options
|
||||
; commit=7d887f6bc1e29ce94de703517d5302580cbb8a7e
|
||||
name= Add acl dependency. Mar 3, 2018
|
||||
manifest_arg=domain=DOMAIN&path=PATH&
|
||||
Notification=none
|
||||
|
|
|
@ -1,23 +1,30 @@
|
|||
location __PATH__/transmission {
|
||||
proxy_pass http://127.0.0.1:__PORT____PATH__/transmission;
|
||||
proxy_pass http://127.0.0.1:__PORT____PATH__/transmission;
|
||||
more_clear_input_headers 'Accept-Encoding';
|
||||
|
||||
client_max_body_size 8M;
|
||||
client_max_body_size 8M;
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
more_clear_input_headers 'Accept-Encoding';
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
||||
location __PATH__/ {
|
||||
proxy_pass http://127.0.0.1:__PORT__/;
|
||||
proxy_pass http://127.0.0.1:__PORT____PATH__/;
|
||||
more_clear_input_headers 'Accept-Encoding';
|
||||
|
||||
client_max_body_size 8M;
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
||||
location __PATH__/downloads/ {
|
||||
alias /home/yunohost.transmission/completed/;
|
||||
autoindex on;
|
||||
autoindex_exact_size off;
|
||||
alias __DATADIR__/completed/;
|
||||
charset UTF-8;
|
||||
autoindex on;
|
||||
autoindex_exact_size off;
|
||||
more_clear_input_headers 'Accept-Encoding';
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
more_clear_input_headers 'Accept-Encoding';
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
|
|
@ -1,75 +1,75 @@
|
|||
{
|
||||
"alt-speed-down": 50,
|
||||
"alt-speed-enabled": false,
|
||||
"alt-speed-time-begin": 540,
|
||||
"alt-speed-time-day": 127,
|
||||
"alt-speed-time-enabled": false,
|
||||
"alt-speed-time-end": 1020,
|
||||
"alt-speed-up": 50,
|
||||
"bind-address-ipv4": "0.0.0.0",
|
||||
"bind-address-ipv6": "::",
|
||||
"blocklist-enabled": false,
|
||||
"blocklist-url": "http://www.example.com/blocklist",
|
||||
"cache-size-mb": 4,
|
||||
"dht-enabled": true,
|
||||
"download-dir": "/home/yunohost.transmission/completed",
|
||||
"download-limit": 100,
|
||||
"download-limit-enabled": 0,
|
||||
"download-queue-enabled": true,
|
||||
"download-queue-size": 5,
|
||||
"encryption": 1,
|
||||
"idle-seeding-limit": 30,
|
||||
"idle-seeding-limit-enabled": false,
|
||||
"incomplete-dir": "/home/yunohost.transmission/progress",
|
||||
"incomplete-dir-enabled": true,
|
||||
"lpd-enabled": false,
|
||||
"max-peers-global": 200,
|
||||
"message-level": 1,
|
||||
"peer-congestion-algorithm": "",
|
||||
"peer-id-ttl-hours": 6,
|
||||
"peer-limit-global": 200,
|
||||
"peer-limit-per-torrent": 50,
|
||||
"peer-port": __PEER_PORT__,
|
||||
"peer-port-random-high": 65535,
|
||||
"peer-port-random-low": 49152,
|
||||
"peer-port-random-on-start": false,
|
||||
"peer-socket-tos": "default",
|
||||
"pex-enabled": true,
|
||||
"port-forwarding-enabled": false,
|
||||
"preallocation": 1,
|
||||
"prefetch-enabled": 1,
|
||||
"queue-stalled-enabled": true,
|
||||
"queue-stalled-minutes": 30,
|
||||
"ratio-limit": 2,
|
||||
"ratio-limit-enabled": false,
|
||||
"rename-partial-files": true,
|
||||
"rpc-authentication-required": false,
|
||||
"rpc-bind-address": "127.0.0.1",
|
||||
"rpc-enabled": true,
|
||||
"rpc-host-whitelist": "",
|
||||
"rpc-host-whitelist-enabled": false,
|
||||
"rpc-password": "__RPC_PASSWORD_TO_CHANGE__",
|
||||
"rpc-port": __PORT__,
|
||||
"rpc-url": "__PATH__transmission/",
|
||||
"rpc-username": "transmission",
|
||||
"rpc-whitelist": "127.0.0.1",
|
||||
"rpc-whitelist-enabled": false,
|
||||
"scrape-paused-torrents-enabled": true,
|
||||
"script-torrent-done-enabled": false,
|
||||
"script-torrent-done-filename": "",
|
||||
"seed-queue-enabled": false,
|
||||
"seed-queue-size": 10,
|
||||
"speed-limit-down": 100,
|
||||
"speed-limit-down-enabled": false,
|
||||
"speed-limit-up": 100,
|
||||
"speed-limit-up-enabled": false,
|
||||
"start-added-torrents": true,
|
||||
"trash-original-torrent-files": false,
|
||||
"umask": 18,
|
||||
"upload-limit": 100,
|
||||
"upload-limit-enabled": 0,
|
||||
"upload-slots-per-torrent": 14,
|
||||
"utp-enabled": true,
|
||||
"watch-dir": "/home/yunohost.transmission/watched",
|
||||
"alt-speed-down": 50,
|
||||
"alt-speed-enabled": false,
|
||||
"alt-speed-time-begin": 540,
|
||||
"alt-speed-time-day": 127,
|
||||
"alt-speed-time-enabled": false,
|
||||
"alt-speed-time-end": 1020,
|
||||
"alt-speed-up": 50,
|
||||
"bind-address-ipv4": "0.0.0.0",
|
||||
"bind-address-ipv6": "::",
|
||||
"blocklist-enabled": false,
|
||||
"blocklist-url": "http://www.example.com/blocklist",
|
||||
"cache-size-mb": 4,
|
||||
"dht-enabled": true,
|
||||
"download-dir": "__DATADIR__/completed",
|
||||
"download-limit": 100,
|
||||
"download-limit-enabled": 0,
|
||||
"download-queue-enabled": true,
|
||||
"download-queue-size": 5,
|
||||
"encryption": 1,
|
||||
"idle-seeding-limit": 30,
|
||||
"idle-seeding-limit-enabled": false,
|
||||
"incomplete-dir": "__DATADIR__/progress",
|
||||
"incomplete-dir-enabled": true,
|
||||
"lpd-enabled": false,
|
||||
"max-peers-global": 200,
|
||||
"message-level": 1,
|
||||
"peer-congestion-algorithm": "",
|
||||
"peer-id-ttl-hours": 6,
|
||||
"peer-limit-global": 200,
|
||||
"peer-limit-per-torrent": 50,
|
||||
"peer-port": __PEER_PORT__,
|
||||
"peer-port-random-high": 65535,
|
||||
"peer-port-random-low": 49152,
|
||||
"peer-port-random-on-start": false,
|
||||
"peer-socket-tos": "default",
|
||||
"pex-enabled": true,
|
||||
"port-forwarding-enabled": false,
|
||||
"preallocation": 1,
|
||||
"prefetch-enabled": true,
|
||||
"queue-stalled-enabled": true,
|
||||
"queue-stalled-minutes": 30,
|
||||
"ratio-limit": 2,
|
||||
"ratio-limit-enabled": false,
|
||||
"rename-partial-files": true,
|
||||
"rpc-authentication-required": false,
|
||||
"rpc-bind-address": "127.0.0.1",
|
||||
"rpc-enabled": true,
|
||||
"rpc-host-whitelist": "",
|
||||
"rpc-host-whitelist-enabled": false,
|
||||
"rpc-password": "__RPCPASSWORD__",
|
||||
"rpc-port": __PORT__,
|
||||
"rpc-url": "__PATH_LESS__transmission/",
|
||||
"rpc-username": "transmission",
|
||||
"rpc-whitelist": "127.0.0.1",
|
||||
"rpc-whitelist-enabled": false,
|
||||
"scrape-paused-torrents-enabled": true,
|
||||
"script-torrent-done-enabled": false,
|
||||
"script-torrent-done-filename": "",
|
||||
"seed-queue-enabled": false,
|
||||
"seed-queue-size": 10,
|
||||
"speed-limit-down": 100,
|
||||
"speed-limit-down-enabled": false,
|
||||
"speed-limit-up": 100,
|
||||
"speed-limit-up-enabled": false,
|
||||
"start-added-torrents": true,
|
||||
"trash-original-torrent-files": false,
|
||||
"umask": 18,
|
||||
"upload-limit": 100,
|
||||
"upload-limit-enabled": 0,
|
||||
"upload-slots-per-torrent": 14,
|
||||
"utp-enabled": true,
|
||||
"watch-dir": "__DATADIR__/watched",
|
||||
"watch-dir-enabled": true
|
||||
}
|
||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
|||
Transmission is a fast, easy, and free BitTorrent client.
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
|||
Transmission est un client BitTorrent libre, efficace et simple.
|
21
doc/DISCLAIMER.md
Normal file
21
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
## 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)
|
21
doc/DISCLAIMER_fr.md
Normal file
21
doc/DISCLAIMER_fr.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
## 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)
|
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
|
@ -1,39 +1,44 @@
|
|||
{
|
||||
"name": "Transmission",
|
||||
"id": "transmission",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "A Fast, Easy, and Free BitTorrent Client",
|
||||
"fr": "Un client BitTorrent libre et rapide"
|
||||
},
|
||||
"version": "1.0~ynh4",
|
||||
"url": "https://www.transmissionbt.com/",
|
||||
"license": "GPL-3.0",
|
||||
"maintainer": {
|
||||
"name": "",
|
||||
"email": ""
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.7"
|
||||
"name": "Transmission",
|
||||
"id": "transmission",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "A Fast, Easy, and Free BitTorrent Client",
|
||||
"fr": "Un client BitTorrent libre et rapide"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"transmission-daemon"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"example": "/transmission",
|
||||
"default": "/transmission"
|
||||
}
|
||||
]
|
||||
}
|
||||
"version": "2.94~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"
|
||||
},
|
||||
"license": "GPL-3.0",
|
||||
"maintainer": {
|
||||
"name": "",
|
||||
"email": ""
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"transmission-daemon"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"example": "/torrent",
|
||||
"default": "/torrent"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
## Problem
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
- *And how you fix that*
|
||||
|
||||
## PR Status
|
||||
- [ ] Code finished.
|
||||
- [ ] Tested with Package_check.
|
||||
- [ ] Fix or enhancement tested.
|
||||
- [ ] Upgrade from last version tested.
|
||||
- [ ] Can be reviewed and tested.
|
||||
|
||||
## Package_check results
|
||||
---
|
||||
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
|
|
@ -18,45 +18,3 @@ pkg_dependencies="transmission-daemon transmission-cli transmission-common acl"
|
|||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Install or update the main directory yunohost.multimedia
|
||||
#
|
||||
# usage: ynh_multimedia_build_main_dir
|
||||
ynh_multimedia_build_main_dir () {
|
||||
local ynh_media_release="v1.2"
|
||||
local checksum="806a827ba1902d6911095602a9221181"
|
||||
|
||||
# Download yunohost.multimedia scripts
|
||||
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1
|
||||
|
||||
# Check the control sum
|
||||
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
||||
|| ynh_die "Corrupt source"
|
||||
|
||||
# Check if the package acl is installed. Or install it.
|
||||
ynh_package_is_installed 'acl' \
|
||||
|| ynh_package_install acl
|
||||
|
||||
# Extract
|
||||
mkdir yunohost.multimedia-master
|
||||
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
|
||||
./yunohost.multimedia-master/script/ynh_media_build.sh
|
||||
}
|
||||
|
||||
# Add a directory in yunohost.multimedia
|
||||
# This "directory" will be a symbolic link to a existing directory.
|
||||
#
|
||||
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
|
||||
#
|
||||
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
|
||||
# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
|
||||
ynh_multimedia_addfolder () {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
|
||||
local source_dir
|
||||
local dest_dir
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -24,6 +25,7 @@ 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
|
||||
|
@ -31,7 +33,13 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE NGINX CONFIGURATION
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
@ -39,24 +47,18 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP TRANSMISSION CONFIGURATION
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/transmission-daemon/settings.json"
|
||||
if [ -e /proc/sys/net/core/rmem_max ]
|
||||
then
|
||||
ynh_backup --src_path="/etc/sysctl.d/90-transmission.conf"
|
||||
ynh_backup --src_path="/etc/sysctl.d/90-transmission.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP DATA
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/usr/share/transmission"
|
||||
ynh_backup --src_path="/var/lib/transmission-daemon"
|
||||
|
||||
ynh_backup --src_path="/home/yunohost.transmission" --is_big
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -28,16 +28,20 @@ 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 UPGRADE THEN ACTIVE TRAP
|
||||
# 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"
|
||||
|
||||
|
@ -68,9 +72,9 @@ fi
|
|||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping Transmission..." --weight=2
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
||||
ynh_systemd_action --service_name=transmission-daemon --action="stop"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
|
@ -107,16 +111,20 @@ fi
|
|||
# UPDATE TRANSMISSION CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="/etc/transmission-daemon/settings.json"
|
||||
|
||||
ynh_replace_string --match_string="rpc-url\": \"${old_path%/}/transmission/" --replace_string="rpc-url\": \"${new_path%/}/transmission/" --target_file="/etc/transmission-daemon/settings.json"
|
||||
|
||||
ynh_store_file_checksum --file="/etc/transmission-daemon/settings.json"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting transmission..." --weight=2
|
||||
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
|
||||
|
|
122
scripts/install
122
scripts/install
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,9 +10,12 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE FAILURE OF THE SCRIPT
|
||||
# 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
|
||||
|
||||
|
@ -25,8 +28,10 @@ path_url=$YNH_APP_ARG_PATH
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
rpcpassword=$(ynh_string_random)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
|
@ -40,30 +45,30 @@ 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"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN PORTS
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=16
|
||||
|
||||
# Find a free port
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=9091)
|
||||
# Open this port
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
# Find a free port
|
||||
peer_port=$(ynh_find_port --port=51413)
|
||||
# Open this port
|
||||
ynh_exec_warn_less yunohost firewall allow Both $peer_port
|
||||
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 TRANSMISSION
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Transmission..." --weight=16
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=16
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
|
@ -78,6 +83,23 @@ then
|
|||
ynh_install_app_dependencies $pkg_dependencies --reinstall
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
datadir=/home/yunohost.transmission
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
mkdir -p $datadir/{progress,completed,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
|
||||
#=================================================
|
||||
|
@ -87,59 +109,33 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
# CREATE DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
mkdir -p /home/yunohost.transmission/{progress,completed,watched}
|
||||
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
chown -R debian-transmission:www-data /home/yunohost.transmission/
|
||||
chown -R debian-transmission: /home/yunohost.transmission/{progress,watched}
|
||||
chmod -R 764 /home/yunohost.transmission
|
||||
chmod -R 777 /home/yunohost.transmission/watched
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE TRANSMISSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Transmission..." --weight=2
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=2
|
||||
|
||||
# Transmission has to be stopped before modifying its config
|
||||
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
||||
|
||||
# Create a RPC password
|
||||
rpcpassword=$(ynh_string_random)
|
||||
ynh_app_setting_set --app=$app --key=rpcpassword --value="$rpcpassword"
|
||||
|
||||
ynh_replace_string --match_string="__RPC_PASSWORD_TO_CHANGE__" --replace_string="$rpcpassword" --target_file=../conf/settings.json
|
||||
if [ "$path_url" != "/" ]
|
||||
then
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url/" --target_file=../conf/settings.json
|
||||
path_less="$path_url/"
|
||||
else
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file=../conf/settings.json
|
||||
path_less="$path_url"
|
||||
fi
|
||||
ynh_replace_string --match_string="__PEER_PORT__" --replace_string="$peer_port" --target_file=../conf/settings.json
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/settings.json
|
||||
cp ../conf/settings.json /etc/transmission-daemon/settings.json
|
||||
|
||||
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
|
||||
|
||||
chmod 400 "/etc/transmission-daemon/settings.json"
|
||||
chown debian-transmission:debian-transmission "/etc/transmission-daemon/settings.json"
|
||||
|
||||
if [ -e /proc/sys/net/core/rmem_max ]
|
||||
then
|
||||
cp ../conf/90-transmission.conf /etc/sysctl.d/90-transmission.conf
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
ynh_add_config --template="../conf/90-transmission.conf" --destination="/etc/sysctl.d/90-transmission.conf"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
||||
#=================================================
|
||||
chmod 400 "/etc/sysctl.d/90-transmission.conf"
|
||||
chown debian-transmission:debian-transmission "/etc/sysctl.d/90-transmission.conf"
|
||||
|
||||
ynh_store_file_checksum --file=/etc/transmission-daemon/settings.json
|
||||
if [ -e /proc/sys/net/core/rmem_max ]
|
||||
then
|
||||
ynh_store_file_checksum --file=/etc/sysctl.d/90-transmission.conf
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -149,11 +145,11 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=4
|
|||
|
||||
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)
|
||||
ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission" --dest_dir="share/Torrents"
|
||||
ynh_multimedia_addfolder --source_dir="$datadir" --dest_dir="share/Torrents"
|
||||
# And share completed directory
|
||||
ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission/completed" --dest_dir="share/Torrents"
|
||||
ynh_multimedia_addfolder --source_dir="$datadir/completed" --dest_dir="share/Torrents"
|
||||
# Share also watched directory, to allow to use it easily
|
||||
ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission/watched" --dest_dir="share/Torrent to download"
|
||||
ynh_multimedia_addfolder --source_dir="$datadir/watched" --dest_dir="share/Torrent to download"
|
||||
|
||||
#=================================================
|
||||
# PATCH SOURCE TO ADD A DOWNLOAD BUTTON
|
||||
|
@ -164,19 +160,21 @@ cat ../sources/extra_files/app/ynh_common.css >> /usr/share/transmission/web/sty
|
|||
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
|
||||
|
||||
#=================================================
|
||||
# START TRANSMISSION
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting Transmission..."
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
ynh_systemd_action --service_name=transmission-daemon --action=start
|
||||
yunohost service add transmission-daemon --description="BitTorrent Client" --log=systemd --needs_exposed_ports="$peer_port"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
yunohost service add transmission-daemon --description="BitTorrent Client" --log="/var/log/syslog" --needs_exposed_ports="$peer_port"
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=transmission-daemon --action="start"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -12,36 +12,46 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation 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
|
||||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `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
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service..." --weight=8
|
||||
ynh_script_progression --message="Removing $app service integration..." --weight=8
|
||||
yunohost service remove transmission-daemon
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE TRANSMISSION-DAEMON
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing transmission..." --weight=9
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated 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 THE PORTS
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
|
@ -56,20 +66,12 @@ then
|
|||
ynh_exec_warn_less yunohost firewall disallow Both $peer_port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE DATA
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing transmission data..."
|
||||
ynh_script_progression --message="Removing various files..."
|
||||
|
||||
# Web interface
|
||||
ynh_secure_remove --file=/usr/share/transmission
|
||||
|
@ -78,16 +80,16 @@ ynh_secure_remove --file=/var/lib/transmission-daemon
|
|||
# Kernel parameters
|
||||
if [ -e /proc/sys/net/core/rmem_max ]
|
||||
then
|
||||
ynh_secure_remove --file=/etc/sysctl.d/90-transmission.conf
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
ynh_secure_remove --file=/etc/sysctl.d/90-transmission.conf
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user"
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=debian-transmission
|
||||
|
|
130
scripts/restore
130
scripts/restore
|
@ -6,6 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -13,13 +14,16 @@ 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 settings..."
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -27,23 +31,67 @@ 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..."
|
||||
|
||||
ynh_webpath_available $domain $path_url \
|
||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=16
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORE STEPS
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
|
||||
mkdir -p $datadir/{progress,completed,watched}
|
||||
|
||||
chmod -R 764 $datadir
|
||||
chmod -R 777 $datadir/watched
|
||||
chown -R debian-transmission:www-data "$datadir"
|
||||
chown -R debian-transmission: $datadir/{progress,watched}
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring various files..." --weight=2
|
||||
|
||||
# Transmission has to be stopped before modifying its config
|
||||
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
||||
|
||||
ynh_secure_remove --file=/etc/transmission-daemon/settings.json
|
||||
ynh_restore_file --origin_path=/etc/transmission-daemon/settings.json
|
||||
|
||||
if [ -e /proc/sys/net/core/rmem_max ]
|
||||
then
|
||||
ynh_restore_file --origin_path="/etc/sysctl.d/90-transmission.conf"
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
|
||||
ynh_secure_remove --file=/usr/share/transmission
|
||||
ynh_restore_file --origin_path=/usr/share/transmission
|
||||
|
||||
ynh_secure_remove --file=/var/lib/transmission-daemon
|
||||
ynh_restore_file --origin_path=/var/lib/transmission-daemon
|
||||
|
||||
#=================================================
|
||||
# OPEN PORTS
|
||||
#=================================================
|
||||
|
@ -52,57 +100,6 @@ 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
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORE
|
||||
#=================================================
|
||||
# REINSTALL TRANSMISSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling Transmission..." --weight=16
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE TRANSMISSION CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Transmission configuration..." --weight=2
|
||||
|
||||
# Transmission has to be stopped before modifying its config
|
||||
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
||||
|
||||
ynh_secure_remove --file=/etc/transmission-daemon/settings.json
|
||||
ynh_restore_file --origin_path=/etc/transmission-daemon/settings.json
|
||||
|
||||
if [ -e /proc/sys/net/core/rmem_max ]
|
||||
then
|
||||
ynh_restore_file --origin_path="/etc/sysctl.d/90-transmission.conf"
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RESTORE DATA
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring transmission data..."
|
||||
|
||||
ynh_secure_remove --file=/usr/share/transmission
|
||||
ynh_restore_file --origin_path=/usr/share/transmission
|
||||
|
||||
ynh_secure_remove --file=/var/lib/transmission-daemon
|
||||
ynh_restore_file --origin_path=/var/lib/transmission-daemon
|
||||
|
||||
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
|
||||
ynh_restore_file --origin_path="/home/yunohost.transmission" --not_mandatory
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
mkdir -p /home/yunohost.transmission/{progress,completed,watched}
|
||||
chown -R debian-transmission:www-data /home/yunohost.transmission/
|
||||
chown -R debian-transmission: /home/yunohost.transmission/{progress,watched}
|
||||
chmod -R 640 /home/yunohost.transmission
|
||||
chmod -R 777 /home/yunohost.transmission/watched
|
||||
|
||||
#=================================================
|
||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||
#=================================================
|
||||
|
@ -110,25 +107,26 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=4
|
|||
|
||||
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)
|
||||
ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission" --dest_dir="share/Torrents"
|
||||
ynh_multimedia_addfolder --source_dir="$datadir" --dest_dir="share/Torrents"
|
||||
# And share completed directory
|
||||
ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission/completed" --dest_dir="share/Torrents"
|
||||
ynh_multimedia_addfolder --source_dir="$datadir/completed" --dest_dir="share/Torrents"
|
||||
# Share also watched directory, to allow to use it easily
|
||||
ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission/watched" --dest_dir="share/Torrent to download"
|
||||
ynh_multimedia_addfolder --source_dir="$datadir/watched" --dest_dir="share/Torrent to download"
|
||||
|
||||
#=================================================
|
||||
# START TRANSMISSION
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting transmission..."
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add transmission-daemon --description="BitTorrent Client" --log=systemd --needs_exposed_ports="$peer_port"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=transmission-daemon --action=start
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add transmission-daemon --description="BitTorrent Client" --log="/var/log/syslog" --needs_exposed_ports="$peer_port"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
155
scripts/upgrade
155
scripts/upgrade
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -20,13 +20,40 @@ 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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
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
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=transmission-daemon --action="stop"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -35,8 +62,8 @@ 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
|
||||
|
@ -45,30 +72,19 @@ fi
|
|||
# Add peer_port also on UDP.
|
||||
ynh_exec_warn_less yunohost firewall allow UDP $peer_port
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
|
||||
|
||||
# Inform the backup/restore process that it should not save the data directory
|
||||
# Use only for the previous backup script that doesn't set 'is_big'
|
||||
ynh_app_setting_set $app backup_core_only 1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
||||
# Remove the option backup_core_only after the backup.
|
||||
ynh_app_setting_delete $app backup_core_only
|
||||
|
||||
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
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=7
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -77,74 +93,48 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=7
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# CREATE DIRECTORIES
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
mkdir -p /home/yunohost.transmission/{progress,completed,watched}
|
||||
mkdir -p $datadir/{progress,completed,watched}
|
||||
|
||||
chmod -R 764 $datadir
|
||||
chmod -R 777 $datadir/watched
|
||||
chown -R debian-transmission:www-data "$datadir"
|
||||
chown -R debian-transmission: $datadir/{progress,watched}
|
||||
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
chown -R debian-transmission:www-data /home/yunohost.transmission/
|
||||
chown -R debian-transmission: /home/yunohost.transmission/{progress,watched}
|
||||
chmod -R 764 /home/yunohost.transmission
|
||||
chmod -R 777 /home/yunohost.transmission/watched
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE TRANSMISSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring Transmission..." --weight=2
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=2
|
||||
|
||||
# Transmission has to be stopped before modifying its config
|
||||
ynh_systemd_action --service_name=transmission-daemon --action=stop
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different --file=/etc/transmission-daemon/settings.json
|
||||
|
||||
# Create a RPC password
|
||||
rpcpassword=$(ynh_string_random)
|
||||
ynh_app_setting_set --app=$app --key=rpcpassword --value="$rpcpassword"
|
||||
|
||||
ynh_replace_string --match_string="__RPC_PASSWORD_TO_CHANGE__" --replace_string="$rpcpassword" --target_file=../conf/settings.json
|
||||
if [ "$path_url" != "/" ]
|
||||
then
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url/" --target_file=../conf/settings.json
|
||||
path_less="$path_url/"
|
||||
else
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file=../conf/settings.json
|
||||
path_less="$path_url"
|
||||
fi
|
||||
ynh_replace_string --match_string="__PEER_PORT__" --replace_string="$peer_port" --target_file=../conf/settings.json
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/settings.json
|
||||
cp ../conf/settings.json /etc/transmission-daemon/settings.json
|
||||
|
||||
ynh_add_config --template="../conf/settings.json" --destination="/etc/transmission-daemon/settings.json"
|
||||
|
||||
chmod 400 "/etc/transmission-daemon/settings.json"
|
||||
chown debian-transmission:debian-transmission "/etc/transmission-daemon/settings.json"
|
||||
|
||||
if [ -e /proc/sys/net/core/rmem_max ]
|
||||
then
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different --file=/etc/sysctl.d/90-transmission.conf
|
||||
ynh_add_config --template="../conf/90-transmission.conf" --destination="/etc/sysctl.d/90-transmission.conf"
|
||||
|
||||
cp ../conf/90-transmission.conf /etc/sysctl.d/90-transmission.conf
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
chmod 400 "/etc/sysctl.d/90-transmission.conf"
|
||||
chown debian-transmission:debian-transmission "/etc/sysctl.d/90-transmission.conf"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
# Recalculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file=/etc/transmission-daemon/settings.json
|
||||
if [ -e /proc/sys/net/core/rmem_max ]
|
||||
then
|
||||
ynh_store_file_checksum --file=/etc/sysctl.d/90-transmission.conf
|
||||
sysctl --load=/etc/sysctl.d/90-transmission.conf
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -154,11 +144,11 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=3
|
|||
|
||||
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)
|
||||
ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission" --dest_dir="share/Torrents"
|
||||
ynh_multimedia_addfolder --source_dir="$datadir" --dest_dir="share/Torrents"
|
||||
# And share completed directory
|
||||
ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission/completed" --dest_dir="share/Torrents"
|
||||
ynh_multimedia_addfolder --source_dir="$datadir/completed" --dest_dir="share/Torrents"
|
||||
# Share also watched directory, to allow to use it easily
|
||||
ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission/watched" --dest_dir="share/Torrent to download"
|
||||
ynh_multimedia_addfolder --source_dir="$datadir/watched" --dest_dir="share/Torrent to download"
|
||||
|
||||
#=================================================
|
||||
# PATCH SOURCE TO ADD A DOWNLOAD BUTTON
|
||||
|
@ -167,25 +157,26 @@ ynh_multimedia_addfolder --source_dir="/home/yunohost.transmission/watched" --de
|
|||
cp ../sources/extra_files/app/toolbar-downloads.png /usr/share/transmission/web/style/transmission/images/toolbar-downloads.png
|
||||
if ! grep --quiet "Inserted by Yunohost install script" /usr/share/transmission/web/style/transmission/common.css
|
||||
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
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add transmission-daemon --description="BitTorrent Client" --log="/var/log/syslog" --needs_exposed_ports="$peer_port"
|
||||
yunohost service add transmission-daemon --description="BitTorrent Client" --log=systemd --needs_exposed_ports="$peer_port"
|
||||
|
||||
#=================================================
|
||||
# START TRANSMISSION
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting Transmission..." --weight=2
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue