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

Correction restore

This commit is contained in:
Maniack Crudelis 2016-07-16 13:05:02 +02:00
parent ad4ce14bd2
commit 4df8a715fb
6 changed files with 112 additions and 97 deletions

View file

@ -1,6 +1,6 @@
## Test complet
;; Test complet
auto_remove=1
# Manifest
; Manifest
domain="domain.tld" (DOMAIN)
path="/leed" (PATH)
admin="john" (USER)
@ -8,7 +8,8 @@
language="fr"
market="Yes"
is_public="Yes" (PUBLIC|public=Yes|private=No)
# Checks
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
@ -22,5 +23,5 @@
incorrect_path=1
corrupt_source=0
fail_download_source=0
port_already_use=1
port_already_use=0
final_path_already_use=0

View file

@ -1,90 +1,93 @@
{
"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.6",
"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.7",
"url": "http://leed.idleman.fr/",
"licence": "free",
"maintainer": {
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
},
"multi_instance": "true",
"services": [
"nginx",
"php5-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"ask": {
"en": "Choose a domain for Leed",
"fr": "Choisissez un domaine pour Leed"
},
"example": "domain.org"
},
{
"name": "path",
"ask": {
"en": "Choose a path for Leed",
"fr": "Choisissez un chemin pour Leed"
},
"example": "/leed",
"default": "/leed"
},
{
"name": "admin",
"ask": {
"en": "Choose the Leed administrator (must be an existing YunoHost user)",
"fr": "Choisissez un administrateur Leed (doit être un utilisateur YunoHost)"
},
"example": "john"
},
{
"name": "password",
"type": "password",
"ask": {
"en": "Set the administrator password Leed",
"fr": "Définissez le mot de passe administrateur de Leed"
},
"example": "Choose a password"
},
{
"name": "language",
"ask": {
"en": "Choose your agregator's language",
"fr": "Choisissez la langue de votre agrégateur"
},
"choices" : ["en", "fr", "es"],
"default" : "en"
},
{
"name": "market",
"ask": {
"en": "Do you want to activate the Leed Market?",
"fr": "Voulez-vous activer le Leed Market ?"
},
"choices": ["Yes", "No"],
"default": "Yes"
},
{
"name": "is_public",
"ask": {
"en": "Is it a public website ?",
"fr": "Est-ce un site public ?"
},
"choices": ["Yes", "No"],
"default": "No"
}
]
}
"license": "free",
"maintainer": {
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
},
"multi_instance": true,
"services": [
"nginx",
"php5-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for Leed",
"fr": "Choisissez un domaine pour Leed"
},
"example": "domain.org"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Leed",
"fr": "Choisissez un chemin pour Leed"
},
"example": "/leed",
"default": "/leed"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose the Leed administrator (must be an existing YunoHost user)",
"fr": "Choisissez un administrateur Leed (doit être un utilisateur YunoHost)"
},
"example": "john"
},
{
"name": "password",
"type": "password",
"ask": {
"en": "Set the administrator password Leed",
"fr": "Définissez le mot de passe administrateur de Leed"
},
"example": "Choose a password"
},
{
"name": "language",
"ask": {
"en": "Choose your agregator's language",
"fr": "Choisissez la langue de votre agrégateur"
},
"choices" : ["en", "fr", "es"],
"default" : "en"
},
{
"name": "market",
"ask": {
"en": "Do you want to activate the Leed Market?",
"fr": "Voulez-vous activer le Leed Market ?"
},
"choices": ["Yes", "No"],
"default": "Yes"
},
{
"name": "is_public",
"ask": {
"en": "Is it a public website ?",
"fr": "Est-ce un site public ?"
},
"choices": ["Yes", "No"],
"default": "No"
}
]
}
}

View file

@ -1,5 +1,7 @@
#!/bin/bash
ynh_version="2.4"
YNH_VERSION () { # Renvoi le numéro de version de la moulinette Yunohost
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
}
@ -7,7 +9,7 @@ YNH_VERSION () { # Renvoi le numéro de version de la moulinette Yunohost
CHECK_VAR () { # Vérifie que la variable n'est pas vide.
# $1 = Variable à vérifier
# $2 = Texte à afficher en cas d'erreur
test -n "$1" || (echo "$2" && false >&2)
test -n "$1" || (echo "$2" >&2 && false)
}
EXIT_PROPERLY () { # Provoque l'arrêt du script en cas d'erreur. Et nettoye les résidus.
@ -20,7 +22,7 @@ EXIT_PROPERLY () { # Provoque l'arrêt du script en cas d'erreur. Et nettoye les
# Compense le bug de ssowat qui ne supprime pas l'entrée de l'app en cas d'erreur d'installation.
sudo sed -i "\@\"$domain$path/\":@d" /etc/ssowat/conf.json
if [ $ynh_version = "2.2" ]; then
if [ "$ynh_version" = "2.2" ]; then
/bin/bash $script_dir/remove # Appel le script remove. En 2.2, ce comportement n'est pas automatique.
fi
@ -40,7 +42,7 @@ TRAP_OFF () { # Ignoring signal capture until TRAP_ON
CHECK_USER () { # Vérifie la validité de l'user admin
# $1 = Variable de l'user admin.
sudo yunohost user list --json | grep -q "\"username\": \"$1\"" || (echo "Wrong admin" && false >&2)
sudo yunohost user list --json | grep -q "\"username\": \"$1\"" || (echo "Wrong admin" >&2 && false)
}
CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin.
@ -81,7 +83,7 @@ SETUP_SOURCE () { # Télécharge la source, décompresse et copie dans $final_pa
# $1 = Nom de l'archive téléchargée.
wget -nv --show-progress -i ../sources/source_url -O $1
# Vérifie la somme de contrôle de la source téléchargée.
md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" && false >&2)
md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false)
# Décompresse la source
if [ "$(echo ${1##*.})" == "gz" ]; then
tar -x -f $1

View file

@ -95,7 +95,7 @@ sudo yunohost app setting $app market -v "$market"
if [ "$market" = "Yes" ];
then
sudo rm -R $final_path/plugins
sudo git clone https://github.com/ldleman/Leed-market.git $final_path/plugins
sudo git clone https://github.com/ldleman/Leed-market.git "$final_path/plugins"
fi

View file

@ -1,5 +1,8 @@
#!/bin/bash
# Source app helpers
source /usr/share/yunohost/helpers
# Récupère les infos de l'application.
app=$YNH_APP_INSTANCE_NAME
if [ -z "$app" ]; then
@ -14,6 +17,12 @@ backup_dir=$1/apps/$app
# Restore sources & data
sudo cp -a $backup_dir/sources/. $final_path
# Créer la base de donnée et la restaure
db_pwd=$(sudo yunohost app setting $app mysqlpwd)
db_user=$app
ynh_mysql_create_db $db_user $db_user $db_pwd
mysql --debug-check -u $db_user -p$db_pwd $db_user < ${backup_dir}/db.sql
# Restore Nginx and YunoHost parameters
sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf

View file

@ -72,7 +72,7 @@ sed -i "s@__CODESYNC__@$code_sync@g" ../conf/cron_leed
sudo cp ../conf/cron_leed /etc/cron.d/$app
# Vide le cache de leed pour la mise à jour
sudo rm -r $final_path/cache/*
sudo rm -rf $final_path/cache/*
# Laisse un accès libre pour curl.
sudo yunohost app setting $app unprotected_uris -v "/"
# Régénère la configuration de SSOwat