mirror of
https://github.com/YunoHost-Apps/dolibarr_ynh.git
synced 2024-09-03 18:35:53 +02:00
Merge pull request #117 from YunoHost-Apps/testing
Testing - packagingv2
This commit is contained in:
commit
72ebeb4abc
31 changed files with 475 additions and 970 deletions
|
@ -1,6 +1,8 @@
|
|||
# All available README files by language
|
||||
|
||||
- [Read the README in English](README.md)
|
||||
- [Lea el README en español](README_es.md)
|
||||
- [Irakurri README euskaraz](README_eu.md)
|
||||
- [Lire le README en français](README_fr.md)
|
||||
- [Le o README en galego](README_gl.md)
|
||||
- [Leggi il “README” in italiano](README_it.md)
|
||||
- [阅读中文(简体)的 README](README_zh_Hans.md)
|
||||
|
|
|
@ -9,7 +9,7 @@ It shall NOT be edited by hand.
|
|||
|
||||
[![Install Dolibarr with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr)
|
||||
|
||||
*[Read this README is other languages.](./ALL_README.md)*
|
||||
*[Read this README in other languages.](./ALL_README.md)*
|
||||
|
||||
> *This package allows you to install Dolibarr 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.*
|
||||
|
@ -18,7 +18,7 @@ It shall NOT be edited by hand.
|
|||
|
||||
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).
|
||||
|
||||
**Shipped version:** 18.0.3~ynh1
|
||||
**Shipped version:** 18.0.3~ynh2
|
||||
|
||||
**Demo:** <https://www.dolibarr.org/onlinedemo>
|
||||
|
||||
|
|
50
README_es.md
Normal file
50
README_es.md
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!--
|
||||
Este archivo README esta generado automaticamente<https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
|
||||
No se debe editar a mano.
|
||||
-->
|
||||
|
||||
# Dolibarr para Yunohost
|
||||
|
||||
[![Nivel de integración](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg)
|
||||
|
||||
[![Instalar Dolibarr con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr)
|
||||
|
||||
*[Leer este README en otros idiomas.](./ALL_README.md)*
|
||||
|
||||
> *Este paquete le permite instalarDolibarr rapidamente y simplement en un servidor YunoHost.*
|
||||
> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.*
|
||||
|
||||
## Descripción general
|
||||
|
||||
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).
|
||||
|
||||
**Versión actual:** 18.0.3~ynh2
|
||||
|
||||
**Demo:** <https://www.dolibarr.org/onlinedemo>
|
||||
|
||||
## Capturas
|
||||
|
||||
![Captura de Dolibarr](./doc/screenshots/screenshot.jpg)
|
||||
|
||||
## Documentaciones y recursos
|
||||
|
||||
- Sitio web oficial: <https://www.dolibarr.org/>
|
||||
- Documentación usuario oficial: <https://www.dolibarr.org/#features>
|
||||
- Documentación administrador oficial: <https://www.dolibarr.org/documentation-home>
|
||||
- Repositorio del código fuente oficial de la aplicación : <https://github.com/Dolibarr/dolibarr>
|
||||
- Catálogo YunoHost: <https://apps.yunohost.org/app/dolibarr>
|
||||
- Reportar un error: <https://github.com/YunoHost-Apps/dolibarr_ynh/issues>
|
||||
|
||||
## Información para desarrolladores
|
||||
|
||||
Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing
|
||||
|
||||
Para probar la rama `testing`, sigue asÍ:
|
||||
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
|
||||
o
|
||||
sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Mas informaciones sobre el empaquetado de aplicaciones:** <https://yunohost.org/packaging_apps>
|
50
README_eu.md
Normal file
50
README_eu.md
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!--
|
||||
Ohart ongi: README hau automatikoki sortu da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>ri esker
|
||||
EZ editatu eskuz.
|
||||
-->
|
||||
|
||||
# Dolibarr YunoHost-erako
|
||||
|
||||
[![Integrazio maila](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg)
|
||||
|
||||
[![Instalatu Dolibarr YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr)
|
||||
|
||||
*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)*
|
||||
|
||||
> *Pakete honek Dolibarr YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.*
|
||||
> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.*
|
||||
|
||||
## Aurreikuspena
|
||||
|
||||
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).
|
||||
|
||||
**Paketatutako bertsioa:** 18.0.3~ynh2
|
||||
|
||||
**Demoa:** <https://www.dolibarr.org/onlinedemo>
|
||||
|
||||
## Pantaila-argazkiak
|
||||
|
||||
![Dolibarr(r)en pantaila-argazkia](./doc/screenshots/screenshot.jpg)
|
||||
|
||||
## Dokumentazioa eta baliabideak
|
||||
|
||||
- Aplikazioaren webgune ofiziala: <https://www.dolibarr.org/>
|
||||
- Erabiltzaileen dokumentazio ofiziala: <https://www.dolibarr.org/#features>
|
||||
- Administratzaileen dokumentazio ofiziala: <https://www.dolibarr.org/documentation-home>
|
||||
- Jatorrizko aplikazioaren kode-gordailua: <https://github.com/Dolibarr/dolibarr>
|
||||
- YunoHost Denda: <https://apps.yunohost.org/app/dolibarr>
|
||||
- Eman errore baten berri: <https://github.com/YunoHost-Apps/dolibarr_ynh/issues>
|
||||
|
||||
## Garatzaileentzako informazioa
|
||||
|
||||
Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing).
|
||||
|
||||
`testing` abarra probatzeko, ondorengoa egin:
|
||||
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
|
||||
edo
|
||||
sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Informazio gehiago aplikazioaren paketatzeari buruz:** <https://yunohost.org/packaging_apps>
|
|
@ -18,7 +18,7 @@ Il NE doit PAS être modifié à la main.
|
|||
|
||||
Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.).
|
||||
|
||||
**Version incluse :** 18.0.3~ynh1
|
||||
**Version incluse :** 18.0.3~ynh2
|
||||
|
||||
**Démo :** <https://www.dolibarr.org/onlinedemo>
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ NON debe editarse manualmente.
|
|||
|
||||
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).
|
||||
|
||||
**Versión proporcionada:** 18.0.3~ynh1
|
||||
**Versión proporcionada:** 18.0.3~ynh2
|
||||
|
||||
**Demo:** <https://www.dolibarr.org/onlinedemo>
|
||||
|
||||
|
|
50
README_zh_Hans.md
Normal file
50
README_zh_Hans.md
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!--
|
||||
注意:此 README 由 <https://github.com/YunoHost/apps/tree/master/tools/readme_generator> 自动生成
|
||||
请勿手动编辑。
|
||||
-->
|
||||
|
||||
# YunoHost 上的 Dolibarr
|
||||
|
||||
[![集成程度](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![工作状态](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg)
|
||||
|
||||
[![使用 YunoHost 安装 Dolibarr](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr)
|
||||
|
||||
*[阅读此 README 的其它语言版本。](./ALL_README.md)*
|
||||
|
||||
> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 Dolibarr。*
|
||||
> *如果您还没有 YunoHost,请参阅[指南](https://yunohost.org/install)了解如何安装它。*
|
||||
|
||||
## 概况
|
||||
|
||||
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).
|
||||
|
||||
**分发版本:** 18.0.3~ynh2
|
||||
|
||||
**演示:** <https://www.dolibarr.org/onlinedemo>
|
||||
|
||||
## 截图
|
||||
|
||||
![Dolibarr 的截图](./doc/screenshots/screenshot.jpg)
|
||||
|
||||
## 文档与资源
|
||||
|
||||
- 官方应用网站: <https://www.dolibarr.org/>
|
||||
- 官方用户文档: <https://www.dolibarr.org/#features>
|
||||
- 官方管理文档: <https://www.dolibarr.org/documentation-home>
|
||||
- 上游应用代码库: <https://github.com/Dolibarr/dolibarr>
|
||||
- YunoHost 商店: <https://apps.yunohost.org/app/dolibarr>
|
||||
- 报告 bug: <https://github.com/YunoHost-Apps/dolibarr_ynh/issues>
|
||||
|
||||
## 开发者信息
|
||||
|
||||
请向 [`testing` 分支](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing) 发送拉取请求。
|
||||
|
||||
如要尝试 `testing` 分支,请这样操作:
|
||||
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
|
||||
或
|
||||
sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**有关应用打包的更多信息:** <https://yunohost.org/packaging_apps>
|
|
@ -1,25 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
admin="john"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=0
|
||||
setup_public=0
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=7e3914481ac4d6c40f3be3f35f155fac6f4387c6
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=CommitHash
|
||||
name=16.0.5
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&
|
|
@ -2,7 +2,7 @@
|
|||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/htdocs/ ;
|
||||
alias __INSTALL_DIR__/htdocs/;
|
||||
|
||||
index index.php;
|
||||
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
#!/bin/bash
|
||||
app="$(basename $0 | cut -d- -f 2-)" # Extract the app name from the script name, which is supposed to be something like "50-app_id"
|
||||
src_path=$(yunohost app setting $app final_path)
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Extract the app name from the script name, which is supposed to be something like "50-app_id"
|
||||
app="$(basename "$0" | cut -d- -f 2-)"
|
||||
|
||||
src_path=$(yunohost app setting "$app" install_dir)
|
||||
# member=__MEMBER__
|
||||
|
||||
# Sync users
|
||||
if sudo php "$src_path/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then
|
||||
echo ldap user update ok
|
||||
echo "LDAP user update succeeded"
|
||||
else
|
||||
echo ldap user update ended with error
|
||||
echo "LDAP user update ended with error"
|
||||
fi
|
||||
|
||||
# If YNH users should also be members, sync members
|
||||
# if [ $member -eq 1 ];
|
||||
# then
|
||||
# if sudo php "$src_path/scripts/members/sync_members_ldap2dolibarr.php" commitiferror 1 --server=localhost -y; then
|
||||
# echo ldap member update ok
|
||||
# else
|
||||
# echo ldap member update ended with error
|
||||
# fi
|
||||
# if [ $member -eq 1 ]; then
|
||||
# if sudo php "$src_path/scripts/members/sync_members_ldap2dolibarr.php" commitiferror 1 --server=localhost -y; then
|
||||
# echo ldap member update ok
|
||||
# else
|
||||
# echo ldap member update ended with error
|
||||
# fi
|
||||
# fi
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
{
|
||||
"name": "Dolibarr",
|
||||
"id": "dolibarr",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Manage the various aspects of your business or association",
|
||||
"fr": "Gérez les différents aspects de votre activité pro ou associative"
|
||||
},
|
||||
"version": "18.0.3~ynh1",
|
||||
"url": "https://www.dolibarr.org/",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0-or-later",
|
||||
"website": "https://www.dolibarr.org/",
|
||||
"demo": "https://www.dolibarr.org/onlinedemo",
|
||||
"admindoc": "https://www.dolibarr.org/documentation-home",
|
||||
"userdoc": "https://www.dolibarr.org/#features",
|
||||
"code": "https://github.com/Dolibarr/dolibarr",
|
||||
"cpe": "cpe:2.3:a:dolibarr:dolibarr"
|
||||
},
|
||||
"license": "GPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "mastereur",
|
||||
"url": "https://github.com/mastereur"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.2"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php8.1-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"example": "/dolibarr",
|
||||
"default": "/dolibarr"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
126
manifest.toml
Normal file
126
manifest.toml
Normal file
|
@ -0,0 +1,126 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||
|
||||
packaging_format = 2
|
||||
|
||||
id = "dolibarr"
|
||||
name = "Dolibarr"
|
||||
description.en = "Manage the various aspects of your business or association"
|
||||
description.fr = "Gérez les différents aspects de votre activité pro ou associative"
|
||||
|
||||
version = "18.0.3~ynh2"
|
||||
|
||||
maintainers = ["mastereur"]
|
||||
|
||||
[upstream]
|
||||
license = "GPL-3.0-or-later"
|
||||
website = "https://www.dolibarr.org/"
|
||||
demo = "https://www.dolibarr.org/onlinedemo"
|
||||
admindoc = "https://www.dolibarr.org/documentation-home"
|
||||
userdoc = "https://www.dolibarr.org/#features"
|
||||
code = "https://github.com/Dolibarr/dolibarr"
|
||||
cpe = "cpe:2.3:a:dolibarr:dolibarr"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = true
|
||||
sso = true
|
||||
disk = "200M"
|
||||
ram.build = "150M"
|
||||
ram.runtime = "150M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
type = "path"
|
||||
default = "/dolibarr"
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.admin]
|
||||
type = "user"
|
||||
|
||||
[resources]
|
||||
[resources.sources.main]
|
||||
url = "https://github.com/Dolibarr/dolibarr/archive/18.0.3.tar.gz"
|
||||
sha256 = "8639d466b26f0fba7d2b610a96ffcf36a657b1e00bdc2e5a1ac5287521dcb4ed"
|
||||
autoupdate.strategy = "latest_github_release"
|
||||
|
||||
[resources.sources.main_18_0_1]
|
||||
url = "https://github.com/dolibarr/dolibarr/archive/18.0.1.tar.gz"
|
||||
sha256 = "37bd3c8533b821c241dbb34b0e88349c1d5b43f7ffa6027f0b7970748d1f727a"
|
||||
prefetch = false
|
||||
|
||||
[resources.sources.main_17_0_1]
|
||||
url = "https://github.com/dolibarr/dolibarr/archive/17.0.1.tar.gz"
|
||||
sha256 = "2eddd545c07eae291ad46e48ab55d3adb988d99c29a8dfaa2e2fde0a890b0ddc"
|
||||
prefetch = false
|
||||
|
||||
[resources.sources.main_16_0_5]
|
||||
url = "https://github.com/dolibarr/dolibarr/archive/16.0.5.tar.gz"
|
||||
sha256 = "c8298342558e62b955a6f4c01fedb6a187b2e0c0b2c1681a97158ca979f9304f"
|
||||
prefetch = false
|
||||
|
||||
[resources.sources.main_15_0_3]
|
||||
url = "https://github.com/dolibarr/dolibarr/archive/15.0.3.tar.gz"
|
||||
sha256 = "b145a38f56c44b166721d64909fb12408c6d10d08fcf74d2c00418a60201cc9d"
|
||||
prefetch = false
|
||||
|
||||
[resources.sources.main_14_0_5]
|
||||
url = "https://github.com/Dolibarr/dolibarr/archive/14.0.5.tar.gz"
|
||||
sha256 = "31f4c934e484a9582d8867e4170f1f1acd8c41628b059370a6a449eb6e94ae75"
|
||||
prefetch = false
|
||||
|
||||
[resources.sources.main_13_0_5]
|
||||
url = "https://github.com/Dolibarr/dolibarr/archive/13.0.5.tar.gz"
|
||||
sha256 = "08ec08dc5093d614361f273237f5aaf8d70e63d764c2fa8d7f3f68a1485156d0"
|
||||
prefetch = false
|
||||
|
||||
[resources.sources.main_12_0_5]
|
||||
url = "https://github.com/Dolibarr/dolibarr/archive/12.0.5.tar.gz"
|
||||
sha256 = "b60b124ebcd294375f6200cc0683449e475b5dec687f8317b820fc8ec1413d21"
|
||||
prefetch = false
|
||||
|
||||
[resources.sources.main_11_0_5]
|
||||
url = "https://github.com/Dolibarr/dolibarr/archive/11.0.5.tar.gz"
|
||||
sha256 = "6f51435a4ffe576e836bf6449d900de9a56016f09591322cb2ba47a07c97679d"
|
||||
prefetch = false
|
||||
|
||||
[resources.sources.main_10_0_7]
|
||||
url = "https://github.com/Dolibarr/dolibarr/archive/10.0.7.tar.gz"
|
||||
sha256 = "6efc230f400a7b7152a0e4b9ba02a780f38b869b4aebd2bc28883268270ef871"
|
||||
prefetch = false
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
[resources.apt]
|
||||
packages = [
|
||||
"php8.1-mysql",
|
||||
"php8.1-imagick",
|
||||
"php8.1-gd",
|
||||
"php8.1-mbstring",
|
||||
"php8.1-soap",
|
||||
"php8.1-curl",
|
||||
"php8.1-intl",
|
||||
"php8.1-ldap",
|
||||
"php8.1-opcache",
|
||||
"php8.1-calendar",
|
||||
"php8.1-zip",
|
||||
"php8.1-xml",
|
||||
"php8.1-fileinfo",
|
||||
"php8.1-imap",
|
||||
"mariadb-server",
|
||||
]
|
||||
|
||||
[resources.database]
|
||||
type = "mysql"
|
|
@ -3,29 +3,35 @@
|
|||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
YNH_PHP_VERSION="8.1"
|
||||
|
||||
php_dependencies="php$YNH_PHP_VERSION-mysql \
|
||||
php$YNH_PHP_VERSION-imagick \
|
||||
php$YNH_PHP_VERSION-gd \
|
||||
php$YNH_PHP_VERSION-mbstring \
|
||||
php$YNH_PHP_VERSION-soap \
|
||||
php$YNH_PHP_VERSION-curl \
|
||||
php$YNH_PHP_VERSION-intl \
|
||||
php$YNH_PHP_VERSION-opcache \
|
||||
php$YNH_PHP_VERSION-calendar \
|
||||
php$YNH_PHP_VERSION-zip \
|
||||
php$YNH_PHP_VERSION-xml \
|
||||
php$YNH_PHP_VERSION-fileinfo \
|
||||
php$YNH_PHP_VERSION-imap"
|
||||
|
||||
# dependencies used by the app (must be on a single line)
|
||||
pkg_dependencies="$php_dependencies"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
upgrade_dolibarr() {
|
||||
ynh_setup_source --source_id="$source_id" --dest_dir="$install_dir" --full_replace=1 \
|
||||
--keep="htdocs/conf/conf.php htdocs/install/install.forced.php"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
# Remove the lock if it exists
|
||||
lock=$install_dir/documents/install.lock
|
||||
if [ -f "$lock" ]; then
|
||||
ynh_secure_remove --file="$lock"
|
||||
fi
|
||||
|
||||
pushd "$install_dir/htdocs/install/"
|
||||
"php$phpversion" upgrade.php "$current_version" "$new_version"
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
"php$phpversion" upgrade2.php "$current_version" "$new_version"
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
"php$phpversion" step5.php "$current_version" "$new_version"
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
popd
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,25 +8,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
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)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -38,26 +17,16 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
# BACKUP THE SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,106 +7,20 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up 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 () {
|
||||
# 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
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# UPDATE conf file
|
||||
#=================================================
|
||||
|
||||
ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_domain$new_path" --target_file="$final_path/htdocs/conf/conf.php"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_replace_string --target_file="$install_dir/htdocs/conf/conf.php" \
|
||||
--match_string="$old_domain$old_path" \
|
||||
--replace_string="$new_domain$new_path"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
270
scripts/install
270
scripts/install
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,71 +7,10 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
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"
|
||||
|
||||
# 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=2
|
||||
|
||||
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=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json")
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# 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=2
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a MySQL database..." --weight=1
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
ynh_script_progression --message="Configuring $app's MySQL database..." --weight=1
|
||||
|
||||
ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8"
|
||||
|
||||
|
@ -82,201 +19,100 @@ ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
|
||||
# Load the last available version
|
||||
source upgrade.d/upgrade.last.sh
|
||||
|
||||
# Create an app.src for the last version of Dolibarr
|
||||
cat > ../conf/app.src << EOF
|
||||
SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/$next_version.tar.gz
|
||||
SOURCE_SUM=$dolibarr_source_sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.bz2
|
||||
SOURCE_IN_SUBDIR=true
|
||||
EOF
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_script_progression --message="Download source files..." --weight=70
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
ynh_setup_source --source_id="main" --dest_dir="$install_dir"
|
||||
|
||||
# Create necessary files
|
||||
datadir=$final_path/documents
|
||||
touch $final_path/htdocs/conf/conf.php
|
||||
mkdir -p "$install_dir/documents"
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chmod go-w "$install_dir/documents"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
# PREPARE AND INSTALL APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM" --weight=2
|
||||
ynh_script_progression --message="Adding $app's configuration file..." --weight=1
|
||||
|
||||
fpm_footprint="medium"
|
||||
fpm_usage="medium"
|
||||
ynh_add_config --template="install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
# Used by ynh_add_nginx_config
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
ynh_add_fpm_config
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# PREPARE AND INSTALL APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/install.forced.php" --destination="$final_path/htdocs/install/install.forced.php"
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring $app ..." --weight=1
|
||||
|
||||
# Create necessary files
|
||||
touch "$install_dir/htdocs/conf/conf.php"
|
||||
|
||||
# Set right permissions for curl install
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
# Set the app as temporarily public for cURL call
|
||||
if ! ynh_permission_has_user --permission "main" --user="visitors"; then
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
# Reload NGINX
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
# Installation with curl
|
||||
|
||||
mkdir -p /var/log/$app/
|
||||
|
||||
ynh_script_progression --message="Finalizing installation..." --weight=1
|
||||
|
||||
ynh_script_progression --message="Generate fileconf" --weight=1
|
||||
ynh_local_curl "/install/fileconf.php" \
|
||||
"testpost=ok"
|
||||
chown -R "$app:" "$install_dir"
|
||||
|
||||
ynh_local_curl "/install/fileconf.php" "testpost=ok"
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
ynh_script_progression --message="installation - step 1" --weight=3
|
||||
ynh_local_curl "/install/step1.php" \
|
||||
"testpost=ok" \
|
||||
"action=set" > /var/log/$app/install1.html
|
||||
|
||||
ynh_local_curl "/install/step1.php" "testpost=ok" "action=set"
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
ynh_script_progression --message="installation - step 2 (may take a while)..." --weight=72
|
||||
ynh_local_curl "/install/step2.php" \
|
||||
"testpost=ok" \
|
||||
"action=set" > /var/log/$app/install2.html
|
||||
|
||||
ynh_local_curl "/install/step2.php" "testpost=ok" "action=set"
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
ynh_script_progression --message="installation - step 4" --weight=3
|
||||
ynh_local_curl "/install/step4.php" \
|
||||
"testpost=ok" \
|
||||
"action=set" > /var/log/$app/install3.html
|
||||
|
||||
ynh_local_curl "/install/step4.php" "testpost=ok" "action=set"
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
# Generate a random password for the admin user (will be ignored because of LDAP)
|
||||
password=$(ynh_string_random 8)
|
||||
|
||||
ynh_script_progression --message="installation - step 5" --weight=4
|
||||
ynh_local_curl "/install/step5.php" \
|
||||
"testpost=ok" \
|
||||
"action=set" \
|
||||
"pass=$password" \
|
||||
"pass_verif=$password" > /var/log/$app/install4.html
|
||||
|
||||
ynh_local_curl "/install/step5.php" "testpost=ok" "action=set" "pass=$password" "pass_verif=$password"
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
ynh_script_progression --message="configuring LDAP" --weight=1
|
||||
# Setup HTTP auth in conf
|
||||
ynh_replace_string --target_file="$install_dir/htdocs/conf/conf.php" \
|
||||
--match_string="dolibarr_main_authentication='dolibarr'" \
|
||||
--replace_string="dolibarr_main_authentication='http'"
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php"
|
||||
chmod 644 "$install_dir/htdocs/conf/conf.php"
|
||||
|
||||
# Set permissions on app files
|
||||
if [ ! -f "$install_dir/documents/install.lock" ]; then
|
||||
echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$install_dir/documents/install.lock"
|
||||
chown "$app:$app" "$install_dir/documents/install.lock"
|
||||
chmod 440 "$install_dir/documents/install.lock"
|
||||
fi
|
||||
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
chown -R "$app:" "$install_dir/documents"
|
||||
|
||||
#=================================================
|
||||
# SETUP LDAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring LDAP for $app..." --weight=1
|
||||
|
||||
# Populate the LDAP parameters
|
||||
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql
|
||||
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < ../conf/sql/ldap.sql
|
||||
|
||||
# Populate the database with YNH users.
|
||||
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql
|
||||
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < ../conf/sql/ldap_user.sql
|
||||
|
||||
if php$phpversion $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then
|
||||
if "php$phpversion" "$install_dir/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then
|
||||
ynh_print_info --message="LDAP user update ok"
|
||||
else
|
||||
ynh_print_info --message="LDAP user update ended with error"
|
||||
fi
|
||||
|
||||
# Remove the public access
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="configuring config file" --weight=1
|
||||
|
||||
# Setup HTTP auth in conf
|
||||
ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$final_path/htdocs/conf/conf.php"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Set permissions on app files
|
||||
if [ ! -f "$datadir/install.lock" ]; then
|
||||
echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock"
|
||||
chown $app:$app "$datadir/install.lock"
|
||||
chmod 440 "$datadir/install.lock"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
chmod 644 "$final_path/htdocs/conf/conf.php"
|
||||
mkdir -p "$datadir"
|
||||
chown -R $app: "$datadir"
|
||||
chmod go-w $datadir
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate --logfile="$final_path/documents/dolibarr.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Create the public space permission if needed
|
||||
if ! ynh_permission_exists --permission "public_space"; then
|
||||
ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,78 +8,27 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..." --weight=9
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# 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 NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
# Delete old static pool.d conf
|
||||
old_php_version=7.0
|
||||
if [ -f /etc/php/$old_php_version/fpm/pool.d/$app.conf ]; then
|
||||
ynh_secure_remove --file=/etc/php/$old_php_version/fpm/pool.d/$app.conf
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE APP FOLDERS
|
||||
# REMOVE OLD FILES
|
||||
#=================================================
|
||||
# Delete old static pool.d conf
|
||||
old_php_version=7.0
|
||||
if [ -f "/etc/php/$old_php_version/fpm/pool.d/$app.conf" ]; then
|
||||
ynh_secure_remove --file="/etc/php/$old_php_version/fpm/pool.d/$app.conf"
|
||||
fi
|
||||
|
||||
# Remove a directory securely
|
||||
ynh_secure_remove --file="/etc/$app"
|
||||
|
@ -89,16 +36,6 @@ ynh_secure_remove --file="/etc/$app"
|
|||
# Remove the log files
|
||||
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
|
||||
#=================================================
|
||||
|
|
105
scripts/restore
105
scripts/restore
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,123 +8,48 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading settings..." --weight=1
|
||||
|
||||
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)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
datadir=$final_path/documents/
|
||||
|
||||
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# 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 "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
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"
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
chmod 644 "$install_dir/htdocs/conf/conf.php"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_print_info --message="Reconfiguring PHP-FPM..."
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
# Restore the file first, so it can have a backup if different
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
# Recreate a dedicated php-fpm config
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_add_fpm_config --phpversion="$phpversion"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=27
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Set permissions on app files
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
chmod 644 "$final_path/htdocs/conf/conf.php"
|
||||
mkdir -p "$datadir"
|
||||
chown -R $app: "$datadir"
|
||||
chmod go-w $datadir
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
332
scripts/upgrade
332
scripts/upgrade
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,325 +7,103 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
current_version=$(ynh_app_setting_get --app=$app --key=version)
|
||||
update_version=$(ynh_app_upstream_version "../manifest.json")
|
||||
datadir=$final_path/documents/
|
||||
|
||||
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# CHECK 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=11
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# 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
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
# If fpm_footprint doesn't exist, create it
|
||||
if [ -z "$fpm_footprint" ]; then
|
||||
if [ -z "${fpm_footprint:-}" ]; then
|
||||
fpm_footprint=medium
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
fi
|
||||
|
||||
# If fpm_usage doesn't exist, create it
|
||||
if [ -z "$fpm_usage" ]; then
|
||||
if [ -z "${fpm_usage:-}" ]; then
|
||||
fpm_usage=medium
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission "public_space"; then
|
||||
ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"
|
||||
fi
|
||||
|
||||
# Delete existing ini configuration file (backward compatibility)
|
||||
if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then
|
||||
ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
if [ -n "${version:-}" ]; then
|
||||
ynh_app_setting_delete --app=$app --key="version"
|
||||
fi
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'")
|
||||
if [ "$charset" != "utf8" ]; then
|
||||
ynh_print_info --message="Changing Database charset to utf8"
|
||||
ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8"
|
||||
ynh_local_curl "/install/repair.php" "force_utf8_on_tables=confirmed"
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
# Delete current NGINX configuration to be able to check if .well-known is already served.
|
||||
ynh_remove_nginx_config
|
||||
ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf"
|
||||
|
||||
# Wait untils NGINX has fully reloaded
|
||||
ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd"
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
||||
|
||||
# If php has changed, remove the old fpm config file
|
||||
# if [ "$phpversion" != $YNH_PHP_VERSION ]
|
||||
# then
|
||||
# ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
# ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
# if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then
|
||||
# ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini"
|
||||
# fi
|
||||
# ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload
|
||||
|
||||
# phpversion="$YNH_PHP_VERSION"
|
||||
# fi
|
||||
|
||||
# Recreate a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR
|
||||
# VERSION TO THE NEXT ONE
|
||||
#=================================================
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=60
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=60
|
||||
|
||||
# Load the last available version
|
||||
source upgrade.d/upgrade.last.sh
|
||||
last_version=$next_version
|
||||
|
||||
last_major_version=${last_version%%.*}
|
||||
|
||||
# While the current version is not the last version, do an upgrade
|
||||
while [ "$last_version" != "$current_version" ]
|
||||
do
|
||||
|
||||
# The major version is the first part of the version number
|
||||
current_major_version=${current_version%%.*}
|
||||
|
||||
if [ ! -f upgrade.d/upgrade.$current_major_version.sh ]; then
|
||||
source upgrade.d/upgrade.last.sh
|
||||
else
|
||||
source upgrade.d/upgrade.$current_major_version.sh
|
||||
# Sort --version-sort cdécembrean handle underscore in versions numbers
|
||||
mapfile -t main_versions < <(
|
||||
ynh_read_manifest --manifest_key="resources.sources | keys[]" | grep "main_" | sort --version-sort
|
||||
)
|
||||
current_version="$YNH_APP_CURRENT_VERSION"
|
||||
for version in "${main_versions[@]}"; do
|
||||
new_version=$(echo "$version" | sed 's|main_||' | sed 's|_|.|g')
|
||||
if dpkg --compare-versions "$current_version" ge "$new_version"; then
|
||||
continue
|
||||
fi
|
||||
ynh_print_info --message="Upgrading app from $current_version to $new_version"
|
||||
source_id="$version"
|
||||
upgrade_dolibarr
|
||||
current_version="$new_version"
|
||||
done
|
||||
|
||||
# If the current version has the same major version than the next one,
|
||||
# then it's the last upgrade to do
|
||||
# We also cover the case where the last version is the first of the current major version series
|
||||
# (e.g. 20.0.0 is the latest version)
|
||||
if [[ ("$last_major_version" -eq "$current_major_version") || ( ("$last_major_version" -eq "$((current_major_version+1))") && ("$next_version" == "$last_version") ) ]]; then
|
||||
current_major_version=last
|
||||
fi
|
||||
# Final upgrade to the final version
|
||||
new_version=$(ynh_app_upstream_version)
|
||||
source_id="main"
|
||||
ynh_print_info --message="Upgrading app from $current_version to $new_version"
|
||||
upgrade_dolibarr
|
||||
|
||||
# Load the value for this version
|
||||
source upgrade.d/upgrade.$current_major_version.sh
|
||||
|
||||
ynh_print_info --message="Upgrading app from $current_version to $next_version"
|
||||
|
||||
# Create an app.src for this version of Dolibarr
|
||||
cat > ../conf/app.src << EOF
|
||||
SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/$next_version.tar.gz
|
||||
SOURCE_SUM=$dolibarr_source_sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.bz2
|
||||
SOURCE_IN_SUBDIR=true
|
||||
EOF
|
||||
|
||||
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
# Remove the lock if it exists
|
||||
lock=$final_path/documents/install.lock
|
||||
if [ -f $lock ]
|
||||
then
|
||||
ynh_secure_remove $lock
|
||||
fi
|
||||
|
||||
mkdir -p /var/log/$app/
|
||||
|
||||
# Upgrade with CURL
|
||||
|
||||
# Set the app as temporarily public for cURL call
|
||||
if ! ynh_permission_has_user --permission "main" --user="visitors"; then
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
|
||||
charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'")
|
||||
if [ "$charset" != "utf8" ]
|
||||
then
|
||||
ynh_print_info --message="Changing Database charset to utf8"
|
||||
|
||||
ynh_mysql_execute_as_root --database=$db_name --sql="ALTER DATABASE $db_name charset=utf8"
|
||||
|
||||
ynh_local_curl "/install/repair.php" \
|
||||
"force_utf8_on_tables=confirmed" > /var/log/$app/repair.html
|
||||
fi
|
||||
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
pushd $final_path/htdocs/install/
|
||||
|
||||
if php$phpversion upgrade.php $current_version $next_version > /var/log/$app/upgrade.html; then
|
||||
ynh_print_info --message="Step 1 upgrading ended successfully"
|
||||
else
|
||||
ynh_die --message="Step 1 upgrading ended with error"
|
||||
fi
|
||||
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
if php$phpversion upgrade2.php $current_version $next_version > /var/log/$app/upgrade2.html; then
|
||||
ynh_print_info --message="Step 2 upgrading ended successfully"
|
||||
else
|
||||
ynh_die --message="Step 2 upgrading ended with error"
|
||||
fi
|
||||
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
if php$phpversion step5.php $current_version $next_version > /var/log/$app/upgrade3.html; then
|
||||
ynh_print_info --message="Step 3 upgrading ended successfully"
|
||||
else
|
||||
ynh_die --message="Step 3 upgrading ended with error"
|
||||
fi
|
||||
|
||||
|
||||
popd
|
||||
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
|
||||
# Get the new current version number
|
||||
current_version=$next_version
|
||||
current_major_version=${current_version%%.*}
|
||||
|
||||
done
|
||||
|
||||
if php$phpversion $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then
|
||||
if "php$phpversion" "$install_dir/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then
|
||||
ynh_print_info --message="LDAP user update ok"
|
||||
else
|
||||
else
|
||||
ynh_print_info --message="LDAP user update ended with error"
|
||||
fi
|
||||
|
||||
ynh_app_setting_set --app=$app --key=version --value=$update_version
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/htdocs/conf/conf.php"
|
||||
ynh_backup_if_checksum_is_different --file="$install_dir/htdocs/conf/conf.php"
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php"
|
||||
chmod 644 "$final_path/htdocs/conf/conf.php"
|
||||
ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php"
|
||||
chmod 644 "$install_dir/htdocs/conf/conf.php"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Set permissions on app files
|
||||
if [ ! -f "$datadir/install.lock" ]; then
|
||||
echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock"
|
||||
chown $app:$app "$datadir/install.lock"
|
||||
chmod 440 "$datadir/install.lock"
|
||||
if [ ! -f "$install_dir/documents/install.lock" ]; then
|
||||
echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$install_dir/documents/install.lock"
|
||||
chown "$app:$app" "$install_dir/documents/install.lock"
|
||||
chmod 440 "$install_dir/documents/install.lock"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
mkdir -p "$datadir"
|
||||
chown -R $app: "$datadir"
|
||||
chmod go-w $datadir
|
||||
# mkdir -p "$data_dir"
|
||||
# chown -R $app: "$data_dir"
|
||||
# chmod go-w $data_dir
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_add_fpm_config
|
||||
|
||||
ynh_add_nginx_config
|
||||
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="11.0.5"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="6f51435a4ffe576e836bf6449d900de9a56016f09591322cb2ba47a07c97679d"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="12.0.5"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="b60b124ebcd294375f6200cc0683449e475b5dec687f8317b820fc8ec1413d21"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="13.0.5"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="08ec08dc5093d614361f273237f5aaf8d70e63d764c2fa8d7f3f68a1485156d0"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="14.0.5"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="31f4c934e484a9582d8867e4170f1f1acd8c41628b059370a6a449eb6e94ae75"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="15.0.3"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="b145a38f56c44b166721d64909fb12408c6d10d08fcf74d2c00418a60201cc9d"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="16.0.5"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="C8298342558E62B955A6F4C01FEDB6A187B2E0C0B2C1681A97158CA979F9304F"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="17.0.1"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="2EDDD545C07EAE291AD46E48AB55D3ADB988D99C29A8DFAA2E2FDE0A890B0DDC"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="18.0.1"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="37bd3c8533b821c241dbb34b0e88349c1d5b43f7ffa6027f0b7970748d1f727a"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="10.0.7"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="6efc230f400a7b7152a0e4b9ba02a780f38b869b4aebd2bc28883268270ef871"
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="18.0.3"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="8639d466b26f0fba7d2b610a96ffcf36a657b1e00bdc2e5a1ac5287521dcb4ed"
|
13
tests.toml
Normal file
13
tests.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||
|
||||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# -------------------------------
|
||||
# Commits to test upgrade from
|
||||
# -------------------------------
|
||||
|
||||
test_upgrade_from.8f6e1a302a943607aa640bbcb44405c8cb0a513d.name = "Upgrade from 18.0.3"
|
||||
test_upgrade_from.c91139d3859032c3982b4bba3943aeae3ca57948.name = "15.0.3"
|
||||
test_upgrade_from.7e3914481ac4d6c40f3be3f35f155fac6f4387c6.name = "old version"
|
Loading…
Reference in a new issue