mirror of
https://github.com/YunoHost-Apps/couchpotato_ynh.git
synced 2024-09-03 18:16:22 +02:00
Merge pull request #19 from YunoHost-Apps/upgrade
Apply last example_ynh
This commit is contained in:
commit
5167c1e1d2
16 changed files with 337 additions and 330 deletions
26
README.md
26
README.md
|
@ -5,7 +5,7 @@ It shall NOT be edited by hand.
|
||||||
|
|
||||||
# CouchPotato for YunoHost
|
# CouchPotato for YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/couchpotato)  
|
[](https://dash.yunohost.org/appci/app/couchpotato)  
|
||||||
[](https://install-app.yunohost.org/?app=couchpotato)
|
[](https://install-app.yunohost.org/?app=couchpotato)
|
||||||
|
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
@ -15,34 +15,38 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Automatic movie downloader
|
Download movies automatically, easily and in the best quality as soon as they are available.
|
||||||
|
|
||||||
**Shipped version:** 3.0.1~ynh3
|
|
||||||
|
|
||||||
|
|
||||||
|
**Shipped version:** 3.0.1~ynh4
|
||||||
|
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Disclaimers / important information
|
## Disclaimers / important information
|
||||||
|
|
||||||
* Other infos that people should be aware of, such as:
|
|
||||||
* Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...),
|
* Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...),
|
||||||
* Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure
|
* Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: https://couchpota.to
|
* Official app website: <https://couchpota.to>
|
||||||
* Upstream app code repository: https://github.com/CouchPotato/CouchPotatoServer
|
* Upstream app code repository: <https://github.com/CouchPotato/CouchPotatoServer>
|
||||||
* YunoHost documentation for this app: https://yunohost.org/app_couchpotato
|
* YunoHost documentation for this app: <https://yunohost.org/app_couchpotato>
|
||||||
* Report a bug: https://github.com/YunoHost-Apps/couchpotato_ynh/issues
|
* Report a bug: <https://github.com/YunoHost-Apps/couchpotato_ynh/issues>
|
||||||
|
|
||||||
## Developer info
|
## Developer info
|
||||||
|
|
||||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing).
|
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing).
|
||||||
|
|
||||||
To try the testing branch, please proceed like that.
|
To try the testing branch, please proceed like that.
|
||||||
```
|
|
||||||
|
``` bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug
|
||||||
or
|
or
|
||||||
sudo yunohost app upgrade couchpotato -u https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug
|
sudo yunohost app upgrade couchpotato -u https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||||
|
|
32
README_fr.md
32
README_fr.md
|
@ -1,44 +1,52 @@
|
||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
|
||||||
# CouchPotato pour YunoHost
|
# CouchPotato pour YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/couchpotato)  
|
[](https://dash.yunohost.org/appci/app/couchpotato)  
|
||||||
[](https://install-app.yunohost.org/?app=couchpotato)
|
[](https://install-app.yunohost.org/?app=couchpotato)
|
||||||
|
|
||||||
*[Read this readme in english.](./README.md)*
|
*[Read this readme in english.](./README.md)*
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
|
||||||
|
|
||||||
> *Ce package vous permet d'installer CouchPotato rapidement et simplement sur un serveur YunoHost.
|
> *Ce package vous permet d'installer CouchPotato 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
|
||||||
|
|
||||||
Téléchargement automatisé de film
|
Download movies automatically, easily and in the best quality as soon as they are available.
|
||||||
|
|
||||||
**Version incluse :** 3.0.1~ynh3
|
|
||||||
|
|
||||||
|
|
||||||
|
**Version incluse :** 3.0.1~ynh4
|
||||||
|
|
||||||
|
|
||||||
|
## Captures d'écran
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
* Other infos that people should be aware of, such as:
|
|
||||||
* Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...),
|
* Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...),
|
||||||
* Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure
|
* Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l'app : https://couchpota.to
|
* Site officiel de l'app : <https://couchpota.to>
|
||||||
* Dépôt de code officiel de l'app : https://github.com/CouchPotato/CouchPotatoServer
|
* Dépôt de code officiel de l'app : <https://github.com/CouchPotato/CouchPotatoServer>
|
||||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_couchpotato
|
* Documentation YunoHost pour cette app : <https://yunohost.org/app_couchpotato>
|
||||||
* Signaler un bug : https://github.com/YunoHost-Apps/couchpotato_ynh/issues
|
* Signaler un bug : <https://github.com/YunoHost-Apps/couchpotato_ynh/issues>
|
||||||
|
|
||||||
## Informations pour les développeurs
|
## Informations pour les développeurs
|
||||||
|
|
||||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing).
|
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing).
|
||||||
|
|
||||||
Pour essayer la branche testing, procédez comme suit.
|
Pour essayer la branche testing, procédez comme suit.
|
||||||
```
|
|
||||||
|
``` bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug
|
||||||
ou
|
ou
|
||||||
sudo yunohost app upgrade couchpotato -u https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug
|
sudo yunohost app upgrade couchpotato -u https://github.com/YunoHost-Apps/couchpotato_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>
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
setup_public=0
|
setup_public=0
|
||||||
upgrade=1
|
upgrade=1
|
||||||
# From GIT
|
# From GIT
|
||||||
upgrade=1 from_commit=2a7461345d70ae231cc81a580189934626ed8c58
|
upgrade=0 from_commit=2a7461345d70ae231cc81a580189934626ed8c58
|
||||||
# 3.0.1~ynh2
|
# 3.0.1~ynh2
|
||||||
upgrade=1 from_commit=06e0d129fef72c1c43063f81ae2bef97576f7fa7
|
upgrade=0 from_commit=06e0d129fef72c1c43063f81ae2bef97576f7fa7
|
||||||
|
# 3.0.1~ynh3
|
||||||
|
upgrade=1 from_commit=686a590376d1b18ed38cfd4b8676d4a1cf3867fb
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
port_already_use=1 (5050)
|
port_already_use=1 (5050)
|
||||||
|
@ -21,8 +23,3 @@
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
;;; Upgrade options
|
|
||||||
; commit=2a7461345d70ae231cc81a580189934626ed8c58
|
|
||||||
name=From GIT
|
|
||||||
; commit=06e0d129fef72c1c43063f81ae2bef97576f7fa7
|
|
||||||
name=3.0.1~ynh2
|
|
||||||
|
|
|
@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
SOURCE_FILENAME=
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
location __PATH__ {
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
|
location __PATH__/ {
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_pass_header Server;
|
proxy_pass_header Server;
|
||||||
proxy_pass http://127.0.0.1:__PORT__;
|
proxy_pass http://127.0.0.1:__PORT__;
|
||||||
|
|
|
@ -9,6 +9,5 @@ Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__FINALPATH__/
|
||||||
ExecStart=/opt/pyenv/versions/__PYTHON_VERSION__/bin/python __FINALPATH__/CouchPotato.py --quiet --pid_file=/var/run/__APP__/__APP__.pid --data_dir=__DATADIR__ --config_file=__DATADIR__/settings.conf
|
ExecStart=/opt/pyenv/versions/__PYTHON_VERSION__/bin/python __FINALPATH__/CouchPotato.py --quiet --pid_file=/var/run/__APP__/__APP__.pid --data_dir=__DATADIR__ --config_file=__DATADIR__/settings.conf
|
||||||
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Download movies automatically, easily and in the best quality as soon as they are available.
|
|
@ -1,3 +1,2 @@
|
||||||
* Other infos that people should be aware of, such as:
|
|
||||||
* Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...),
|
* Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...),
|
||||||
* Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure
|
* Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure
|
||||||
|
|
BIN
doc/screenshots/couchpotato_interface.png
Normal file
BIN
doc/screenshots/couchpotato_interface.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 165 KiB |
|
@ -6,7 +6,7 @@
|
||||||
"en": "Automatic movie downloader",
|
"en": "Automatic movie downloader",
|
||||||
"fr": "Téléchargement automatisé de film"
|
"fr": "Téléchargement automatisé de film"
|
||||||
},
|
},
|
||||||
"version": "3.0.1~ynh3",
|
"version": "3.0.1~ynh4",
|
||||||
"url": "https://couchpota.to/",
|
"url": "https://couchpota.to/",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
|
@ -30,8 +30,7 @@
|
||||||
"install": [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain"
|
||||||
"example": "example.com"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app (must be on a single line)
|
||||||
pkg_dependencies=""
|
pkg_dependencies=""
|
||||||
#python-pip python-virtualenv python-dev uwsgi uwsgi-plugin-python
|
|
||||||
|
|
||||||
python_version=2.7.18
|
python_version=2.7.18
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..."
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
final_path=/opt/yunohost/$app
|
final_path=/opt/yunohost/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
@ -43,7 +43,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..."
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
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=path --value=$path_url
|
||||||
|
@ -53,7 +53,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Finding an available port..."
|
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=5050)
|
port=$(ynh_find_port --port=5050)
|
||||||
|
@ -64,28 +64,29 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
|
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
|
||||||
|
|
||||||
# Open the port
|
# Open the port
|
||||||
# ynh_script_progression --message="Configuring firewall..."
|
# ynh_script_progression --message="Configuring firewall..." --weight=1
|
||||||
# ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
# ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..."
|
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
ynh_install_python --python_version=$python_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring system user..."
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..."
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
@ -98,7 +99,7 @@ chown -R $app:$app "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..."
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -108,7 +109,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..."
|
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||||
|
|
||||||
datadir=/home/yunohost.app/$app
|
datadir=/home/yunohost.app/$app
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||||
|
@ -122,20 +123,19 @@ chown -R $app:$app "$datadir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD COUCHPOTATO
|
# BUILD COUCHPOTATO
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building CouchPotato..."
|
ynh_script_progression --message="Building CouchPotato..." --weight=1
|
||||||
|
|
||||||
ynh_install_python --python_version=$python_version
|
|
||||||
ynh_use_python
|
ynh_use_python
|
||||||
|
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
/opt/pyenv/versions/$python_version/bin/pip install --upgrade pyopenssl
|
ynh_pip install --upgrade pyopenssl
|
||||||
/opt/pyenv/versions/$python_version/bin/pip install cheetah
|
ynh_pip install cheetah
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL YUNOHOST MULTIMEDIA
|
# INSTALL YUNOHOST MULTIMEDIA
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install YunoHost multimedia..."
|
ynh_script_progression --message="Install YunoHost multimedia..." --weight=1
|
||||||
|
|
||||||
# Creates the "Movies" subfolder in "Video"
|
# Creates the "Movies" subfolder in "Video"
|
||||||
mkdir -p "$MEDIA_DIRECTORY/share/Video/Movies"
|
mkdir -p "$MEDIA_DIRECTORY/share/Video/Movies"
|
||||||
|
@ -148,7 +148,7 @@ ynh_multimedia_addaccess $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE TRANSMISSION
|
# CONFIGURE TRANSMISSION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring transmission..."
|
ynh_script_progression --message="Configuring transmission..." --weight=1
|
||||||
|
|
||||||
# Variable initialization
|
# Variable initialization
|
||||||
rpc=""
|
rpc=""
|
||||||
|
@ -202,7 +202,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..."
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/couchpotato.conf" --destination="$datadir/settings.conf"
|
ynh_add_config --template="../conf/couchpotato.conf" --destination="$datadir/settings.conf"
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ chown $app:$app "$datadir/settings.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
@ -220,7 +220,7 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE LOGS
|
# CONFIGURE LOGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring logs..."
|
ynh_script_progression --message="Configuring logs..." --weight=1
|
||||||
|
|
||||||
# Redirect logs directory
|
# Redirect logs directory
|
||||||
app_logs_dir="/var/log/$app"
|
app_logs_dir="/var/log/$app"
|
||||||
|
@ -234,7 +234,7 @@ ynh_replace_string --match_string="self.log_dir =.*" --replace_string="self.log_
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring log rotation..."
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
@ -242,14 +242,14 @@ ynh_use_logrotate
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="CouchPotato Daemon" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="CouchPotato Daemon" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
@ -257,7 +257,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..."
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --sho
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -277,4 +277,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed"
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
# 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 ynh_exec_warn_less yunohost service status $app >/dev/null
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..."
|
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP AND REMOVE SERVICE
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
@ -45,24 +45,15 @@ ynh_remove_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing logrotate configuration..."
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..."
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_python
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing app main directory..."
|
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
@ -70,18 +61,27 @@ ynh_secure_remove --file="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
# 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=1
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_python
|
||||||
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CLOSE A PORT
|
# CLOSE A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Closing port $port..."
|
ynh_script_progression --message="Closing port $port..." --weight=1
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE VARIOUS FILES
|
# REMOVE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing various files..."
|
ynh_script_progression --message="Removing various files..." --weight=1
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove --file="/var/log/$app"
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
@ -100,7 +100,7 @@ ynh_secure_remove --file="/var/log/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the dedicated system user..."
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete --username=$app
|
ynh_system_user_delete --username=$app
|
||||||
|
@ -109,4 +109,4 @@ ynh_system_user_delete --username=$app
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed"
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
|
@ -24,7 +24,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -36,26 +36,17 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..."
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
|
||||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
|
@ -63,7 +54,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
|
@ -74,7 +65,7 @@ chown -R $app:$app "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..."
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||||
|
|
||||||
|
@ -89,17 +80,24 @@ chown -R $app:$app "$datadir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..."
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
ynh_install_python --python_version=$python_version
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD COUCHPOTATO
|
# BUILD COUCHPOTATO
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building CouchPotato..."
|
ynh_script_progression --message="Building CouchPotato..." --weight=1
|
||||||
|
|
||||||
ynh_install_python --python_version=$python_version
|
|
||||||
ynh_use_python
|
ynh_use_python
|
||||||
|
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
|
@ -110,7 +108,7 @@ popd
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL YUNOHOST MULTIMEDIA
|
# INSTALL YUNOHOST MULTIMEDIA
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install YunoHost multimedia..."
|
ynh_script_progression --message="Install YunoHost multimedia..." --weight=1
|
||||||
|
|
||||||
# Creates the "Movies" subfolder in "Video"
|
# Creates the "Movies" subfolder in "Video"
|
||||||
mkdir -p "$MEDIA_DIRECTORY/share/Video/Movies"
|
mkdir -p "$MEDIA_DIRECTORY/share/Video/Movies"
|
||||||
|
@ -123,7 +121,7 @@ ynh_multimedia_addaccess $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE LOGS
|
# CONFIGURE LOGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring logs..."
|
ynh_script_progression --message="Configuring logs..." --weight=1
|
||||||
|
|
||||||
# Redirect logs directory
|
# Redirect logs directory
|
||||||
app_logs_dir="/var/log/$app"
|
app_logs_dir="/var/log/$app"
|
||||||
|
@ -135,7 +133,7 @@ ynh_replace_string --match_string="self.log_dir =.*" --replace_string="self.log_
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
@ -143,21 +141,21 @@ systemctl enable $app.service --quiet
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="CouchPotato Daemon" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="CouchPotato Daemon" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
|
@ -166,7 +164,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -174,4 +172,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app"
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
|
@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -26,14 +26,14 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Checking version..."
|
ynh_script_progression --message="Checking version..." --weight=1
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -49,14 +49,14 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..."
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
# If final_path doesn't exist, create it
|
||||||
if [ -z "$final_path" ]; then
|
if [ -z "$final_path" ]; then
|
||||||
|
@ -96,10 +96,10 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -107,7 +107,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
|
@ -119,40 +119,40 @@ chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
ynh_install_python --python_version=$python_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD COUCHPOTATO
|
# BUILD COUCHPOTATO
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building CouchPotato..."
|
ynh_script_progression --message="Building CouchPotato..." --weight=1
|
||||||
|
|
||||||
ynh_install_python --python_version=$python_version
|
|
||||||
ynh_use_python
|
ynh_use_python
|
||||||
|
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
/opt/pyenv/versions/$python_version/bin/pip install --upgrade pyopenssl
|
ynh_pip install --upgrade pyopenssl
|
||||||
/opt/pyenv/versions/$python_version/bin/pip install cheetah
|
ynh_pip install cheetah
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL YUNOHOST MULTIMEDIA
|
# INSTALL YUNOHOST MULTIMEDIA
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install YunoHost multimedia..."
|
ynh_script_progression --message="Install YunoHost multimedia..." --weight=1
|
||||||
|
|
||||||
# Creates the "Movies" subfolder in "Video"
|
# Creates the "Movies" subfolder in "Video"
|
||||||
mkdir -p "$MEDIA_DIRECTORY/share/Video/Movies"
|
mkdir -p "$MEDIA_DIRECTORY/share/Video/Movies"
|
||||||
|
@ -165,7 +165,7 @@ ynh_multimedia_addaccess $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE TRANSMISSION
|
# CONFIGURE TRANSMISSION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring transmission..."
|
ynh_script_progression --message="Configuring transmission..." --weight=1
|
||||||
|
|
||||||
# Variable initialization
|
# Variable initialization
|
||||||
rpc=""
|
rpc=""
|
||||||
|
@ -219,7 +219,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..."
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different --file="$datadir/settings.conf"
|
ynh_backup_if_checksum_is_different --file="$datadir/settings.conf"
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ chown $app:$app "$datadir/settings.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE LOGS
|
# CONFIGURE LOGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring logs..."
|
ynh_script_progression --message="Configuring logs..." --weight=1
|
||||||
|
|
||||||
# Redirect logs directory
|
# Redirect logs directory
|
||||||
app_logs_dir="/var/log/$app"
|
app_logs_dir="/var/log/$app"
|
||||||
|
@ -241,7 +241,7 @@ ynh_replace_string --match_string="self.log_dir =.*" --replace_string="self.log_
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
@ -251,7 +251,7 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
|
@ -259,21 +259,21 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="CouchPotato Daemon" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="CouchPotato Daemon" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -281,4 +281,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed"
|
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||||
|
|
|
@ -12,9 +12,10 @@ pyenv_install_dir="/opt/pyenv"
|
||||||
python_version_path="$pyenv_install_dir/versions"
|
python_version_path="$pyenv_install_dir/versions"
|
||||||
# PYENV_ROOT is the directory of pyenv, it needs to be loaded as a environment variable.
|
# PYENV_ROOT is the directory of pyenv, it needs to be loaded as a environment variable.
|
||||||
export PYENV_ROOT="$pyenv_install_dir"
|
export PYENV_ROOT="$pyenv_install_dir"
|
||||||
|
export pyenv_root="$pyenv_install_dir"
|
||||||
|
|
||||||
# Required dependencies
|
# Required dependencies
|
||||||
pyenv_dependencies="build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev|libedit-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git"
|
pyenv_dependencies="make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git"
|
||||||
|
|
||||||
# Load the version of Python for an app, and set variables.
|
# Load the version of Python for an app, and set variables.
|
||||||
#
|
#
|
||||||
|
@ -30,7 +31,7 @@ pyenv_dependencies="build-essential libssl-dev zlib1g-dev libbz2-dev libreadline
|
||||||
# Exemple: `ynh_exec_as $app $ynh_python_load_path $ynh_pip install`
|
# Exemple: `ynh_exec_as $app $ynh_python_load_path $ynh_pip install`
|
||||||
#
|
#
|
||||||
# $PATH contains the path of the requested version of Python.
|
# $PATH contains the path of the requested version of Python.
|
||||||
# However, $PATH is duplicated into $python_path to outlast any manipulation of $PATH
|
# However, $PATH is duplicated into $ynh_python_path to outlast any manipulation of $PATH
|
||||||
# You can use the variable `$ynh_python_load_path` to quickly load your Python version
|
# You can use the variable `$ynh_python_load_path` to quickly load your Python version
|
||||||
# in $PATH for an usage into a separate script.
|
# in $PATH for an usage into a separate script.
|
||||||
# Exemple: $ynh_python_load_path $final_path/script_that_use_pip.sh`
|
# Exemple: $ynh_python_load_path $final_path/script_that_use_pip.sh`
|
||||||
|
@ -39,40 +40,39 @@ pyenv_dependencies="build-essential libssl-dev zlib1g-dev libbz2-dev libreadline
|
||||||
# Finally, to start a Python service with the correct version, 2 solutions
|
# Finally, to start a Python service with the correct version, 2 solutions
|
||||||
# Either the app is dependent of python or pip, but does not called it directly.
|
# Either the app is dependent of python or pip, but does not called it directly.
|
||||||
# In such situation, you need to load PATH
|
# In such situation, you need to load PATH
|
||||||
# `Environment="__YNH_PYTHON_LOAD_ENV_PATH__"`
|
# `Environment="__YNH_PYTHON_LOAD_PATH__"`
|
||||||
# `ExecStart=__FINALPATH__/my_app`
|
# `ExecStart=__FINALPATH__/my_app`
|
||||||
# You will replace __YNH_PYTHON_LOAD_ENV_PATH__ with $ynh_python_load_path
|
# You will replace __YNH_PYTHON_LOAD_PATH__ with $ynh_python_load_path
|
||||||
#
|
#
|
||||||
# Or Python start the app directly, then you don't need to load the PATH variable
|
# Or Python start the app directly, then you don't need to load the PATH variable
|
||||||
# `ExecStart=__YNH_PYTHON__ my_app run`
|
# `ExecStart=__YNH_PYTHON__ my_app run`
|
||||||
# You will replace __YNH_PYTHON__ with $ynh_python
|
# You will replace __YNH_PYTHON__ with $ynh_python
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# one other variable is also available
|
# one other variable is also available
|
||||||
# - $python_path: The absolute path to Python binaries for the chosen version.
|
# - $ynh_python_path: The absolute path to Python binaries for the chosen version.
|
||||||
#
|
#
|
||||||
# usage: ynh_use_python
|
# usage: ynh_use_python
|
||||||
#
|
#
|
||||||
# Requires YunoHost version 2.7.12 or higher.
|
# Requires YunoHost version 3.2.2 or higher.
|
||||||
ynh_use_python () {
|
ynh_use_python () {
|
||||||
python_version=$(ynh_app_setting_get --app=$app --key=python_version)
|
python_version=$(ynh_app_setting_get --app=$app --key=python_version)
|
||||||
|
|
||||||
# Get the absolute path of this version of Python
|
# Get the absolute path of this version of Python
|
||||||
python_path="$python_version_path/$YNH_APP_INSTANCE_NAME/bin"
|
ynh_python_path="$python_version_path/$YNH_APP_INSTANCE_NAME/bin"
|
||||||
|
|
||||||
# Allow alias to be used into bash script
|
# Allow alias to be used into bash script
|
||||||
shopt -s expand_aliases
|
shopt -s expand_aliases
|
||||||
|
|
||||||
# Create an alias for the specific version of Python and a variable as fallback
|
# Create an alias for the specific version of Python and a variable as fallback
|
||||||
ynh_python="$python_path/python"
|
ynh_python="$ynh_python_path/python"
|
||||||
alias ynh_python="$ynh_python"
|
alias ynh_python="$ynh_python"
|
||||||
# And pip
|
# And pip
|
||||||
ynh_pip="$python_path/pip"
|
ynh_pip="$ynh_python_path/pip"
|
||||||
alias ynh_pip="$ynh_pip"
|
alias ynh_pip="$ynh_pip"
|
||||||
|
|
||||||
# Load the path of this version of Python in $PATH
|
# Load the path of this version of Python in $PATH
|
||||||
if [[ :$PATH: != *":$python_path"* ]]; then
|
if [[ :$PATH: != *":$ynh_python_path"* ]]; then
|
||||||
PATH="$python_path:$PATH"
|
PATH="$ynh_python_path:$PATH"
|
||||||
fi
|
fi
|
||||||
# Create an alias to easily load the PATH
|
# Create an alias to easily load the PATH
|
||||||
ynh_python_load_path="PATH=$PATH"
|
ynh_python_load_path="PATH=$PATH"
|
||||||
|
@ -98,7 +98,7 @@ ynh_use_python () {
|
||||||
# usage: ynh_install_python --python_version=python_version
|
# usage: ynh_install_python --python_version=python_version
|
||||||
# | arg: -v, --python_version= - Version of Python to install.
|
# | arg: -v, --python_version= - Version of Python to install.
|
||||||
#
|
#
|
||||||
# Requires YunoHost version 2.7.12 or higher.
|
# Requires YunoHost version 3.2.2 or higher.
|
||||||
ynh_install_python () {
|
ynh_install_python () {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=v
|
local legacy_args=v
|
||||||
|
@ -125,7 +125,7 @@ ynh_install_python () {
|
||||||
ynh_print_info --message="pyenv already seems installed in \`$pyenv'."
|
ynh_print_info --message="pyenv already seems installed in \`$pyenv'."
|
||||||
pushd "${pyenv%/*/*}"
|
pushd "${pyenv%/*/*}"
|
||||||
if git remote -v 2>/dev/null | grep "https://github.com/pyenv/pyenv.git"; then
|
if git remote -v 2>/dev/null | grep "https://github.com/pyenv/pyenv.git"; then
|
||||||
echo "Trying to update with git..."
|
ynh_print_info --message="Trying to update with git..."
|
||||||
git pull -q --tags origin master
|
git pull -q --tags origin master
|
||||||
cd ..
|
cd ..
|
||||||
ynh_python_try_bash_extension
|
ynh_python_try_bash_extension
|
||||||
|
@ -178,6 +178,7 @@ ynh_install_python () {
|
||||||
|
|
||||||
# Create shims directory if needed
|
# Create shims directory if needed
|
||||||
mkdir -p "${pyenv_install_dir}/shims"
|
mkdir -p "${pyenv_install_dir}/shims"
|
||||||
|
chmod -R a+w "${pyenv_install_dir}/shims"
|
||||||
|
|
||||||
# Restore /usr/local/bin in PATH
|
# Restore /usr/local/bin in PATH
|
||||||
PATH=$CLEAR_PATH
|
PATH=$CLEAR_PATH
|
||||||
|
@ -188,7 +189,7 @@ ynh_install_python () {
|
||||||
# Install the requested version of Python
|
# Install the requested version of Python
|
||||||
local final_python_version=$(pyenv latest --print $python_version)
|
local final_python_version=$(pyenv latest --print $python_version)
|
||||||
ynh_print_info --message="Installation of Python-$python_version"
|
ynh_print_info --message="Installation of Python-$python_version"
|
||||||
ynh_exec_warn_less pyenv install --skip-existing $final_python_version > /dev/null 2>&1
|
pyenv install --skip-existing $final_python_version > /dev/null 2>&1
|
||||||
|
|
||||||
# Store python_version into the config of this app
|
# Store python_version into the config of this app
|
||||||
ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=python_version --value=$python_version
|
ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=python_version --value=$python_version
|
||||||
|
@ -248,7 +249,7 @@ ynh_remove_python () {
|
||||||
# usage: ynh_cleanup_python
|
# usage: ynh_cleanup_python
|
||||||
ynh_cleanup_python () {
|
ynh_cleanup_python () {
|
||||||
|
|
||||||
# List required Python version
|
# List required Python versions
|
||||||
local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$')
|
local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$')
|
||||||
local required_python_versions=""
|
local required_python_versions=""
|
||||||
for installed_app in $installed_apps
|
for installed_app in $installed_apps
|
||||||
|
@ -260,7 +261,7 @@ ynh_cleanup_python () {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove no more needed Python version
|
# Remove no more needed Python versions
|
||||||
local installed_python_versions=$(pyenv versions --bare --skip-aliases | grep -Ev '/')
|
local installed_python_versions=$(pyenv versions --bare --skip-aliases | grep -Ev '/')
|
||||||
for installed_python_version in $installed_python_versions
|
for installed_python_version in $installed_python_versions
|
||||||
do
|
do
|
||||||
|
|
Loading…
Add table
Reference in a new issue