mirror of
https://github.com/YunoHost-Apps/garradin_ynh.git
synced 2024-09-03 18:36:17 +02:00
Merge pull request #56 from YunoHost-Apps/testing
Testing, update to latest versions 1.1.*, fix permissions and cleaning code.
This commit is contained in:
commit
752df03fb1
19 changed files with 193 additions and 195 deletions
59
README.md
59
README.md
|
@ -1,6 +1,11 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
# Garradin for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg)
|
||||
[![Integration level](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg)
|
||||
[![Install Garradin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=garradin)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
@ -9,50 +14,24 @@
|
|||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
|
||||
## Overview
|
||||
Garradin is a free association managing software.
|
||||
|
||||
**Shipped version:** 1.0.7
|
||||
Garradin (word meaning money in an aboriginal dialect of northern Australia, pronounced "gar-a-dine" em) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members, etc. etc. .
|
||||
|
||||
**Shipped version:** 1.1.10~ynh1
|
||||
|
||||
**Demo:** https://garradin.eu/essai/
|
||||
|
||||
## Screenshots
|
||||
|
||||
![](images/membre.png)
|
||||
![](images/compta.png)
|
||||
![](images/emails.png)
|
||||
![](images/wiki.png)
|
||||
![](images/site.jpg)
|
||||
![](./doc/screenshots/screenshot.png)
|
||||
|
||||
## Demo
|
||||
## Documentation and resources
|
||||
|
||||
* [Official demo](https://garradin.eu/essai/)
|
||||
|
||||
## Documentation
|
||||
|
||||
* Official documentation: https://fossil.kd2.org/garradin/wiki?name=Documentation
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
#### Multi-user support
|
||||
|
||||
LDAP is not supported yet.
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/garradin%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/garradin/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/garradin%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/garradin/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* The application is ONLY translated into french.
|
||||
* Do not install this application on the default root path's domain name without adding a subpath, otherwise the sso conection page will be substitute by home's garradin page.
|
||||
|
||||
## Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/garradin_ynh/issues
|
||||
* App website: https://garradin.eu
|
||||
* Upstream app repository: https://fossil.kd2.org/garradin/wiki?name=Garradin
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
* Official app website: http://garradin.eu
|
||||
* Official admin documentation: https://fossil.kd2.org/garradin/wiki?name=Documentation
|
||||
* Upstream app code repository: https://fossil.kd2.org/garradin/wiki?name=Garradin
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_garradin
|
||||
* Report a bug: https://github.com/YunoHost-Apps/garradin_ynh/issues
|
||||
|
||||
## Developer info
|
||||
|
||||
|
@ -64,3 +43,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/garradin_ynh/tree/tes
|
|||
or
|
||||
sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
59
README_fr.md
59
README_fr.md
|
@ -1,58 +1,33 @@
|
|||
# Garradin pour YunoHost
|
||||
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg)
|
||||
[![Installer Garradin avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=garradin)
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg)
|
||||
[![Installer Garradin avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=garradin)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Garradin rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
||||
## Vue d'ensemble
|
||||
Garradin est un logiciel libre de gestion associative. il permet de gérer des membres.
|
||||
|
||||
**Version incluse :** 1.0.7
|
||||
Garradin (mot signifiant argent dans un dialecte aborigène du nord de l'Australie, prononcé « gar-a-dine »em) est un logiciel de gestion associative. Il est l'outil de prédilection pour gérer une association, un club sportif, une ONG, etc. Il est conçu pour répondre aux besoins d'une structure de petite à moyenne taille : gestion des adhérents, comptabilité, site web, prise de notes en réunion, archivage et partage des documents de fonctionnement de l'association, discussion entre adhérents, etc etc.
|
||||
|
||||
**Version incluse :** 1.1.10~ynh1
|
||||
|
||||
**Démo :** https://garradin.eu/essai/
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![](images/membre.png)
|
||||
![](images/compta.png)
|
||||
![](images/emails.png)
|
||||
![](images/wiki.png)
|
||||
![](images/site.jpg)
|
||||
![](./doc/screenshots/screenshot.png)
|
||||
|
||||
## Démo
|
||||
## Documentations et ressources
|
||||
|
||||
* [Démo officielle](https://garradin.eu/essai/)
|
||||
|
||||
## Documentation
|
||||
|
||||
* Documentation officielle : https://fossil.kd2.org/garradin/wiki?name=Documentation
|
||||
|
||||
## Caractéristiques spécifiques YunoHost
|
||||
|
||||
#### Support multi-utilisateur
|
||||
|
||||
* L'authentification LDAP n'est pas disponible.
|
||||
|
||||
#### Architectures supportées
|
||||
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/garradin%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/garradin/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/garradin%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/garradin/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* Garradin n'est disponible qu'en français.
|
||||
* N'installez pas cette apllication à la racine du domaine par défaut sans ajouter un sous-domaine. Sinon la page de connexion SSO sera remplacée par la page d'accueil de Garradin.
|
||||
|
||||
## Liens
|
||||
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/garradin_ynh/issues
|
||||
* Site de l'application : http://garradin.eu
|
||||
* Dépôt de l'application principale : https://fossil.kd2.org/garradin/wiki?name=Garradin
|
||||
* Site web YunoHost : https://yunohost.org/
|
||||
|
||||
---
|
||||
* Site officiel de l'app : http://garradin.eu
|
||||
* Documentation officielle de l'admin : https://fossil.kd2.org/garradin/wiki?name=Documentation
|
||||
* Dépôt de code officiel de l'app : https://fossil.kd2.org/garradin/wiki?name=Garradin
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_garradin
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/garradin_ynh/issues
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
|
@ -64,3 +39,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/garradin_ynh/tree/tes
|
|||
ou
|
||||
sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_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)
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
is_public=1
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
|
@ -11,8 +11,14 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
#upgrade=1 from_commit=a36dd8b13d85078ddcee0d6d3146feb107d3e042
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
incorrect_path=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=a36dd8b13d85078ddcee0d6d3146feb107d3e042
|
||||
name=Merge pull request #55 from yunohost-bot/issue-and-pr-template
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
||||
|
|
|
@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum
|
|||
SOURCE_FORMAT=tar.bz2
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-1.0.7.tar.bz2
|
||||
SOURCE_SUM=bf54afad2ebd1e04cb5fa7f5a2033a7c790e30e7fb69b6795b103d66dfcb6c06
|
||||
SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-1.1.10.tar.bz2
|
||||
SOURCE_SUM=56785921ce99d8424871bf340a3225016fede10345e3ce9fe51e47facc2e88cc
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.bz2
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
|
|
|
@ -96,7 +96,7 @@ pm = dynamic
|
|||
; forget to tweak pm.* to fit your needs.
|
||||
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
||||
; Note: This value is mandatory.
|
||||
pm.max_children = 10
|
||||
pm.max_children = 5
|
||||
|
||||
; The number of child processes created on startup.
|
||||
; Note: Used only when pm is set to 'dynamic'
|
||||
|
|
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
|||
Garradin (word meaning money in an aboriginal dialect of northern Australia, pronounced "gar-a-dine" em) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members, etc. etc. .
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
|||
Garradin (mot signifiant argent dans un dialecte aborigène du nord de l'Australie, prononcé « gar-a-dine »em) est un logiciel de gestion associative. Il est l'outil de prédilection pour gérer une association, un club sportif, une ONG, etc. Il est conçu pour répondre aux besoins d'une structure de petite à moyenne taille : gestion des adhérents, comptabilité, site web, prise de notes en réunion, archivage et partage des documents de fonctionnement de l'association, discussion entre adhérents, etc etc.
|
0
doc/DISCLAIMER.md
Normal file
0
doc/DISCLAIMER.md
Normal file
BIN
doc/screenshots/screenshot.png
Normal file
BIN
doc/screenshots/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
BIN
images/documents.png
Normal file
BIN
images/documents.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 KiB |
BIN
images/edition-site-v1.1.png
Normal file
BIN
images/edition-site-v1.1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 161 KiB |
BIN
images/membre-v1.1.png
Normal file
BIN
images/membre-v1.1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
|
@ -6,15 +6,22 @@
|
|||
"en": "Software to manage association",
|
||||
"fr": "Logiciel libre de gestion d'association"
|
||||
},
|
||||
"version": "1.0.7~ynh2",
|
||||
"url": "http://garradin.eu/a-propos/",
|
||||
"version": "1.1.10~ynh1",
|
||||
"url": "http://garradin.eu",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0-or-later",
|
||||
"website": "http://garradin.eu",
|
||||
"demo": "https://garradin.eu/essai/",
|
||||
"admindoc": "https://fossil.kd2.org/garradin/wiki?name=Documentation",
|
||||
"code": "https://fossil.kd2.org/garradin/wiki?name=Garradin"
|
||||
},
|
||||
"license": "GPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "frju365",
|
||||
"email": "win10@tutanota.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">=4.0"
|
||||
"yunohost": ">=4.2.4"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -25,8 +32,7 @@
|
|||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"example": "domain.org"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
# dependencies used by the app
|
||||
YNH_PHP_VERSION="7.3"
|
||||
#pkg_dependencies="imagemagick"
|
||||
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-sqlite3"
|
||||
YNH_PHP_VERSION="7.4"
|
||||
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-sqlite3 php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-cli"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
|
@ -30,6 +29,23 @@ 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 CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# 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
|
||||
#=================================================
|
||||
|
@ -72,12 +88,13 @@ if [ $change_path -eq 1 ] && [ "$new_path" == "/" ]; then
|
|||
ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path';" --target_file="$final_path/config.local.php"
|
||||
elif [ $change_path -eq 1 ] && [ "$old_path" == "/" ]; then
|
||||
ynh_replace_string --match_string="const WWW_URI = '$old_path';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php"
|
||||
else [ $change_path -eq 1 ]
|
||||
ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php"
|
||||
elif [ $change_path -eq 1 ]; then
|
||||
ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php"
|
||||
fi
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]; then
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
|
|
|
@ -23,6 +23,7 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
|
@ -33,8 +34,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
|
|||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
||||
# Check web path availability
|
||||
ynh_webpath_available $domain $path_url
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
|
@ -52,7 +51,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
|
|||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -78,35 +77,12 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=5
|
|||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# Files owned by user app
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=5
|
||||
|
||||
chown $app:$app $final_path -R
|
||||
chmod 755 $final_path -R
|
||||
|
||||
# Remove the public access
|
||||
ynh_app_setting_delete --app=$app --key=skipped_uris
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=8
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
fi
|
||||
# Only the users can access to the panel of the app
|
||||
# ynh_permission_update --permission="main" --add "all_users"
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
# copy config.dist.php creating config.local.php
|
||||
cp -a $final_path/config.dist.php $final_path/config.local.php
|
||||
# create a key for the secret key CSFR;
|
||||
|
@ -119,6 +95,26 @@ else
|
|||
ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php"
|
||||
fi
|
||||
|
||||
# Permissions on files and directories
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
find "$final_path" -type d -exec chmod 550 {} +
|
||||
find "$final_path" -type f -exec chmod 440 {} +
|
||||
find "$final_path/data" -type d -exec chmod 770 {} +
|
||||
find "$final_path/data" -type f -exec chmod 660 {} +
|
||||
chmod 660 "$final_path/config.local.php"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=8
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
|
@ -34,8 +34,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=4
|
||||
|
||||
ynh_webpath_available $domain $path_url \
|
||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die "There is already a directory: $final_path "
|
||||
|
||||
|
@ -47,27 +45,33 @@ test ! -d $final_path \
|
|||
|
||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Garradin main directory..." --weight=5
|
||||
|
||||
ynh_restore_file "$final_path"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Garradin main directory..." --weight=5
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app:$app $final_path
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
find "$final_path" -type d -exec chmod 550 {} +
|
||||
find "$final_path" -type f -exec chmod 440 {} +
|
||||
find "$final_path/data" -type d -exec chmod 770 {} +
|
||||
find "$final_path/data" -type f -exec chmod 660 {} +
|
||||
chmod 660 "$final_path/config.local.php"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
@ -85,7 +89,7 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
|
|||
#=================================================
|
||||
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=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
117
scripts/upgrade
117
scripts/upgrade
|
@ -31,6 +31,19 @@ else
|
|||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up Garradin before upgrading (may take a while)..." --weight=30
|
||||
|
||||
# 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
|
||||
|
@ -43,6 +56,13 @@ if [ -z "$final_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# Backup Data
|
||||
#=================================================
|
||||
|
@ -59,27 +79,12 @@ if [ -e "$bdd" ]; then
|
|||
cp -a $bdd /tmp/association.sqlite
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up Garradin before upgrading (may take a while)..." --weight=30
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
#=================================================
|
||||
# UPGRADE TO 0.9.8 if necessary
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "0.9.8" ]
|
||||
then
|
||||
then
|
||||
ynh_script_progression --message="Upgrading upgrade to 0.9.8" --weight=5
|
||||
# Download, check integrity, uncompress and patch the source from 0.9.8.src
|
||||
ynh_setup_source --dest_dir="$final_path" --source_id="0.9.8"
|
||||
|
@ -105,6 +110,8 @@ then
|
|||
ynh_secure_remove $backup_bdd
|
||||
fi
|
||||
|
||||
chown -R $app:$app $final_path
|
||||
|
||||
key=$(ynh_string_random --length=50)
|
||||
cp -a $final_path/config.dist.php $final_path/config.local.php
|
||||
ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php"
|
||||
|
@ -113,31 +120,24 @@ then
|
|||
else
|
||||
ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php"
|
||||
fi
|
||||
chown $app:$app $final_path -R
|
||||
chmod 755 $final_path -R
|
||||
chmod 755 $final_path
|
||||
|
||||
# Create the visitors permission if needed
|
||||
if ! ynh_permission_exists --permission "visitors"; then
|
||||
ynh_permission_create --permission "visitors"
|
||||
visitors_enabled=$(ynh_permission_has_user "main" "visitors" && echo 0 || echo 1)
|
||||
if [[ $visitors_enabled -eq 0 ]]; then
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
fi
|
||||
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#finalyse upgrade
|
||||
# Finalize the upgrade
|
||||
ynh_local_curl "/index.php"
|
||||
sleep 5
|
||||
ynh_local_curl "/index.php"
|
||||
upgrade_type="UPGRADE_APP"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=5
|
||||
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
if [[ $visitors_enabled -eq 0 ]]; then
|
||||
ynh_permission_update --permission "main" --remove "visitors"
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -146,7 +146,18 @@ fi
|
|||
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
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=5
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -163,7 +174,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
|||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=======================================================
|
||||
# backup bdd, squelettes directory and config.local.php
|
||||
#=======================================================
|
||||
|
@ -172,7 +183,7 @@ ynh_script_progression --message="restore data..." --weight=10
|
|||
backup_bdd=/tmp/association.sqlite
|
||||
backup_squelettes=/tmp/squelettes
|
||||
|
||||
if [ -d "$backup_squelettes" ]
|
||||
if [ -d "$backup_squelettes" ]
|
||||
then
|
||||
cp -ar $backup_squelettes $final_path/www/squelettes
|
||||
ynh_secure_remove $backup_squelettes
|
||||
|
@ -180,10 +191,15 @@ fi
|
|||
|
||||
if [ -e "$backup_bdd" ]
|
||||
then
|
||||
cp -a $backup_bdd $final_path/association.sqlite
|
||||
cp -a $backup_bdd $final_path/association.sqlite
|
||||
ynh_secure_remove $backup_bdd
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=5
|
||||
|
||||
key=$(ynh_string_random --length=50)
|
||||
cp -a $final_path/config.dist.php $final_path/config.local.php
|
||||
ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php"
|
||||
|
@ -193,23 +209,14 @@ else
|
|||
ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# Files owned by user app
|
||||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown $app:$app $final_path -R
|
||||
chmod 755 $final_path -R
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading permissions configuration..." --weight=2
|
||||
|
||||
# Create the visitors permission if needed
|
||||
if ! ynh_permission_exists --permission "visitors"; then
|
||||
ynh_permission_create --permission "visitors"
|
||||
fi
|
||||
# Permissions on files and directories
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
find "$final_path" -type d -exec chmod 550 {} +
|
||||
find "$final_path" -type f -exec chmod 440 {} +
|
||||
find "$final_path/data" -type d -exec chmod 770 {} +
|
||||
find "$final_path/data" -type f -exec chmod 660 {} +
|
||||
chmod 660 "$final_path/config.local.php"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
@ -221,10 +228,10 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
#=================================================
|
||||
# Finalise Upgrade
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Finalise upgrade" --weight=1
|
||||
|
||||
ynh_local_curl "/admin/index.php"
|
||||
chmod 440 "$final_path/config.local.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Reference in a new issue