mirror of
https://github.com/YunoHost-Apps/dolibarr_ynh.git
synced 2024-09-03 18:35:53 +02:00
commit
15884cb2f1
14 changed files with 131 additions and 229 deletions
65
README.md
65
README.md
|
@ -1,3 +1,8 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Dolibarr for YunoHost
|
||||
|
||||
[![Integration level](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)
|
||||
|
@ -5,61 +10,33 @@
|
|||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allow you to install Dolibarr quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||
> *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.*
|
||||
|
||||
## Overview
|
||||
|
||||
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).
|
||||
|
||||
**Shipped version:** 14.0.2
|
||||
**Shipped version:** 14.0.2~ynh1
|
||||
|
||||
**Demo:** https://www.dolibarr.org/onlinedemo
|
||||
|
||||
## Screenshots
|
||||
|
||||
![Screenshot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x400.png)
|
||||
![](./doc/screenshots/screenshot.jpg)
|
||||
|
||||
## Demo
|
||||
|
||||
* [Official demo](https://www.dolibarr.org/onlinedemo)
|
||||
|
||||
## Configuration
|
||||
|
||||
Use the admin panel of your dolibarr to configure this app.
|
||||
|
||||
## Documentation
|
||||
|
||||
* Official documentation: https://www.dolibarr.org/documentation-home
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
#### Multi-users support
|
||||
|
||||
* LDAP and HTTP auth supported: **Yes**
|
||||
* The app can be used by multiple users: **Yes**
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/dolibarr%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/dolibarr/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/dolibarr%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/dolibarr/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* Dolibarr must be a non-public application to be able to link YunoHost accounts.
|
||||
* The deletion of an account is not taken into account in Dolibarr.
|
||||
|
||||
## Additional information
|
||||
|
||||
## Links
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: https://www.dolibarr.org/
|
||||
* Official user documentation: https://www.dolibarr.org/#features
|
||||
* Official admin documentation: https://www.dolibarr.org/documentation-home
|
||||
* Upstream app code repository: https://github.com/Dolibarr/dolibarr
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_dolibarr
|
||||
* Report a bug: https://github.com/YunoHost-Apps/dolibarr_ynh/issues
|
||||
* App website: https://www.dolibarr.org
|
||||
* Upstream app repository: https://github.com/Dolibarr/dolibarr
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
## Developer info
|
||||
|
||||
## Developers info
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing).
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
@ -67,3 +44,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/tes
|
|||
or
|
||||
sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
57
README_fr.md
57
README_fr.md
|
@ -1,61 +1,34 @@
|
|||
# Dolibarr pour YunoHost
|
||||
|
||||
[![Integration level](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)
|
||||
[![Niveau d'intégration](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)
|
||||
[![Installer Dolibarr avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Dolibarr rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.).
|
||||
|
||||
**Version incluse :** 14.0.2
|
||||
**Version incluse :** 14.0.2~ynh1
|
||||
|
||||
**Démo :** https://www.dolibarr.org/onlinedemo
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![Screenshot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x400.png)
|
||||
![](./doc/screenshots/screenshot.jpg)
|
||||
|
||||
## Démo
|
||||
## Documentations et ressources
|
||||
|
||||
* [Démo officielle](https://www.dolibarr.fr/demo-en-ligne)
|
||||
|
||||
## Configuration
|
||||
|
||||
Utilisez le panneau d'administration de votre Dolibarr pour configurer cette application.
|
||||
|
||||
## Documentation
|
||||
|
||||
* Documentation officielle : https://www.dolibarr.fr/documentation
|
||||
|
||||
## Caractéristiques spécifiques YunoHost
|
||||
|
||||
#### Support multi-utilisateurs
|
||||
|
||||
* L'authentification LDAP et HTTP est prise en charge
|
||||
* L'application peut être utilisée par plusieurs utilisateurs.
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/dolibarr%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/dolibarr/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/dolibarr%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/dolibarr/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* Dolibarr doit être une application non publique pour pouvoir lier les comptes YunoHost.
|
||||
* La suppression d'un compte n'est pas prise en compte dans Dolibarr.
|
||||
|
||||
## Informations additionnelles
|
||||
|
||||
## Liens
|
||||
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/dolibarr_ynh/issues
|
||||
* Site de l'application : https://www.dolibarr.fr
|
||||
* Dépôt de l'application principale : https://github.com/Dolibarr/dolibarr
|
||||
* Site web YunoHost : https://yunohost.org/
|
||||
|
||||
---
|
||||
* Site officiel de l'app : https://www.dolibarr.org/
|
||||
* Documentation officielle utilisateur : https://www.dolibarr.org/#features
|
||||
* Documentation officielle de l'admin : https://www.dolibarr.org/documentation-home
|
||||
* Dépôt de code officiel de l'app : https://github.com/Dolibarr/dolibarr
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_dolibarr
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/dolibarr_ynh/issues
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
|
@ -67,3 +40,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/tes
|
|||
ou
|
||||
sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
|
@ -1,8 +1,8 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
admin="john" (USER)
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
admin="john"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
|
|
|
@ -3,4 +3,3 @@ SOURCE_SUM=5747d7518115ad94b96606b00aad7fc687b1404bb5d838a0aef1d900998fc846
|
|||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
|
|
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
|||
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
|||
Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.).
|
0
doc/DISCLAIMER.md
Normal file
0
doc/DISCLAIMER.md
Normal file
BIN
doc/screenshots/screenshot.jpg
Normal file
BIN
doc/screenshots/screenshot.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 281 KiB |
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
app=__APP__
|
||||
src_path=__SRCPATH__
|
||||
src_path=__FINALPATH__
|
||||
member=__MEMBER__
|
||||
|
||||
# Sync users
|
||||
|
|
|
@ -3,18 +3,26 @@
|
|||
"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."
|
||||
"en": "Manage the various aspects of your business or association",
|
||||
"fr": "Gérez les différents aspects de votre activité pro ou associative"
|
||||
},
|
||||
"version": "14.0.2~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"
|
||||
},
|
||||
"license": "GPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "mastereur",
|
||||
"url": "https://github.com/mastereur"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.0.0"
|
||||
"yunohost": ">= 4.2.4"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -26,31 +34,17 @@
|
|||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain name for Dolibarr",
|
||||
"fr": "Choisissez un nom de domaine pour Dolibarr"
|
||||
},
|
||||
"example": "example.com"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for Dolibarr",
|
||||
"fr": "Choisissez un chemin pour Dolibarr"
|
||||
},
|
||||
"example": "/dolibarr",
|
||||
"default": "/dolibarr"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose an admin user",
|
||||
"fr": "Choisissez l’administrateur"
|
||||
},
|
||||
"example": "johndoe"
|
||||
"type": "user"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
## Problem
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
- *And how do you fix that problem*
|
||||
|
||||
## PR Status
|
||||
- [ ] Code finished.
|
||||
- [ ] Tested with Package_check.
|
||||
- [ ] Fix or enhancement tested.
|
||||
- [ ] Upgrade from last version tested.
|
||||
- [ ] Can be reviewed and tested.
|
||||
|
||||
## Package_check results
|
||||
---
|
||||
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
|
|
@ -24,7 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN
|
|||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
member=0
|
||||
is_public=0
|
||||
#is_public=0
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -47,10 +47,18 @@ 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=is_public --value=$is_public
|
||||
#ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
ynh_app_setting_set --app=$app --key=member --value=$member
|
||||
ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json")
|
||||
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
@ -80,30 +88,15 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
datadir=$final_path/documents
|
||||
touch $final_path/htdocs/conf/conf.php
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=2
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM and install dependencies..." --weight=2
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --usage=medium --footprint=medium --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
|
||||
|
||||
# Used by ynh_add_nginx_config
|
||||
ynh_add_fpm_config --usage=medium --footprint=medium --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
# If phpversion doesn't exist, create it
|
||||
if [ -z "$phpversion" ]; then
|
||||
phpversion="$YNH_PHP_VERSION"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -117,15 +110,9 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# PREPARE AND INSTALL APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
finstall="$final_path/htdocs/install/install.forced.php"
|
||||
cp ../conf/install.forced.php "$finstall"
|
||||
|
||||
# Change variables in Dolibarr configuration
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$finstall"
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$finstall"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$finstall"
|
||||
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$finstall"
|
||||
ynh_add_config --template="../conf/install.forced.php" --destination="$final_path/htdocs/install/install.forced.php"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE THE HOOK FILE FOR USER CREATE
|
||||
|
@ -133,7 +120,7 @@ ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target
|
|||
fhook=../hooks/post_user_create
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__SRCPATH__" --replace_string="$final_path" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$fhook"
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
|
@ -199,6 +186,9 @@ else
|
|||
ynh_print_warn --message="LDAP user update ended with error"
|
||||
fi
|
||||
|
||||
# Remove the public access
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
|
@ -221,7 +211,10 @@ ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php"
|
|||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app: "$final_path"
|
||||
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"
|
||||
|
@ -240,12 +233,6 @@ ynh_use_logrotate --logfile="$final_path/documents/dolibarr.log"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary or protect it
|
||||
if [ $is_public -eq 0 ]
|
||||
then
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
fi
|
||||
|
||||
# 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"
|
||||
|
|
|
@ -40,8 +40,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
|
@ -102,7 +100,10 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app: "$final_path"
|
||||
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"
|
||||
|
|
109
scripts/upgrade
109
scripts/upgrade
|
@ -19,7 +19,6 @@ 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)
|
||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
member=$(ynh_app_setting_get --app=$app --key=member)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
|
@ -38,23 +37,25 @@ phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
|||
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Fix is_public as a boolean value
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=1
|
||||
is_public=1
|
||||
elif [ "$is_public" = "No" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||
is_public=0
|
||||
else
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||
is_public=0
|
||||
fi
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
|
@ -79,24 +80,24 @@ if [ -z "$fpm_usage" ]; then
|
|||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
fi
|
||||
|
||||
# If phpversion doesn't exist, create it
|
||||
if [ -z "$phpversion" ]; then
|
||||
phpversion="$YNH_PHP_VERSION"
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
if ! ynh_permission_exists --permission "public_space"; then
|
||||
ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=11
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# 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
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -120,34 +121,26 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
# 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
|
||||
# phpversion="$YNH_PHP_VERSION"
|
||||
# fi
|
||||
|
||||
# Recreate a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -209,13 +202,9 @@ then
|
|||
|
||||
popd
|
||||
|
||||
if [ $is_public -eq 0 ]
|
||||
then
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
@ -223,6 +212,7 @@ fi
|
|||
ynh_backup_if_checksum_is_different --file="$final_path/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"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
|
@ -240,7 +230,7 @@ ynh_use_logrotate --non-append
|
|||
fhook=../hooks/post_user_create
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__SRCPATH__" --replace_string="$final_path" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$fhook"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -249,29 +239,20 @@ ynh_replace_string --match_string="__SRCPATH__" --replace_string="$final_path" -
|
|||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R $app: "$final_path"
|
||||
chmod 644 "$final_path/htdocs/conf/conf.php"
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
mkdir -p "$datadir"
|
||||
chown -R $app: "$datadir"
|
||||
chmod go-w $datadir
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..." --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 and PHP-FPM..."
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Reference in a new issue