1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/svgedit_ynh.git synced 2024-09-03 20:26:24 +02:00
- Repackage
This commit is contained in:
Éric Gaspar 2020-10-08 21:05:06 +02:00 committed by GitHub
parent 790a6daae7
commit 4303aa4191
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 607 additions and 392 deletions

View file

@ -1,9 +1,11 @@
# SVG Edit app for YunoHost # SVG-edit for YunoHost
[![Integration level](https://dash.yunohost.org/integration/svgedit.svg)](https://dash.yunohost.org/appci/app/svgedit) ![](https://ci-apps.yunohost.org/ci/badges/svgedit.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/svgedit.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/svgedit.svg)](https://dash.yunohost.org/appci/app/svgedit) ![](https://ci-apps.yunohost.org/ci/badges/svgedit.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/svgedit.maintain.svg)
[![Install SVG Edit with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=svgedit) [![Install SVG-edit with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=svgedit)
> *This package allow you to install SVG Edit quickly and simply on a YunoHost server. *[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install SVG-edit 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.* If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
## Overview ## Overview
@ -11,17 +13,20 @@ SVG-edit is a fast, web-based, javascript-driven SVG drawing editor that works i
**Shipped version:** 2.8.1 **Shipped version:** 2.8.1
**Categories:** Productivity, Drawing
## Screenshots ## Screenshots
![alt text](https://svg-edit.github.io/svgedit/images/logo48x48.svg "svg-edit logo of a pencil") SVG-edit
![](https://raw.githubusercontent.com/SVG-Edit/svgedit/master/docs/screenshot.png)
## Demo
* [Official demo](https://svg-edit.github.io/svgedit/dist/editor/index.html)
## Configuration ## Configuration
## Documentation ## Documentation
* YunoHost documentation: There no other documentations, feel free to contribute. * Official documentation: Link to the official documentation of this app
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
## YunoHost specific features ## YunoHost specific features
@ -31,12 +36,12 @@ Not supported.
#### Supported architectures #### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/leed%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/svgedit%20(Community)/) * x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/svgedit%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/svgedit/)
* ARMv8-A - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/leed%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/svgedit%20(Community)%20(%7EARM%7E)/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/svgedit%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/svgedit/)
## Limitations ## Limitations
* There is no account management in SVG Edit, but the SSO can protect the access to the app to disallow user without yunohost account. There is no account management in SVG-edit, but the SSO can protect the access to the app to disallow user without YunoHost account.
## Additionnal informations ## Additionnal informations
@ -48,10 +53,7 @@ Not supported.
--- ---
Developers infos ## Developers infos
----------------
**Package by:** Luc Didry
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/svgedit_ynh/tree/testing). Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/svgedit_ynh/tree/testing).

65
README_fr.md Normal file
View file

@ -0,0 +1,65 @@
# SVG-edit pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/svgedit.svg)](https://dash.yunohost.org/appci/app/svgedit) ![](https://ci-apps.yunohost.org/ci/badges/svgedit.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/svgedit.maintain.svg)
[![Installer SVG-edit avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=svgedit)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer SVG-edit rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
## Vue d'ensemble
SVG-edit est un éditeur de dessin SVG rapide, basé sur le Web et piloté par JavaScript, qui fonctionne dans n'importe quel navigateur moderne.
**Version incluse :** 2.8.1
## Captures d'écran
![](https://raw.githubusercontent.com/SVG-Edit/svgedit/master/docs/screenshot.png)
## Démo
* [Démo officielle](https://svg-edit.github.io/svgedit/dist/editor/index.html)
## Configuration
## Documentation
* Documentation officielle : Lien vers la documentation officielle de cette application.
* Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateur
Non supporté.
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/svgedit%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/svgedit/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/svgedit%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/svgedit/)
## Limitations
Il n'y a pas de gestion de compte dans SVG-edit, mais le SSO peut protéger l'accès à l'application pour interdire l'utilisateur sans compte YunoHost.
## Informations additionnelles
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/svgedit_ynh/issues
* Dépôt de l'application principale : https://github.com/SVG-Edit/svgedit
* Site web YunoHost : https://yunohost.org/
---
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/svgedit_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/svgedit_ynh/tree/testing --verbose
or
sudo yunohost app upgrade leed -u https://github.com/YunoHost-Apps/svgedit_ynh/tree/testing --verbose
```

117
YEP.md
View file

@ -1,117 +0,0 @@
#### [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)
`Not applicable`
[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)
`Not yet 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)
`Not yet 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)
`Validated`
[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)
`Not 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)
`Validated`
[YEP 2.14 - Remplir correctement un fichier de conf](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-214)
`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)
`Not applicable`
#### 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,8 +1,8 @@
;; Test complet ;; Test complet
auto_remove=1
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
path="/path" (PATH) path="/path" (PATH)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0) is_public=1 (PUBLIC|public=1|private=0)
; Checks ; Checks
pkg_linter=1 pkg_linter=1
@ -12,30 +12,19 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=6f3a05b03d60142ad19ee8815f7b5d68adc888a4
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
wrong_user=1 # incorrect_path=1
wrong_path=1
incorrect_path=1
corrupt_source=1
fail_download_source=1
port_already_use=0 port_already_use=0
final_path_already_use=1 change_url=1
change_url=0
;;; Levels ;;; Levels
Level 1=auto # If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 2=auto
Level 3=auto
# SVG edit as no account management, but ssowat is configured (is_public feature)
Level 4=na
Level 5=auto Level 5=auto
Level 6=auto ;;; Options
Level 7=auto Email=
Level 8=0 Notification=none
Level 9=0
Level 10=0
;;; Upgrade options ;;; Upgrade options
; commit=6f3a05b03d60142ad19ee8815f7b5d68adc888a4 ; commit=CommitHash
name=2.8.1 6f3a05b03d60142ad19ee8815f7b5d68adc888a4 name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&is_public=1& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&

16
conf/nginx.conf Normal file
View file

@ -0,0 +1,16 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Path to source
alias __FINALPATH__/ ;
index svg-editor.html ;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -1,17 +0,0 @@
{% if path_url != "/" %}
rewrite ^{{ path_url }}$ {{ path_url }}/ permanent;
{% else %}
{% set path_url = "" %}
{% endif %}
location {{ path_url }}/ {
alias {{ final_path }}/;
index svg-editor.html;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -3,11 +3,11 @@
"id": "svgedit", "id": "svgedit",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "A fast, web-based, javascript-driven SVG drawing editor that works in any modern browser.", "en": "Web-based SVG drawing editor working on any modern browser.",
"fr": "Un outil de manipulation de SVG en ligne, rapide, et écrit en javascript qui fonctionne avec tout navigateur moderne." "fr": "Édition de SVG en ligne fonctionnent avec tout navigateur moderne."
}, },
"url": "https://github.com/SVG-Edit/svgedit", "url": "https://github.com/SVG-Edit/svgedit",
"version": "2.8.1-1", "version": "2.8.1~ynh2",
"license": "MIT", "license": "MIT",
"maintainer": { "maintainer": {
"name": "ljf", "name": "ljf",
@ -18,7 +18,7 @@
"name": "Luc Didry" "name": "Luc Didry"
}, },
"requirements": { "requirements": {
"yunohost": ">> 2.4.0" "yunohost": ">> 3.8.1"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

View file

@ -3,13 +3,19 @@
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app
pkg_dependencies="wget"
# App package root directory should be the parent folder # App package root directory should be the parent folder
PKG_DIR=$(cd ../; pwd) PKG_DIR=$(cd ../; pwd)
pkg_dependencies="wget" #=================================================
# PERSONAL HELPERS
#=================================================
#================================================= #=================================================
# COMMON HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
ynh_set_default_perm () { ynh_set_default_perm () {
local DIRECTORY=$1 local DIRECTORY=$1
@ -19,7 +25,7 @@ ynh_set_default_perm () {
chown -R $user:www-data $DIRECTORY chown -R $user:www-data $DIRECTORY
chmod -R 440 $DIRECTORY chmod -R 440 $DIRECTORY
find $DIRECTORY -type d -print0 | xargs -0 chmod 550 \ find $DIRECTORY -type d -print0 | xargs -0 chmod 550 \
|| echo "No file to modify" || echo "No file to modify"
} }
ynh_export () { ynh_export () {
@ -113,80 +119,18 @@ ynh_read_json () {
sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])" sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])"
} }
ynh_read_manifest () {
if [ -f '../manifest.json' ] ; then
ynh_read_json '../manifest.json' "$1"
else
ynh_read_json '../settings/manifest.json' "$1"
fi
}
ynh_configure () { ynh_configure () {
local TEMPLATE=$1 local TEMPLATE=$1
local DEST=$2 local DEST=$2
type j2 2>/dev/null || sudo pip install j2cli type j2 2>/dev/null || sudo pip install j2cli
j2 "${PKG_DIR}/conf/$TEMPLATE.j2" > "${PKG_DIR}/conf/$TEMPLATE" j2 "${PKG_DIR}/conf/$TEMPLATE.j2" > "${PKG_DIR}/conf/$TEMPLATE"
ynh_backup_if_checksum_is_different "$DEST" ynh_backup_if_checksum_is_different "$DEST"
sudo cp "${PKG_DIR}/conf/$TEMPLATE" "$DEST" sudo cp "${PKG_DIR}/conf/$TEMPLATE" "$DEST"
ynh_store_file_checksum "$DEST" ynh_store_file_checksum "$DEST"
sudo chown root: "$DEST" sudo chown root: "$DEST"
} }
ynh_add_nginx_config () {
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_configure nginx.conf "$finalnginxconf"
service nginx reload
}
# Send an email to inform the administrator
#
# usage: ynh_send_readme_to_admin app_message [recipients]
# | arg: app_message - The message to send to the administrator.
# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root
# example: "root admin@domain"
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
# example: "root admin@domain user1 user2"
ynh_send_readme_to_admin() {
local app_message="${1:-...No specific information...}"
local recipients="${2:-root}"
# Retrieve the email of users
find_mails () {
local list_mails="$1"
local mail
local recipients=" "
# Read each mail in argument
for mail in $list_mails
do
# Keep root or a real email address as it is
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
then
recipients="$recipients $mail"
else
# But replace an user name without a domain after by its email
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
then
recipients="$recipients $mail"
fi
fi
done
echo "$recipients"
}
recipients=$(find_mails "$recipients")
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
local mail_message="This is an automated message from your beloved YunoHost server.
Specific information for the application $app.
$app_message
---
Automatic diagnosis data from YunoHost
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
# Send the email to the recipients
echo "$mail_message" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
}
# Exit without error if the package is up to date # Exit without error if the package is up to date
# #
@ -199,42 +143,27 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
# #
# usage: ynh_abort_if_up_to_date # usage: ynh_abort_if_up_to_date
ynh_abort_if_up_to_date () { ynh_abort_if_up_to_date () {
local force_upgrade=${YNH_FORCE_UPGRADE:-0} local force_upgrade=${YNH_FORCE_UPGRADE:-0}
local package_check=${PACKAGE_CHECK_EXEC:-0} local package_check=${PACKAGE_CHECK_EXEC:-0}
local version=$(ynh_read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0) local version=$(ynh_read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" "version" || echo 1.0)
local last_version=$(ynh_read_manifest "version" || echo 1.0) local last_version=$(ynh_read_manifest "version" || echo 1.0)
if [ "$version" = "$last_version" ] if [ "$version" = "$last_version" ]
then then
if [ "$force_upgrade" != "0" ] if [ "$force_upgrade" != "0" ]
then then
echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2 echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
unset YNH_FORCE_UPGRADE unset YNH_FORCE_UPGRADE
elif [ "$package_check" != "0" ] elif [ "$package_check" != "0" ]
then then
echo "Upgrade forced for package check." >&2 echo "Upgrade forced for package check." >&2
else else
ynh_die "Up-to-date, nothing to do" 0 ynh_die "Up-to-date, nothing to do" 0
fi fi
fi fi
} }
# Remove any logs for all the following commands.
#
# usage: ynh_print_OFF
# WARNING: You should be careful with this helper, and never forgot to use ynh_print_ON as soon as possible to restore the logging.
ynh_print_OFF () {
set +x
}
# Restore the logging after ynh_print_OFF
#
# usage: ynh_print_ON
ynh_print_ON () {
set -x
# Print an echo only for the log, to be able to know that ynh_print_ON has been called.
echo ynh_print_ON > /dev/null
}
ynh_version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } ynh_version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
# In upgrade script allow to test if the app is less than or equal a specific version # In upgrade script allow to test if the app is less than or equal a specific version
@ -246,25 +175,25 @@ ynh_version_le() {
} }
ynh_debian_release () { ynh_debian_release () {
lsb_release --codename --short lsb_release --codename --short
} }
is_stretch () { is_stretch () {
if [ "$(ynh_debian_release)" == "stretch" ] if [ "$(ynh_debian_release)" == "stretch" ]
then then
return 0 return 0
else else
return 1 return 1
fi fi
} }
is_jessie () { is_jessie () {
if [ "$(ynh_debian_release)" == "jessie" ] if [ "$(ynh_debian_release)" == "jessie" ]
then then
return 0 return 0
else else
return 1 return 1
fi fi
} }
# Reload (or other actions) a service and print a log in case of failure. # Reload (or other actions) a service and print a log in case of failure.
@ -279,3 +208,7 @@ ynh_system_reload () {
# Reload, restart or start and print the log if the service fail to start or reload # Reload, restart or start and print the log if the service fail to start or reload
systemctl $action $service_name || ( journalctl --lines=20 -u $service_name >&2 && false) systemctl $action $service_name || ( journalctl --lines=20 -u $service_name >&2 && false)
} }
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -1,17 +1,54 @@
#!/bin/bash #!/bin/bash
# See comments in install script #=================================================
app=$YNH_APP_INSTANCE_NAME # GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source YunoHost helpers #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
# Backup sources & data #=================================================
# Note: the last argument is where to save this path, see the restore script. # LOAD SETTINGS
ynh_backup "/var/www/${app}" #=================================================
ynh_print_info --message="Loading installation settings..."
# Copy NGINX configuration app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get "$app" domain)
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for SVG-edit. (YunoHost will then actually copy those files to the archive)."

105
scripts/change_url Normal file
View file

@ -0,0 +1,105 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up SVG-edit before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
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 --file="$nginx_conf_path"
# Set global variables for nginx helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
ynh_add_nginx_config
fi
# Change the domain for nginx
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for SVG-edit" --last

View file

@ -1,55 +1,118 @@
#!/bin/bash #!/bin/bash
# Source YunoHost helpers #=================================================
source /usr/share/yunohost/helpers # GENERIC START
source _common.sh #=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
export app=$YNH_APP_INSTANCE_NAME #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
# Retrieve arguments domain=$YNH_APP_ARG_DOMAIN
ynh_export domain path_url is_public path_url=$YNH_APP_ARG_PATH
export final_path=/var/www/$app is_public=$YNH_APP_ARG_IS_PUBLIC
# Check if the app can be installed with this args app=$YNH_APP_INSTANCE_NAME
ynh_final_path_available
# Normalize the url path syntax #=================================================
path_url=$(ynh_normalize_url_path $path_url) # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path # Register (book) web path
ynh_webpath_register $app $domain $path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
# Save app settings #=================================================
ynh_save_args is_public final_path path_url # STORE SETTINGS FROM MANIFEST
#=================================================
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=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=3
# Check needed packages
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
# Copy source files #=================================================
ynh_setup_source "$final_path" # DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=6
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CUSTOM INSTRUCTION
#=================================================
# Custom instructions
ynh_configure config.js "$final_path/config.js" ynh_configure config.js "$final_path/config.js"
ynh_configure custom.css "$final_path/custom.css" ynh_configure custom.css "$final_path/custom.css"
# Set permissions to app files #=================================================
ynh_set_default_perm "$final_path" # SECURE FILES AND DIRECTORIES
#=================================================
# If app is public, add url to SSOWat conf as skipped_uris chown -R $app: $final_path
ynh_sso_access "/"
# Modify Nginx configuration file and copy it to Nginx conf directory #=================================================
ynh_add_nginx_config # SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Send a readme to the admin # Make app public if necessary or protect it
ynh_print_OFF if [ $is_public -eq 1 ]
message="You can now draw this address: https://${domain}${path_url}/ then
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/svgedit_ynh" ynh_permission_update --permission "main" --add "visitors"
fi
ynh_send_readme_to_admin "$message" #=================================================
ynh_print_ON # RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of SVG-edit completed" --last

View file

@ -1,21 +1,50 @@
#!/bin/bash #!/bin/bash
# See comments in install script #=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers domain=$(ynh_app_setting_get --app=$app --key=domain)
source /usr/share/yunohost/helpers final_path=$(ynh_app_setting_get --app=$app --key=final_path)
source _common.sh
# Retrieve app settings #=================================================
domain=$(ynh_app_setting_get "$app" domain) # REMOVE DEPENDENCIES
final_path=$(ynh_app_setting_get "$app" final_path) #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
# Remove sources #=================================================
ynh_secure_remove $final_path # REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing SVG-edit main directory..." --weight=3
# Remove nginx configuration file # Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of SVG-edit completed" --last

View file

@ -1,41 +1,91 @@
#!/bin/bash #!/bin/bash
# Source YunoHost helpers #=================================================
source /usr/share/yunohost/helpers # GENERIC START
source ../settings/scripts/_common.sh #=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
export app=$YNH_APP_INSTANCE_NAME #=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Retrieve old app settings app=$YNH_APP_INSTANCE_NAME
ynh_get_and_export domain path_url is_public final_path
# Normalize the url path syntax domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_normalize_url_path $path_url) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Check web path availability #=================================================
ynh_webpath_available $domain $path_url # CHECK IF THE APP CAN BE RESTORED
# Check if the app can be installed with this args #=================================================
ynh_final_path_available 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 \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=2
# Install dependency
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
# Restore sources & data #=================================================
ynh_restore # RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring SVG-edit main directory..." --weight=5
# Restore permissions to app files ynh_restore_file --origin_path="$final_path"
ynh_set_default_perm "$final_path"
# If app is public, add url to SSOWat conf as skipped_uris #=================================================
ynh_sso_access "/" # RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Restart webserver # Create the dedicated user (if not existing)
systemctl reload nginx ynh_system_user_create --username=$app
# Send message to 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/svgedit_ynh" # RESTORE USER RIGHTS
#=================================================
ynh_send_readme_to_admin "$message" # Restore permissions on app files
chown -R $app: $final_path
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for SVG-edit" --last

View file

@ -1,17 +1,56 @@
#!/bin/bash #!/bin/bash
# Source YunoHost helpers #=================================================
source /usr/share/yunohost/helpers # GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers
# See comments in install script #=================================================
export app=$YNH_APP_INSTANCE_NAME # LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Retrieve app settings app=$YNH_APP_INSTANCE_NAME
ynh_get_and_export domain path_url is_public final_path
# Check version domain=$(ynh_app_setting_get --app=$app --key=domain)
ynh_abort_if_up_to_date path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up SVG-edit before upgrading..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -19,36 +58,57 @@ ynh_clean_setup () {
# restore it if the upgrade fails # restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
# Normalize the url path syntax #=================================================
path_url=$(ynh_normalize_url_path $path_url) # UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=6
# Step migration ynh_install_app_dependencies $pkg_dependencies
version=${version:-2.8.1}
if ynh_version_le "2.8.1" ; then
final_path=${final_path:-/var/www/$app}
ynh_app_setting_set "$app" final_path "$final_path"
# Install dependency properly #=================================================
ynh_install_app_dependencies $pkg_dependencies # DOWNLOAD, CHECK AND UNPACK SOURCE
fi #=================================================
ynh_script_progression --message="Setting up source files..." --weight=5
# Copy source files ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_secure_remove $final_path # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_secure_remove "$final_path"
ynh_setup_source --dest_dir="$final_path"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# CUSTOM INSTRUCTION
#=================================================
# Custom instructions
ynh_configure config.js "$final_path/config.js" ynh_configure config.js "$final_path/config.js"
ynh_configure custom.css "$final_path/custom.css" ynh_configure custom.css "$final_path/custom.css"
# Set permissions to app files #=================================================
ynh_set_default_perm "$final_path" # SECURE FILES AND DIRECTORIES
#=================================================
# If app is public, add url to SSOWat conf as skipped_uris # Set permissions on app files
ynh_sso_access "/" chown -R $app: $final_path
# Set up nginx configuration #=================================================
ynh_add_nginx_config # RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of SVG-edit completed" --last