1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/languagetool_ynh.git synced 2024-09-03 19:35:58 +02:00

Merge pull request #18 from YunoHost-Apps/upgrade

Apply example_ynh
This commit is contained in:
yalh76 2022-07-16 19:20:15 +02:00 committed by GitHub
commit 27f14ee706
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 227 additions and 204 deletions

View file

@ -1,60 +1,56 @@
<!--
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.
-->
# LanguageTool server for YunoHost # LanguageTool server for YunoHost
[![Integration level](https://dash.yunohost.org/integration/languagetool.svg)](https://dash.yunohost.org/appci/app/languagetool) ![](https://ci-apps.yunohost.org/ci/badges/languagetool.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/languagetool.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/languagetool.svg)](https://dash.yunohost.org/appci/app/languagetool) ![Working status](https://ci-apps.yunohost.org/ci/badges/languagetool.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/languagetool.maintain.svg)
[![Install languagetool with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=languagetool) [![Install LanguageTool server with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=languagetool)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install LanguageTool quickly and simply on a YunoHost server. > *This package allows you to install LanguageTool server quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
LanguageTool is a multilingual grammar, style, and spell checker. This package provides the API server for use by other programs, like the LanguageTool extensions for browsers and word processors. LanguageTool is a multilingual grammar, style, and spell checker. This package provides the API server for use by other programs, like the LanguageTool extensions for browsers and word processors.
**Shipped version:** 5.7
**Shipped version:** 5.7~ynh2
**Demo:** https://api.languagetool.org/
## Screenshots ## Screenshots
![](https://github.com/YunoHost-Apps/languagetool_ynh/raw/master/screenshot.png) ![Screenshot of LanguageTool server](./doc/screenshots/screenshot_fr.png)
![Screenshot of LanguageTool server](./doc/screenshots/screenshot.png)
## Demo ## Disclaimers / important information
* [Official demo](https://api.languagetool.org/)
## Configuration ## Configuration
There is a configuration file at `/opt/yunohost/languagetool/languagetool.conf` (for the first install). There is a configuration file at `/opt/yunohost/languagetool/languagetool.conf` (for the first install).
## Documentation
* Official documentation: https://dev.languagetool.org/ ## Documentation and resources
#### Multi-user support * Official app website: <https://languagetool.org>
* Official admin documentation: <https://dev.languagetool.org/>
* Are LDAP and HTTP auth supported? **N/A** * Upstream app code repository: <https://github.com/languagetool-org/languagetool>
* Can the app be used by multiple users? **N/A** * YunoHost documentation for this app: <https://yunohost.org/app_languagetool>
* Report a bug: <https://github.com/YunoHost-Apps/languagetool_ynh/issues>
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/languagetool%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/languagetool/)
* ARMv8-A
## Links
* Report a bug: https://github.com/YunoHost-Apps/languagetool_ynh/issues
* App website: https://languagetool.org/
* Upstream app repository: https://github.com/languagetool-org/languagetool
* YunoHost website: https://yunohost.org/
---
## Developer info ## Developer info
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/languagetool_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/languagetool_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/languagetool_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/languagetool_ynh/tree/testing --debug
or or
sudo yunohost app upgrade languagetool -u https://github.com/YunoHost-Apps/languagetool_ynh/tree/testing --debug sudo yunohost app upgrade languagetool -u https://github.com/YunoHost-Apps/languagetool_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,61 +1,56 @@
# Serveur LanguageTool pour YunoHost <!--
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.
-->
[![Niveau d'intégration](https://dash.yunohost.org/integration/languagetool.svg)](https://dash.yunohost.org/appci/app/languagetool) ![](https://ci-apps.yunohost.org/ci/badges/languagetool.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/languagetool.maintain.svg) # LanguageTool server pour YunoHost
[![Installer languagetool avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=languagetool)
[![Niveau d'intégration](https://dash.yunohost.org/integration/languagetool.svg)](https://dash.yunohost.org/appci/app/languagetool) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/languagetool.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/languagetool.maintain.svg)
[![Installer LanguageTool server avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=languagetool)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer LanguageTool rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer LanguageTool server 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.* 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
LanguageTool est un correcteur d'orthographe, de grammaire et de style multilingue. Ce paquet fournit le serveur API pour utilisation depuis d'autres programmes, comme les extensions LangageTool pour navigateurs et logiciels de bureautique. LanguageTool est un correcteur d'orthographe, de grammaire et de style multilingue. Ce paquet fournit le serveur API pour utilisation depuis d'autres programmes, comme les extensions LangageTool pour navigateurs et logiciels de bureautique.
**Version incluse :** 5.7
**Version incluse :** 5.7~ynh2
**Démo :** https://api.languagetool.org/
## Captures d'écran ## Captures d'écran
![](https://github.com/YunoHost-Apps/languagetool_ynh/raw/master/screenshot_fr.png) ![Capture d'écran de LanguageTool server](./doc/screenshots/screenshot_fr.png)
![Capture d'écran de LanguageTool server](./doc/screenshots/screenshot.png)
## Démo ## Avertissements / informations importantes
* [Démo officielle](https://api.languagetool.org/)
## Configuration ## Configuration
Il y a un fichier de configuration à `/opt/yunohost/languagetool/languagetool.conf` (pour la première installation). Il y a un fichier de configuration à `/opt/yunohost/languagetool/languagetool.conf` (pour la première installation).
## Documentation ## Documentations et ressources
* Documentation officielle : https://dev.languagetool.org/ * Site officiel de l'app : <https://languagetool.org>
* Documentation officielle de l'admin : <https://dev.languagetool.org/>
#### Support multi-utilisateur * Dépôt de code officiel de l'app : <https://github.com/languagetool-org/languagetool>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_languagetool>
* L'authentification LDAP et HTTP est-elle prise en charge ? **S/O** * Signaler un bug : <https://github.com/YunoHost-Apps/languagetool_ynh/issues>
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **S/O**
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/languagetool%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/languagetool/)
* ARMv8-A
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/languagetool_ynh/issues
* Site de l'application : https://languagetool.org/fr/
* Dépôt de l'application principale : https://github.com/languagetool-org/languagetool
* Site web YunoHost : https://yunohost.org/
---
## Informations pour les développeurs ## Informations pour les développeurs
**Seulement si vous voulez utiliser une branche de test pour le codage, au lieu de fusionner directement dans la banche principale.**
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/languagetool_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/languagetool_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/languagetool_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/languagetool_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade languagetool -u https://github.com/YunoHost-Apps/languagetool_ynh/tree/testing --debug sudo yunohost app upgrade languagetool -u https://github.com/YunoHost-Apps/languagetool_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -1,8 +1,3 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
@ -17,7 +12,8 @@
setup_private=0 setup_private=0
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=0 from_commit=CommitHash # 5.7~ynh1
upgrade=1 from_commit=81d1f5dc1a42305d8cf3a6264176838d0164bfdb
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0 port_already_use=0
@ -25,8 +21,3 @@
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&

View file

@ -3,5 +3,5 @@ SOURCE_SUM=0c7ca3f7fa94d298c4ffb9d342b33e31cf6e93015602227b94924e3237b5ce79
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=LanguageTool-5.7.zip SOURCE_FILENAME=
SOURCE_EXTRACT=true SOURCE_EXTRACT=true

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
LanguageTool is a multilingual grammar, style, and spell checker. This package provides the API server for use by other programs, like the LanguageTool extensions for browsers and word processors.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
LanguageTool est un correcteur d'orthographe, de grammaire et de style multilingue. Ce paquet fournit le serveur API pour utilisation depuis d'autres programmes, comme les extensions LangageTool pour navigateurs et logiciels de bureautique.

3
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,3 @@
## Configuration
There is a configuration file at `/opt/yunohost/languagetool/languagetool.conf` (for the first install).

3
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,3 @@
## Configuration
Il y a un fichier de configuration à `/opt/yunohost/languagetool/languagetool.conf` (pour la première installation).

0
doc/screenshots/.gitkeep Normal file
View file

View file

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View file

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View file

@ -6,15 +6,22 @@
"en": "Multilingual grammar, style, and spell checker (API)", "en": "Multilingual grammar, style, and spell checker (API)",
"fr": "Correcteur d'orthographe, de grammaire et de style multilingue (API)" "fr": "Correcteur d'orthographe, de grammaire et de style multilingue (API)"
}, },
"version": "5.7~ynh1", "version": "5.7~ynh2",
"url": "https://languagetool.org", "url": "https://languagetool.org",
"upstream": {
"license": "LGPL-2.1-only",
"website": "https://languagetool.org",
"demo": "https://api.languagetool.org/",
"admindoc": "https://dev.languagetool.org/",
"code": "https://github.com/languagetool-org/languagetool"
},
"license": "LGPL-2.1-only", "license": "LGPL-2.1-only",
"maintainer": { "maintainer": {
"name": "Jules Bertholet", "name": "Jules Bertholet",
"email": "jules.bertholet@gmail.com" "email": "jules.bertholet@gmail.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.3" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -24,8 +31,7 @@
"install": [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"example": "example.com"
}, },
{ {
"name": "use_ngram", "name": "use_ngram",

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup() { ynh_clean_setup () {
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -28,8 +28,8 @@ ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -42,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE APP DATA DIR
#=================================================
ynh_backup --src_path="$data_path" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
@ -63,13 +69,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/systemd/system/$app.service"
#================================================= #=================================================
# BACKUP THE APP DATA DIR # BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="$data_path" --is_big
#=================================================
# BACKUP LOG FILES
#================================================= #=================================================
ynh_backup --src_path="/var/log/$app" ynh_backup --src_path="/var/log/$app"

View file

@ -29,13 +29,14 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
load_installation_settings load_installation_settings
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup() { ynh_clean_setup () {
ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. # 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" ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
@ -50,10 +51,16 @@ ynh_abort_if_errors
#================================================= #=================================================
change_domain=0 change_domain=0
if [ "$old_domain" != "$new_domain" ]; then if [ "$old_domain" != "$new_domain" ]
then
change_domain=1 change_domain=1
fi fi
change_path=0 change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -71,8 +78,21 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.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 --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 # Change the domain for NGINX
if [ $change_domain -eq 1 ]; then if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path" ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
true ynh_clean_check_starting
} }
# 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
@ -25,7 +25,6 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url='/' path_url='/'
is_public=1
use_ngram=$YNH_APP_ARG_USE_NGRAM use_ngram=$YNH_APP_ARG_USE_NGRAM
use_untested_ngram=$YNH_APP_ARG_USE_UNTESTED_NGRAM use_untested_ngram=$YNH_APP_ARG_USE_UNTESTED_NGRAM
use_word2vec=$YNH_APP_ARG_USE_WORD2VEC use_word2vec=$YNH_APP_ARG_USE_WORD2VEC
@ -33,6 +32,7 @@ use_fasttext=$YNH_APP_ARG_USE_FASTTEXT
use_compressed_fasttext=$YNH_APP_ARG_USE_COMPRESSED_FASTTEXT use_compressed_fasttext=$YNH_APP_ARG_USE_COMPRESSED_FASTTEXT
use_beolingus=$YNH_APP_ARG_USE_BEOLINGUS use_beolingus=$YNH_APP_ARG_USE_BEOLINGUS
grammalecte_server=$YNH_APP_ARG_GRAMMALECTE_SERVER grammalecte_server=$YNH_APP_ARG_GRAMMALECTE_SERVER
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
@ -81,6 +81,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -102,12 +110,19 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # SPECIFIC SETUP
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=1 # ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
# Create a system user add_languagetool_config
ynh_system_user_create --username=$app
#=================================================
# COMPILE FASTTEXT
#=================================================
compile_fasttext
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -117,22 +132,6 @@ 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
#=================================================
# ADD A CONFIGURATION
#=================================================
add_languagetool_config
#=================================================
# SPECIFIC SETUP
#=================================================
# COMPILE FASTTEXT
#=================================================
compile_fasttext
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
@ -143,6 +142,8 @@ chmod -R g=u,g-w,o-rwx $final_path
chown -R root:$app $data_path chown -R root:$app $data_path
chmod -R g=u,g-w,o-rwx $data_path chmod -R g=u,g-w,o-rwx $data_path
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
@ -171,13 +172,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Everyone can access the app.
if [ $is_public -eq 1 ] # The "main" permission is automatically created before the install script.
then ynh_permission_update --permission="main" --add="visitors"
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -14,6 +14,8 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
load_installation_settings load_installation_settings
#================================================= #=================================================
@ -23,7 +25,8 @@ load_installation_settings
#================================================= #=================================================
# 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; then if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1 ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app yunohost service remove $app
fi fi
@ -37,12 +40,12 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_remove_systemd_config ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE LOGROTATE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1 ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove metapackage and its dependencies # Remove the app-specific logrotate config
ynh_remove_app_dependencies ynh_remove_logrotate
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
@ -69,12 +72,12 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1 ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove the app-specific logrotate config # Remove metapackage and its dependencies
ynh_remove_logrotate ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE

View file

@ -14,8 +14,8 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup() { ynh_clean_setup () {
true ynh_clean_check_starting
} }
# 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
@ -25,6 +25,8 @@ ynh_abort_if_errors
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
load_installation_settings load_installation_settings
#================================================= #=================================================
@ -32,20 +34,20 @@ load_installation_settings
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url || test ! -d $final_path \
ynh_die --message="Path not available: ${domain}${path_url}" || ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path || test ! -d $data_path \
ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $data_path "
test ! -d $data_path ||
ynh_die --message="There is already a directory: $data_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
@ -65,14 +67,6 @@ if [ ! -d "$data_path" ]; then
add_languagetool_config add_languagetool_config
fi fi
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
@ -90,6 +84,20 @@ 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
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/var/log/$app"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
@ -98,6 +106,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
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
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
@ -105,12 +120,6 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Multilingual grammar, style, and spell checker" --log="/var/log/$app/$app.log" yunohost service add $app --description="Multilingual grammar, style, and spell checker" --log="/var/log/$app/$app.log"
#=================================================
# RESTORE LOG FILES
#=================================================
ynh_restore_file --origin_path="/var/log/$app"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
@ -118,12 +127,6 @@ 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"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -14,19 +14,14 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
load_installation_settings app=$YNH_APP_INSTANCE_NAME
#================================================= load_installation_settings
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
if [ -z "$use_beolingus" ]; then
use_beolingus=0
ynh_app_setting_set --app=$app --key=use_beolingus --value=$use_beolingus
fi
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
@ -37,7 +32,8 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup() { ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
@ -53,11 +49,30 @@ 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
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
if [ -z "$use_beolingus" ]; then
use_beolingus=0
ynh_app_setting_set --app=$app --key=use_beolingus --value=$use_beolingus
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]; then if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1 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
@ -66,6 +81,13 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then
download_data download_data
fi fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -74,21 +96,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# 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..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
@ -97,6 +104,20 @@ ynh_system_user_create --username=$app
compile_fasttext compile_fasttext
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
add_languagetool_config
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
set_permissions
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -105,21 +126,8 @@ 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
#=================================================
# UPDATE A CONFIG FILE
#=================================================
add_languagetool_config
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
set_permissions
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]