1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/leed_ynh.git synced 2024-09-03 19:26:32 +02:00

Merge pull request #8 from YunoHost-Apps/testing

Upgrade package and update 1.8.3
This commit is contained in:
Maniack Crudelis 2017-12-22 19:35:59 +01:00 committed by GitHub
commit 7d83235fdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 988 additions and 792 deletions

View file

@ -1,17 +1,62 @@
Leed for YunoHost
==================
# Leed for YunoHost
[Yunohost project](https://yunohost.org/#/)
[![Integration level](https://dash.yunohost.org/integration/leed.svg)](https://ci-apps.yunohost.org/jenkins/job/leed%20%28Community%29/lastBuild/consoleFull)
[![Install Leed with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=leed)
Leed est un agrégateur de flux RSS/ATOM dit KISS : minimaliste, simple, léger et rapide.
*[Lire ce readme en français.](./README_fr.md)*
http://leed.idleman.fr/
> *This package allow you to install leed 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.*
**Mise à jour du package:**
sudo yunohost app upgrade --verbose leed -u https://github.com/YunoHost-Apps/leed_ynh
## Overview
Leed (short for Light Feed) is a minimalist RSS/ATOM aggregator which offers fast RSS consultation and non-intrusive features.
**Multi-utilisateur:** Non, une instance par utilisateur.
**Shipped version:** 1.8.3
**Voir l'état du package:**
*[Dernier rapport hebdomadaire](https://forum.yunohost.org/t/rapport-hebdomadaire-dintegration-continue/2297)*
*[Dernier test d'intégration continue](https://ci-apps.yunohost.org/jenkins/job/leed%20%28Community%29/lastBuild/consoleFull)*
## Screenshots
![](http://projet.idleman.fr/leed/data/leed1.jpg)
## Configuration
Use the admin panel of your Leed to configure this app.
## Documentation
* YunoHost documentation: There no other documentations, feel free to contribute.
## YunoHost specific features
* Login secured by fail2ban
#### Multi-users support
Not supported.
#### Supported architectures
* Tested on x86_64
## Limitations
## Additionnal informations
## Links
* Report a bug: https://github.com/YunoHost-Apps/leed_ynh/issues
* Leed website: http://leed.idleman.fr/
* YunoHost website: https://yunohost.org/
---
Developers infos
----------------
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/leed_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/leed_ynh/tree/testing --verbose
or
sudo yunohost app upgrade leed -u https://github.com/YunoHost-Apps/leed_ynh/tree/testing --verbose
```

62
README_fr.md Normal file
View file

@ -0,0 +1,62 @@
# Leed pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/leed.svg)](https://ci-apps.yunohost.org/jenkins/job/leed%20%28Community%29/lastBuild/consoleFull)
[![Installer Leed avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=leed)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer leed rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/install_fr) pour savoir comment l'installer et en profiter.*
## Résumé
Leed (contraction de Light Feed) est un agrégateur RSS/ATOM minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive.
**Version embarquée:** 1.8.3
## Captures d'écran
![](http://projet.idleman.fr/leed/data/leed1.jpg)
## Configuration
Utiliser le panneau d'administration de votre Jenkins pour configurer cette application.
## Documentation
* Documentation YunoHost: Il n'y a pas d'autre documentation, n'hésitez pas à contribuer.
## Fonctionnalités spécifiques à YunoHost
* Login sécurisé par fail2ban
#### Support multi-utilisateurs
Non supportée.
#### Architectures supportées.
* Testé sur x86_64
## Limitations
## Informations additionnelles
## Liens
* Reporter un bug: https://github.com/YunoHost-Apps/leed_ynh/issues
* Site de Leed: http://leed.idleman.fr/
* Site de YunoHost: https://yunohost.org/
---
Informations à l'intention des développeurs
----------------
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/leed_ynh/tree/testing).
Pour tester la branche testing, merci de procéder ainsi.
```
sudo yunohost app install https://github.com/YunoHost-Apps/leed_ynh/tree/testing --verbose
ou
sudo yunohost app upgrade leed -u https://github.com/YunoHost-Apps/leed_ynh/tree/testing --verbose
```

117
YEP.md Normal file
View file

@ -0,0 +1,117 @@
#### [Level 0](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-0)
[YEP 1.1 - Nommer son app et son dépot](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
`Validated`
[YEP 1.2 - Inscrire l'app sur un "répertoire" connu](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-12)
`Validated`
#### [Level 1](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-1)
[YEP 2.2 - Utiliser bash pour les scripts principaux](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-22)
`Validated`
[YEP 2.5 - Copier correctement des fichiers](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-25)
`Don't know`
[YEP 2.7 - Donner des permissions suffisantes aux instructions bash](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-27)
`Validated`
[YEP 2.15 - Suivre les instructions d'installation de l'application](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-215)
`Validated`
#### [Level 2](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-2)
[YEP 1.5 - Mettre à jour régulièrement le statut de l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
`Validated`
[YEP 2.18.2 - Gérer l'installation à la racine dun nom de domaine](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2182)
`Validated` - *Automatically verified.*
[YEP 2.18.3 - Gérer l'installation sur un sous-domaine](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2183)
`Validated` - *Automatically verified.*
[YEP 2.18.4 - Gérer l'installation sur un chemin /path](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2184)
`Validated` - *Automatically verified.*
[YEP 4.6 - Gère le multi-instance](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
`Validated` - *Automatically verified.*
#### [Level 3](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-3)
[YEP 2.3 - Sauvegarder les réponses lors de l'installation](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-23)
`Validated`
#### [Level 4](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-4)
[YEP 4.1 - Lier au ldap](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-41)
`Validated`
[YEP 4.2 - Lier l'authentification au sso](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-42)
`Validated`
#### [Level 5](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-5)
[YEP 1.3 - Indiquer la licence associée au paquet](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-13)
`Validated`
[YEP 2.1 - Respecter le format du manifeste](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-21)
`Validated` - *Automatically verified.*
[YEP 2.12 - Utiliser les commandes pratiques (helpers)](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-212)
`Validated`
[YEP 2.18.1 - Lancer le script d'installation d'une webapp correctement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2181)
`Validated`
#### [Level 6](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-6)
[YEP 1.4 - Informer sur l'intention de maintenir un paquet](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-14)
`Validated`
[YEP 1.6 - Se tenir informé sur l'évolution du packaging d'apps](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-16)
`Validated`
[YEP 1.7 - Ajouter l'app à l'organisation YunoHost-Apps](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-17)
`Validated` - *Automatically verified.*
[YEP 1.8 - Publier des demandes de test](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-18)
`Validated`
[YEP 1.9 - Documenter l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-19)
`Validated`
[YEP 1.10 - Garder un historique de version propre](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-110)
`Don't know`
[YEP 2.9 - Enlever toutes traces de l'app lors de la suppression](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-29)
`Validated`
[YEP 3.3 - Faciliter le contrôle de l'intégrité des sources](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-33)
`Validated`
[YEP 3.5 - Suivre les recommendations de la documentation de l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-35)
`Validated`
[YEP 3.6 - Mettre à jour les versions contenant des CVE](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-36)
`Validated`
[YEP 4.3 - Fournir un script de sauvegarde YunoHost fonctionnel](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-43)
`Validated` - *Automatically verified.*
[YEP 4.4 - Fournir un script de restauration YunoHost fonctionnel](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-44)
`Validated` - *Automatically verified.*
#### [Level 7](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-7)
[YEP 2.6 - Annuler l'action si les valeurs d'entrées sont incorrectes](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-26)
`Validated`
[YEP 3.2 - Ouvrir un port correctement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-32)
`Not applicable`
#### [Level 8](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-8)
[YEP 2.4 - Détecter et gérer les erreurs](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-24)
`Validated`
[YEP 2.8 - Modifier correctement une configuration système](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-28)
`Validated`
[YEP 2.16 - Vérifier la disponibilité des dépendances sur ARM, x86 et x64](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-216)
`Not yet validated` - *Automatically verified.*
[YEP 2.18.5 - Gérer la tuile YunoHost pour faciliter la navigation entre les applications](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2185)
`Validated`
[YEP 3.4 - Isoler l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-34)
`Partially validated`
[YEP 4.5 - Utiliser les hooks](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-45)
`Not applicable`
#### [Level 9](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-9)
[YEP 2.10 - Configurer les logs de l'application](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-210)
`Not applicable`
[YEP 2.11 - Utiliser une variable plutôt que l'app id directement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-211)
`Validated`
[YEP 2.13 - Traduire le paquet en anglais](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-213)
`Not yet validated`
[YEP 2.14 - Remplir correctement un fichier de conf](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-214)
`Not yet validated`
[YEP 2.17 - Prendre en compte la version d'origine lors des mises à jour](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-217)
`Validated`
[YEP 4.2.1 - Déconnexion](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-421)
`Don't know`
#### Other YEP
[YEP 3.1 - Ne pas demander ou stocker de mot de passe LDAP](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-31)
`Validated`
[YEP 4.7 - Ajouter un module à la CLI](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-47)
`Not applicable`
[YEP 4.8 - Ajouter un module à l'admin web](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-48)
`Not applicable`
State of each YEP can be one of these: `Validated`, `Partially validated`, `Not yet validated`, `Not applicable`, `Don't know`.

View file

@ -1,10 +1,9 @@
;; Test complet
auto_remove=1
; Manifest
domain="domain.tld" (DOMAIN)
path="/leed" (PATH)
admin="john" (USER)
password="pass" (PASSWORD)
password="pass"
language="fr"
market=1
is_public=1 (PUBLIC|public=1|private=0)
@ -16,19 +15,19 @@
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=9e9bc2309ae0460adba186b7f8ace4dbf44de087
backup_restore=1
multi_instance=1
incorrect_path=1
port_already_use=0
change_url=0
change_url=1
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4: https://github.com/LeedRSS/Leed/commit/841719a25e3753b0c50275bed62c29a55aa21bb9
Level 4=1
# Level 5: https://github.com/YunoHost-Apps/leed_ynh/issues/6
Level 5=1
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
@ -37,3 +36,7 @@
;;; Options
Email=
Notification=down
;;; Upgrade options
; commit=9e9bc2309ae0460adba186b7f8ace4dbf44de087
name=01 Mar 2017 9e9bc2309ae0460adba186b7f8ace4dbf44de087
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&language=fr&market=1&is_public=1&

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/LeedRSS/Leed/archive/v1.8.2.tar.gz
SOURCE_SUM=e0558125f8c76d399beb0cfc6d168b04
SOURCE_URL=https://github.com/LeedRSS/Leed/archive/v1.8.3.tar.gz
SOURCE_SUM=4fb46124695dfc8e6a3bfa5e48850547
SOURCE_SUM_PRG=md5sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -2,20 +2,20 @@
"name": "Leed",
"id": "leed",
"packaging_format": 1,
"requirements": {
"yunohost": ">= 2.4"
},
"description": {
"en": "Leed is a minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds.",
"fr": "Leed est un agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive."
},
"version": "1.8.2",
"version": "1.8.3~ynh1",
"url": "http://leed.idleman.fr/",
"license": "AGPL-3.0",
"maintainer": {
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
},
"requirements": {
"yunohost": ">= 2.7.2"
},
"multi_instance": true,
"services": [
"nginx",

File diff suppressed because it is too large Load diff

51
scripts/_sed Normal file
View file

@ -0,0 +1,51 @@
#!/bin/bash
# https://github.com/YunoHost/yunohost/pull/394
# Substitute/replace a string (or expression) by another in a file
#
# usage: ynh_replace_string match_string replace_string target_file
# | arg: match_string - String to be searched and replaced in the file
# | arg: replace_string - String that will replace matches
# | arg: target_file - File in which the string will be replaced.
#
# As this helper is based on sed command, regular expressions and
# references to sub-expressions can be used
# (see sed manual page for more information)
ynh_replace_string () {
local delimit=@
local match_string=$1
local replace_string=$2
local workfile=$3
# Escape the delimiter if it's in the string.
match_string=${match_string//${delimit}/"\\${delimit}"}
replace_string=${replace_string//${delimit}/"\\${delimit}"}
sudo sed --in-place "s${delimit}${match_string}${delimit}${replace_string}${delimit}g" "$workfile"
}
# Substitute/replace a password by another in a file
#
# usage: ynh_replace_password_string match_string replace_string target_file
# | arg: match_string - String to be searched and replaced in the file
# | arg: replace_string - String that will replace matches
# | arg: target_file - File in which the string will be replaced.
#
# This helper will use ynh_replace_string, but as you can use special
# characters, you can't use some regular expressions and sub-expressions.
ynh_replace_password_string () {
local match_string=$1
local replace_string=$2
local workfile=$3
# Escape any backslash to preserve them as simple backslash.
match_string=${match_string//\\/"\\\\"}
replace_string=${replace_string//\\/"\\\\"}
# Escape the & character, who has a special function in sed.
match_string=${match_string//&/"\&"}
replace_string=${replace_string//&/"\&"}
ynh_replace_string "$match_string" "$replace_string" "$workfile"
}

View file

@ -1,26 +1,26 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit on command errors and treat unset variables as an error
set -eu
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Rapatrie le fichier de fonctions si il n'est pas dans le dossier courant
sudo cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
@ -39,20 +39,20 @@ db_pwd=$(ynh_app_setting_get "$app" mysqlpwd)
#=================================================
CHECK_SIZE "$final_path"
ynh_backup "$final_path" "${YNH_APP_BACKUP_DIR}$final_path"
ynh_backup "$final_path"
#=================================================
# BACKUP OF THE NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP OF THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup "/etc/php5/fpm/pool.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/php5/fpm/pool.d/$app.conf"
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" "${YNH_APP_BACKUP_DIR}/etc/php5/fpm/conf.d/20-$app.ini"
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
#=================================================
# BACKUP OF THE SQL BDD
@ -60,7 +60,13 @@ ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" "${YNH_APP_BACKUP_DIR}/etc/php5/fp
ynh_mysql_dump_db "$db_name" > db.sql
CHECK_SIZE "db.sql"
# ynh_backup "db.sql" "${YNH_APP_BACKUP_DIR}/db.sql"
#=================================================
# BACKUP FAIL2BAN CONFIGURATION
#=================================================
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
@ -68,4 +74,4 @@ CHECK_SIZE "db.sql"
# BACKUP OF THE CRON FILE
#=================================================
ynh_backup "/etc/cron.d/$app" "${YNH_APP_BACKUP_DIR}/etc/cron.d/$app"
ynh_backup "/etc/cron.d/$app"

118
scripts/change_url Normal file
View file

@ -0,0 +1,118 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
source _sed
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK THE SYNTAX OF THE PATHS
#=================================================
test -n "$old_path" || old_path="/"
test -n "$new_path" || new_path="/"
new_path=$(ynh_normalize_url_path $new_path)
old_path=$(ynh_normalize_url_path $old_path)
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different "$nginx_conf_path"
# Replace locations starting with old_path
# Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location)
ynh_replace_string "location\( \(=\|~\|~\*\|\^~\)\)\? $old_path" "location\1 $new_path" "$nginx_conf_path"
# Calculate and store the nginx config file checksum
ynh_store_file_checksum "$nginx_conf_path"
fi
# Change the domain for nginx
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum "$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf
# Calculate and store the nginx config file checksum
ynh_store_file_checksum "$nginx_conf_path"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# UPDATE THE CRON FILE
#=================================================
if [ "$new_path" == "/" ]
then
domain_path="$new_domain"
else
domain_path="$new_domain$new_path"
fi
ynh_replace_string "https://$old_domain${old_path}" "https://$domain_path" "/etc/cron.d/$app"
#=================================================
# UPDATE THE DATABASE
#=================================================
ynh_mysql_execute_as_root "UPDATE leed_configuration SET value='$domain_path/' WHERE value LIKE '%${old_domain}%'" $app
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx

View file

@ -22,7 +22,7 @@ ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est dét
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
user_pwd=$YNH_APP_ARG_PASSWORD
ynh_print_OFF; user_pwd=$YNH_APP_ARG_PASSWORD; ynh_print_ON
language=$YNH_APP_ARG_LANGUAGE
is_public=$YNH_APP_ARG_IS_PUBLIC
@ -32,9 +32,16 @@ app=$YNH_APP_INSTANCE_NAME
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#=================================================
path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path.
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine.
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
@ -65,7 +72,7 @@ ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie d
# NGINX CONFIGURATION
#=================================================
ynh_nginx_config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
@ -77,7 +84,7 @@ ynh_system_user_create $app # Créer un utilisateur système dédié à l'app
# PHP-FPM CONFIGURATION
#=================================================
ynh_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
#=================================================
# SPECIFIC SETUP
@ -86,17 +93,19 @@ ynh_fpm_config # Créer le fichier de configuration du pool php-fpm et le config
#=================================================
# Set right permissions for curl install
sudo chown -R $app: $final_path
chown -R $app: $final_path
# Rend la page d'install publique pour curl
ynh_app_setting_set $app unprotected_uris "/" #L'usage de unprotected_uris a la place de skipped_uris permet de passer le header d'auth http
sudo yunohost app ssowatconf
yunohost app ssowatconf
# Reload Nginx
sudo systemctl reload nginx
systemctl reload nginx
# Leed installation via curl
ynh_print_OFF
ynh_local_curl "/install.php?installButton" "install_changeLngLeed=$language" "root=$domain$path_url" "mysqlHost=localhost" "mysqlLogin=$db_name" "mysqlMdp=$db_pwd" "mysqlBase=$db_name" "mysqlPrefix=leed_" "login=$admin" "password=$user_pwd"
ynh_print_ON
#=================================================
# RETRIEVE SYNCHRONISATION CODE
@ -112,7 +121,7 @@ ynh_replace_string "__ADMIN__" "$admin" ../conf/cron_leed
ynh_replace_string "__DOMAIN__" "$domain" ../conf/cron_leed
ynh_replace_string "__PATH__" "$path_url" ../conf/cron_leed
ynh_replace_string "__CODESYNC__" "$code_sync" ../conf/cron_leed
sudo cp ../conf/cron_leed /etc/cron.d/$app
cp ../conf/cron_leed /etc/cron.d/$app
#=================================================
# GENERIC FINALISATION
@ -121,10 +130,16 @@ sudo cp ../conf/cron_leed /etc/cron.d/$app
#=================================================
# Les fichiers appartiennent à root
sudo chown -R root: $final_path
chown -R root: $final_path
# $app doit avoir les droits d'écriture dans plugins, cache et updates
sudo mkdir $final_path/cache
sudo chown -R $app $final_path/cache $final_path/plugins $final_path/updates
mkdir $final_path/cache
chown -R $app $final_path/cache $final_path/plugins $final_path/updates
#=================================================
# SETUP FAIL2BAN
#=================================================
ynh_add_fail2ban_config "/var/log/nginx/${domain}-error.log" "PHP message: Leed: wrong login for .* client: <HOST>" 5
#=================================================
# SETUP SSOWAT
@ -144,4 +159,16 @@ fi
# RELOAD NGINX
#=================================================
sudo systemctl reload nginx
systemctl reload nginx
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
ynh_print_OFF
message="Please take note of your password for this application: '$user_pwd'.
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/leed_ynh"
ynh_send_readme_to_admin "$message" "$admin"
ynh_print_ON

View file

@ -44,6 +44,12 @@ ynh_remove_nginx_config # Suppression de la configuration nginx
ynh_remove_fpm_config # Suppression de la configuration du pool php-fpm
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================
ynh_remove_fail2ban_config
#=================================================
# SPECIFIC REMOVE
#=================================================

View file

@ -1,26 +1,26 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit on command errors and treat unset variables as an error
set -eu
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Rapatrie le fichier de fonctions si il n'est pas dans le dossier courant
sudo cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
@ -31,12 +31,13 @@ domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name)
admin=$(ynh_app_setting_get $app admin)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
@ -76,6 +77,14 @@ ynh_system_user_create $app # Recreate the dedicated user, if not exist
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
#=================================================
# RESTORE FAIL2BAN CONFIGURATION
#=================================================
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
systemctl restart fail2ban
#=================================================
# SPECIFIC RESTORE
#=================================================
@ -88,7 +97,7 @@ ynh_restore_file "/etc/cron.d/$app"
# RESTORE USER RIGHTS
#=================================================
sudo chown -R $app $final_path/cache $final_path/plugins $final_path/updates
chown -R $app $final_path/cache $final_path/plugins $final_path/updates
#=================================================
# GENERIC FINALISATION
@ -96,5 +105,13 @@ sudo chown -R $app $final_path/cache $final_path/plugins $final_path/updates
# RELOAD NGINX AND PHP-FPM
#=================================================
sudo systemctl reload php5-fpm
sudo systemctl reload nginx
systemctl reload php5-fpm
systemctl reload nginx
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/leed_ynh"
ynh_send_readme_to_admin "$message" "$admin"

View file

@ -23,6 +23,12 @@ final_path=$(ynh_app_setting_get $app final_path)
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# CHECK VERSION
#=================================================
ynh_abort_if_up_to_date
#=================================================
# FIX OLD THINGS
#=================================================
@ -59,11 +65,14 @@ fi
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
BACKUP_BEFORE_UPGRADE # Backup the current version of the app
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
BACKUP_FAIL_UPGRADE # restore it if the upgrade fails
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK THE PATH
@ -83,7 +92,7 @@ ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie d
# NGINX CONFIGURATION
#=================================================
ynh_nginx_config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
@ -95,7 +104,7 @@ ynh_system_user_create $app # Create the dedicated user, if not exist
# PHP-FPM CONFIGURATION
#=================================================
ynh_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure.
#=================================================
# SPECIFIC UPGRADE
@ -113,17 +122,17 @@ ynh_replace_string "__ADMIN__" "$admin" ../conf/cron_leed
ynh_replace_string "__DOMAIN__" "$domain" ../conf/cron_leed
ynh_replace_string "__PATH__" "$path_url" ../conf/cron_leed
ynh_replace_string "__CODESYNC__" "$code_sync" ../conf/cron_leed
sudo cp ../conf/cron_leed /etc/cron.d/$app
cp ../conf/cron_leed /etc/cron.d/$app
#=================================================
# SECURING FILES AND DIRECTORIES
#=================================================
# Les fichiers appartiennent à root
sudo chown -R root: $final_path
chown -R root: $final_path
# www-data doit avoir les droits d'écriture dans plugins, cache et updates
sudo mkdir -p $final_path/cache
sudo chown -R $app $final_path/cache $final_path/plugins $final_path/updates
mkdir -p $final_path/cache
chown -R $app $final_path/cache $final_path/plugins $final_path/updates
#=================================================
# UPGRADE WITH CURL
@ -134,13 +143,18 @@ ynh_secure_remove $final_path/cache/*
# Laisse un accès libre pour curl.
ynh_app_setting_set $app unprotected_uris "/"
# Régénère la configuration de SSOwat
sudo yunohost app ssowatconf
yunohost app ssowatconf
# Lance la procédure de mise à jour de leed.
# curl -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 "https://localhost$path_url"
ynh_local_curl "/"
#=================================================
# GENERIC FINALISATION
#=================================================
# UPGRADE FAIL2BAN
#=================================================
ynh_add_fail2ban_config "/var/log/nginx/${domain}-error.log" "PHP message: Leed: wrong login for .* client: <HOST>" 5
#=================================================
# SETUP SSOWAT
#=================================================
@ -158,4 +172,4 @@ fi
# RELOAD NGINX
#=================================================
sudo systemctl reload nginx
systemctl reload nginx