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

Update manifestv2

This commit is contained in:
Salamandar 2024-01-27 17:24:34 +01:00
parent 847eb1b64d
commit 3517fbf203
27 changed files with 313 additions and 817 deletions

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/LanguageTool-6.2.zip
SOURCE_SUM=1e8a10ac8e6c40c077c1640eb85fa9ca615a683fecdf7e00e51e463dcd0a0f49
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://ftp.tu-chemnitz.de/pub/Local/urz/ding/de-en/de-en.txt.zip
SOURCE_SUM=e6b98900d5a700fc94e31139898a0700596477201c78ee860b13dfe9a67638fa
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=de-en.txt.zip
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.ftz
SOURCE_SUM=8f3472cfe8738a7b6099e8e999c3cbfae0dcd15696aac7d7738a8039db603e83
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=bin
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=lid.176.ftz
SOURCE_EXTRACT=false

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin
SOURCE_SUM=7e69ec5451bc261cc7844e49e4792a85d7f09c06789ec800fc4a44aec362764e
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=bin
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=lid.176.bin
SOURCE_EXTRACT=false

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/facebookresearch/fastText/archive/refs/tags/v0.9.2.tar.gz
SOURCE_SUM=7ea4edcdb64bfc6faaaec193ef181bdc108ee62bb6a04e48b2e80b639a99e27e
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=v0.9.2.tar.gz
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/ngram-data/untested/ngram-he-20150916.zip
SOURCE_SUM=8f520d4f24214fe892d646edfa7ec6f9a0bf6b67749a87ef5cc565892ec60410
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=ngram-he-20150916.zip
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/ngram-data/untested/ngram-it-20150915.zip
SOURCE_SUM=092eeb91d138b808ad3e9b7e98973da503f824caf8a943c41c8700126b11f9f9
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=ngram-it-20150915.zip
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/ngram-data/untested/ngram-ru-20150914.zip
SOURCE_SUM=c6d047c944da78998ea014c9fcd516022bdfded1e4fe0f32cf48fa5a6e686e2c
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=ngram-ru-20150914.zip
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/ngram-data/untested/ngram-zh-20150916.zip
SOURCE_SUM=8217230df12b7515b144fe28b143dc0600c0613caa619813f6a2fac5fe416509
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=ngram-zh-20150916.zip
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/ngram-data/ngrams-de-20150819.zip
SOURCE_SUM=b338ded55f16a00a36cdf41db9234b03000fb750517e5380cfd4d10cb14f72b0
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=ngrams-de-20150819.zip
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/ngram-data/ngrams-en-20150817.zip
SOURCE_SUM=10e548731d9f58189fc36a553f7f685703be30da0d9bb42d1f7b5bf5f8bb232c
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=ngrams-en-20150817.zip
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/ngram-data/ngrams-es-20150915.zip
SOURCE_SUM=f4010e0d92a1c49e87f9265f85be9b1d419f6e99eea603358e7917ba65b74cce
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=ngrams-es-20150915.zip
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/ngram-data/ngrams-fr-20150913.zip
SOURCE_SUM=6e591d5b301b76d595342217bddda6804e515307ef28019d7256efadbd5880cd
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=ngrams-fr-20150913.zip
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://languagetool.org/download/ngram-data/ngrams-nl-20181229.zip
SOURCE_SUM=e32afafa2a6a456d9e3fdb28bdbcaa1f783ccad1b21dbdb8f8ba90656366b8bb
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=ngrams-nl-20181229.zip
SOURCE_EXTRACT=true

View file

@ -6,8 +6,8 @@ After=network.target
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__INSTALL_DIR__/
ExecStart=java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port __PORT__ --config __FINALPATH__/languagetool.conf ExecStart=java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port __PORT__ --config __INSTALL_DIR__/languagetool.conf
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit StandardError=inherit

View file

@ -1,118 +0,0 @@
{
"name": "LanguageTool server",
"id": "languagetool",
"packaging_format": 1,
"description": {
"en": "Multilingual grammar, style, and spell checker (API)",
"fr": "Correcteur d'orthographe, de grammaire et de style multilingue (API)"
},
"version": "6.2~ynh1",
"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",
"maintainer": {
"name": "Jules Bertholet",
"email": "jules.bertholet@gmail.com"
},
"requirements": {
"yunohost": ">= 11.2"
},
"multi_instance": true,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "use_ngram",
"type": "boolean",
"ask": {
"en": "Use ngram data (de, en, es, fr, nl)?",
"fr": "Utilizer donnés ngram (de, en, es, fr, nl) ?"
},
"help": {
"en": "~15.4 GB download",
"fr": "Téléchargement de ~15,4 Go"
},
"default": true
},
{
"name": "use_untested_ngram",
"type": "boolean",
"ask": {
"en": "Use untested ngram data (he, it, ru, zh)? (requires above option)",
"fr": "Utilizer donnés ngram non testées (he, it, ru, zh) ? (nécessite l'option ci-dessus)"
},
"help": {
"en": "~5.3 GB download",
"fr": "Téléchargement de ~5,3 Go"
},
"default": false
},
{
"name": "use_fasttext",
"type": "boolean",
"ask": {
"en": "Use fastext for language detection?",
"fr": "Utilizer fasttext pour la détection de langue ?"
},
"help": {
"en": "~131 MB download",
"fr": "Téléchargement de ~131 Mo"
},
"default": true
},
{
"name": "use_compressed_fasttext",
"type": "boolean",
"ask": {
"en": "Use compressed fastext model?",
"fr": "Utilizer modéle fasttext compressé ?"
},
"help": {
"en": "Reduces fasttex model download to ~938 KB, but slower and less accurate",
"fr": "Réduit la taille du téléchargement du modéle fasttext à ~938 Ko, mais moins rapide et précis"
},
"default": false
},
{
"name": "use_beolingus",
"type": "boolean",
"ask": {
"en": "Use Beolingus German-English word list?",
"fr": "Utilizer liste de mots allemand-anglais Beolingus?"
},
"help": {
"en": "~8 MB, download",
"fr": "Téléchargement de ~8 MB"
},
"default": false
},
{
"name": "grammalecte_server",
"type": "string",
"ask": {
"en": "Grammalecte server URL (optional, adds additional French-language rules if specified)",
"fr": "URL de serveur Grammalecte (facultatif, ajoute des régles pour la langue française si specifié)"
},
"help": {
"en": "You can add a Grammalecte server to your YunoHost installation with the dedicated package (https://github.com/YunoHost-Apps/grammalecte_ynh)",
"fr": "Vous pouvez ajouter un serveur Grammalecte à votre installation YunoHost avec le paquet dedié (https://github.com/YunoHost-Apps/grammalecte_ynh)"
},
"example": "https://grammalecte.example.com",
"default": "",
"optional": true
}
]
}
}

177
manifest.toml Normal file
View file

@ -0,0 +1,177 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "languagetool"
name = "LanguageTool server"
description.en = "Multilingual grammar, style, and spell checker (API)"
description.fr = "Correcteur d'orthographe, de grammaire et de style multilingue (API)"
version = "6.2~ynh1"
maintainers = ["Jules Bertholet"]
[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"
[integration]
yunohost = ">= 11.2"
architectures = "all"
multi_instance = true
ldap = false
sso = false
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
[install]
[install.domain]
type = "domain"
[install.use_ngram]
ask.en = "Use ngram data (de, en, es, fr, nl)?"
ask.fr = "Utilizer donnés ngram (de, en, es, fr, nl) ?"
help.en = "~15.4 GB download"
help.fr = "Téléchargement de ~15,4 Go"
type = "boolean"
default = true
[install.use_untested_ngram]
ask.en = "Use untested ngram data (he, it, ru, zh)? (requires above option)"
ask.fr = "Utilizer donnés ngram non testées (he, it, ru, zh) ? (nécessite l'option ci-dessus)"
help.en = "~5.3 GB download"
help.fr = "Téléchargement de ~5,3 Go"
type = "boolean"
default = false
[install.use_fasttext]
ask.en = "Use fastext for language detection?"
ask.fr = "Utilizer fasttext pour la détection de langue ?"
help.en = "~131 MB download"
help.fr = "Téléchargement de ~131 Mo"
type = "boolean"
default = true
[install.use_compressed_fasttext]
ask.en = "Use compressed fastext model?"
ask.fr = "Utilizer modéle fasttext compressé ?"
help.en = "Reduces fasttex model download to ~938 KB, but slower and less accurate"
help.fr = "Réduit la taille du téléchargement du modéle fasttext à ~938 Ko, mais moins rapide et précis"
type = "boolean"
default = false
[install.use_beolingus]
ask.en = "Use Beolingus German-English word list?"
ask.fr = "Utilizer liste de mots allemand-anglais Beolingus?"
help.en = "~8 MB, download"
help.fr = "Téléchargement de ~8 MB"
type = "boolean"
default = false
[install.grammalecte_server]
ask.en = "Grammalecte server URL (optional, adds additional French-language rules if specified)"
ask.fr = "URL de serveur Grammalecte (facultatif, ajoute des régles pour la langue française si specifié)"
help.en = "You can add a Grammalecte server to your YunoHost installation with the dedicated package (https://github.com/YunoHost-Apps/grammalecte_ynh)"
help.fr = "Vous pouvez ajouter un serveur Grammalecte à votre installation YunoHost avec le paquet dedié (https://github.com/YunoHost-Apps/grammalecte_ynh)"
type = "string"
example = "https://grammalecte.example.com"
default = ""
optional = true
[resources]
[resources.sources]
[resources.sources.main]
url = "https://languagetool.org/download/LanguageTool-6.2.zip"
sha256 = "1e8a10ac8e6c40c077c1640eb85fa9ca615a683fecdf7e00e51e463dcd0a0f49"
[resources.sources.ngrams-de]
url = "https://languagetool.org/download/ngram-data/ngrams-de-20150819.zip"
sha256 = "b338ded55f16a00a36cdf41db9234b03000fb750517e5380cfd4d10cb14f72b0"
prefetch = false
[resources.sources.ngrams-en]
url = "https://languagetool.org/download/ngram-data/ngrams-en-20150817.zip"
sha256 = "10e548731d9f58189fc36a553f7f685703be30da0d9bb42d1f7b5bf5f8bb232c"
prefetch = false
[resources.sources.ngrams-es]
url = "https://languagetool.org/download/ngram-data/ngrams-es-20150915.zip"
sha256 = "f4010e0d92a1c49e87f9265f85be9b1d419f6e99eea603358e7917ba65b74cce"
prefetch = false
[resources.sources.ngrams-fr]
url = "https://languagetool.org/download/ngram-data/ngrams-fr-20150913.zip"
sha256 = "6e591d5b301b76d595342217bddda6804e515307ef28019d7256efadbd5880cd"
prefetch = false
[resources.sources.ngrams-nl]
url = "https://languagetool.org/download/ngram-data/ngrams-nl-20181229.zip"
sha256 = "e32afafa2a6a456d9e3fdb28bdbcaa1f783ccad1b21dbdb8f8ba90656366b8bb"
prefetch = false
[resources.sources.ngram-he]
url = "https://languagetool.org/download/ngram-data/untested/ngram-he-20150916.zip"
sha256 = "8f520d4f24214fe892d646edfa7ec6f9a0bf6b67749a87ef5cc565892ec60410"
prefetch = false
[resources.sources.ngram-it]
url = "https://languagetool.org/download/ngram-data/untested/ngram-it-20150915.zip"
sha256 = "092eeb91d138b808ad3e9b7e98973da503f824caf8a943c41c8700126b11f9f9"
prefetch = false
[resources.sources.ngram-ru]
url = "https://languagetool.org/download/ngram-data/untested/ngram-ru-20150914.zip"
sha256 = "c6d047c944da78998ea014c9fcd516022bdfded1e4fe0f32cf48fa5a6e686e2c"
prefetch = false
[resources.sources.ngram-zh]
url = "https://languagetool.org/download/ngram-data/untested/ngram-zh-20150916.zip"
sha256 = "8217230df12b7515b144fe28b143dc0600c0613caa619813f6a2fac5fe416509"
prefetch = false
[resources.sources.fasttext-model]
url = "https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin"
sha256 = "7e69ec5451bc261cc7844e49e4792a85d7f09c06789ec800fc4a44aec362764e"
prefetch = false
format = "whatever"
extract = false
rename = "lid.176.bin"
[resources.sources.fasttext-model-compressed]
url = "https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.ftz"
sha256 = "8f3472cfe8738a7b6099e8e999c3cbfae0dcd15696aac7d7738a8039db603e83"
prefetch = false
format = "whatever"
extract = false
rename = "lid.176.ftz"
[resources.sources.fasttext]
url = "https://github.com/facebookresearch/fastText/archive/refs/tags/v0.9.2.tar.gz"
sha256 = "7ea4edcdb64bfc6faaaec193ef181bdc108ee62bb6a04e48b2e80b639a99e27e"
prefetch = false
[resources.sources.beolingus]
url = "https://ftp.tu-chemnitz.de/pub/Local/urz/ding/de-en/de-en.txt.zip"
sha256 = "e6b98900d5a700fc94e31139898a0700596477201c78ee860b13dfe9a67638fa"
prefetch = false
in_subdir = false
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 8081
[resources.apt]
packages = [
"default-jre",
"build-essential",
]

View file

@ -4,110 +4,80 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app
pkg_dependencies="default-jre build-essential"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
function download_data { download_data() {
if [ $use_ngram -eq 1 ]; then if [ "$use_ngram" -eq 1 ]; then
ynh_setup_source --dest_dir="$data_path/ngrams/de" --source_id="ngrams-de" ynh_setup_source --dest_dir="$data_dir/ngrams/de" --source_id="ngrams-de"
ynh_setup_source --dest_dir="$data_path/ngrams/en" --source_id="ngrams-en" ynh_setup_source --dest_dir="$data_dir/ngrams/en" --source_id="ngrams-en"
ynh_setup_source --dest_dir="$data_path/ngrams/es" --source_id="ngrams-es" ynh_setup_source --dest_dir="$data_dir/ngrams/es" --source_id="ngrams-es"
ynh_setup_source --dest_dir="$data_path/ngrams/fr" --source_id="ngrams-fr" ynh_setup_source --dest_dir="$data_dir/ngrams/fr" --source_id="ngrams-fr"
ynh_setup_source --dest_dir="$data_path/ngrams/nl" --source_id="ngrams-nl" ynh_setup_source --dest_dir="$data_dir/ngrams/nl" --source_id="ngrams-nl"
if [ $use_untested_ngram -eq 1 ]; then if [ "$use_untested_ngram" -eq 1 ]; then
ynh_setup_source --dest_dir="$data_path/ngrams/he" --source_id="ngram-he" ynh_setup_source --dest_dir="$data_dir/ngrams/he" --source_id="ngram-he"
ynh_setup_source --dest_dir="$data_path/ngrams/it" --source_id="ngram-it" ynh_setup_source --dest_dir="$data_dir/ngrams/it" --source_id="ngram-it"
ynh_setup_source --dest_dir="$data_path/ngrams/ru" --source_id="ngram-ru" ynh_setup_source --dest_dir="$data_dir/ngrams/ru" --source_id="ngram-ru"
ynh_setup_source --dest_dir="$data_path/ngrams/zh" --source_id="ngram-zh" ynh_setup_source --dest_dir="$data_dir/ngrams/zh" --source_id="ngram-zh"
fi fi
fi fi
if [ $use_fasttext -eq 1 ]; then if [ "$use_fasttext" -eq 1 ]; then
if [ $use_compressed_fasttext -eq 1 ]; then if [ "$use_compressed_fasttext" -eq 1 ]; then
ynh_setup_source --dest_dir="$data_path/fasttext" --source_id="fasttext-model-compressed" ynh_setup_source --dest_dir="$data_dir/fasttext" --source_id="fasttext-model-compressed"
else else
ynh_setup_source --dest_dir="$data_path/fasttext" --source_id="fasttext-model" ynh_setup_source --dest_dir="$data_dir/fasttext" --source_id="fasttext-model"
fi fi
ynh_setup_source --dest_dir="$final_path/fasttext" --source_id="fasttext" ynh_setup_source --dest_dir="$install_dir/fasttext" --source_id="fasttext"
fi fi
if [ $use_beolingus -eq 1 ]; then if [ $use_beolingus -eq 1 ]; then
ynh_setup_source --dest_dir="$data_path/beolingus" --source_id="beolingus" ynh_setup_source --dest_dir="$data_dir/beolingus" --source_id="beolingus"
fi fi
} }
function add_languagetool_config { add_languagetool_config() {
if [ $use_ngram -eq 1 ]; then if [ "$use_ngram" -eq 1 ]; then
language_model_config_line="languageModel=$data_path/ngrams" language_model_config_line="languageModel=$data_dir/ngrams"
else else
language_model_config_line="" language_model_config_line=""
fi fi
if [ $use_fasttext -eq 1 ]; then if [ "$use_fasttext" -eq 1 ]; then
if [ $use_compressed_fasttext -eq 1 ]; then if [ $use_compressed_fasttext -eq 1 ]; then
fasttext_model_config_line="fasttextModel=$data_path/fasttext/lid.176.ftz" fasttext_model_config_line="fasttextModel=$data_dir/fasttext/lid.176.ftz"
else else
fasttext_model_config_line="fasttextModel=$data_path/fasttext/lid.176.bin" fasttext_model_config_line="fasttextModel=$data_dir/fasttext/lid.176.bin"
fi fi
fasttext_binary_config_line="fasttextBinary=$final_path/fasttext/fasttext" fasttext_binary_config_line="fasttextBinary=$install_dir/fasttext/fasttext"
else else
fasttext_model_config_line="" fasttext_model_config_line=""
fasttext_binary_config_line="" fasttext_binary_config_line=""
fi fi
if [ $use_beolingus -eq 1 ]; then if [ "$use_beolingus" -eq 1 ]; then
beolingus_file_config_line="beolingusFile=$data_path/beolingus/de-en.txt" beolingus_file_config_line="beolingusFile=$data_dir/beolingus/de-en.txt"
else else
beolingus_file_config_line="" beolingus_file_config_line=""
fi fi
if [ ! -z $grammalecte_server ]; then if [ ! -z "$grammalecte_server" ]; then
grammalecte_server_config_line="grammalecteServer=$grammalecte_server/gc_text/fr" grammalecte_server_config_line="grammalecteServer=$grammalecte_server/gc_text/fr"
else else
grammalecte_server_config_line="" grammalecte_server_config_line=""
fi fi
ynh_add_config --template="languagetool.conf" --destination="$final_path/languagetool.conf" ynh_add_config --template="languagetool.conf" --destination="$install_dir/languagetool.conf"
} }
function compile_fasttext { compile_fasttext() {
if [ $use_fasttext -eq 1 ]; then pushd "$install_dir/fasttext"
ynh_script_progression --message="Compiling fasttext..." --weight=15 chown -R "$app:$app" $install_dir/fasttext
ynh_exec_as "$app" make -j "$(( $(nproc) * 3/4 ))"
pushd "$final_path/fasttext" || ynh_die chown -R root:root $install_dir/fasttext
chown -R $app:$app $final_path/fasttext popd
sudo -u $app make
chown -R root:root $final_path/fasttext
popd || ynh_die
fi
}
function set_permissions {
chown -R root:$app $final_path
chmod -R g=u,g-w,o-rwx $final_path
chown -R root:$app $data_path
chmod -R g=u,g-w,o-rwx $data_path
}
function load_installation_settings {
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
use_ngram=$(ynh_app_setting_get --app=$app --key=use_ngram)
use_untested_ngram=$(ynh_app_setting_get --app=$app --key=use_untested_ngram)
use_fasttext=$(ynh_app_setting_get --app=$app --key=use_fasttext)
use_compressed_fasttext=$(ynh_app_setting_get --app=$app --key=use_compressed_fasttext)
use_beolingus=$(ynh_app_setting_get --app=$app --key=use_beolingus)
grammalecte_server=$(ynh_app_setting_get --app=$app --key=grammalecte_server)
port=$(ynh_app_setting_get --app=$app --key=port)
} }
#================================================= #=================================================

View file

@ -10,27 +10,6 @@
source ../settings/scripts/_common.sh 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
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
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
#================================================= #=================================================
@ -40,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE APP DATA DIR # BACKUP THE APP DATA DIR
@ -49,23 +28,13 @@ ynh_backup --src_path="$final_path"
ynh_backup --src_path="$data_path" --is_big ynh_backup --src_path="$data_path" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/systemd/system/$app.service"
#================================================= #=================================================

View file

@ -9,59 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers 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="/"
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
load_installation_settings
#=================================================
# 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
# Backup the current version of the app
ynh_backup_before_upgrade
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.
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
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -69,36 +16,14 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 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"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf ynh_change_url_nginx_config
# 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
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
@ -107,14 +32,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -9,104 +9,16 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url='/'
use_ngram=$YNH_APP_ARG_USE_NGRAM
use_untested_ngram=$YNH_APP_ARG_USE_UNTESTED_NGRAM
use_fasttext=$YNH_APP_ARG_USE_FASTTEXT
use_compressed_fasttext=$YNH_APP_ARG_USE_COMPRESSED_FASTTEXT
use_beolingus=$YNH_APP_ARG_USE_BEOLINGUS
grammalecte_server=$YNH_APP_ARG_GRAMMALECTE_SERVER
app=$YNH_APP_INSTANCE_NAME
#=================================================
# 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"
data_path=/home/yunohost.app/$app
test ! -e "$data_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$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=use_ngram --value=$use_ngram
ynh_app_setting_set --app=$app --key=use_untested_ngram --value=$use_untested_ngram
ynh_app_setting_set --app=$app --key=use_fasttext --value=$use_fasttext
ynh_app_setting_set --app=$app --key=use_compressed_fasttext --value=$use_compressed_fasttext
ynh_app_setting_set --app=$app --key=use_beolingus --value=$use_beolingus
ynh_app_setting_set --app=$app --key=grammalecte_server --value=$grammalecte_server
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
port=$(ynh_find_port --port=8081)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
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
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=100 ynh_script_progression --message="Setting up source files..." --weight=100
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$install_dir"
download_data download_data
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
@ -119,67 +31,43 @@ add_languagetool_config
#================================================= #=================================================
# COMPILE FASTTEXT # COMPILE FASTTEXT
#================================================= #=================================================
if [ "$use_fasttext" -eq 1 ]; then
compile_fasttext ynh_script_progression --message="Compiling fasttext..." --weight=15
compile_fasttext
#================================================= fi
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# Set permissions to app files # Set permissions to app files
chown -R root:$app $final_path chown -R root:$app $install_dir
chmod -R g=u,g-w,o-rwx $final_path chmod -R g=u,g-w,o-rwx $install_dir
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 # SYSTEM CONFIGURATION
#================================================= #=================================================
# SETUP LOGROTATE ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1 # Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add "$app" --description="Multilingual grammar, style, and spell checker" --log="/var/log/$app/$app.log"
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
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"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,94 +10,27 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
load_installation_settings
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
then yunohost service remove "$app"
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE APP DATA DIR
#=================================================
ynh_script_progression --message="Removing app data directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$data_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -10,51 +10,14 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
load_installation_settings
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
test ! -d $data_path \
|| ynh_die --message="There is already a directory: $data_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# 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 --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# RESTORE THE APP DATA DIR # RESTORE THE APP DATA DIR
@ -67,72 +30,35 @@ if [ ! -d "$data_path" ]; then
add_languagetool_config add_languagetool_config
fi fi
#================================================= chown -R "$app:www-data" "$data_dir"
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
set_permissions
#================================================= #=================================================
# SPECIFIC RESTORATION # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
# REINSTALL DEPENDENCIES ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install 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" 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
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable "$app.service" --quiet
yunohost service add "$app" --description="Multilingual grammar, style, and spell checker" --log="/var/log/$app/$app.log"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # RESTORE VARIOUS FILES
#================================================= #=================================================
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" ynh_restore_file --origin_path="/var/log/$app"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -9,37 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
load_installation_settings
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -47,115 +16,66 @@ ynh_abort_if_errors
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
if [ -z "$use_beolingus" ]; then if [ -z "${use_beolingus:-}" ]; then
use_beolingus=0 use_beolingus=0
ynh_app_setting_set --app=$app --key=use_beolingus --value=$use_beolingus ynh_app_setting_set --app="$app" --key=use_beolingus --value=$use_beolingus
fi 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
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] # Download, check integrity, uncompress and patch the source from app.src
then ynh_setup_source --dest_dir="$install_dir" --full_replace=1
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src download_data
ynh_setup_source --dest_dir="$final_path"
download_data
fi
#================================================= #=================================================
# UPGRADE DEPENDENCIES # SPECIFIC SETUP
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1 # ADD A CONFIGURATION
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# NGINX CONFIGURATION ynh_script_progression --message="Adding a configuration file..."
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# COMPILE FASTTEXT
#=================================================
compile_fasttext
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
add_languagetool_config add_languagetool_config
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # COMPILE FASTTEXT
#================================================= #=================================================
if [ "$use_fasttext" -eq 1 ]; then
# Set permissions on app files ynh_script_progression --message="Compiling fasttext..." --weight=15
set_permissions compile_fasttext
fi
#================================================= #=================================================
# SETUP SYSTEMD # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
yunohost service add "$app" --description="Multilingual grammar, style, and spell checker" --log="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
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"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

11
tests.toml Normal file
View file

@ -0,0 +1,11 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------
test_upgrade_from.81d1f5dc1a42305d8cf3a6264176838d0164bfdb.name = "5.7~ynh1"