From b8383f9a483a8c61d2bb6f10d24ac1a7e4fbca16 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 7 Aug 2020 18:58:18 +0200 Subject: [PATCH 01/18] syntax nginx changed --- conf/nginx.conf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index cf253bc..c319377 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,12 +1,12 @@ location __PATH__ { # Path to source -alias __FINALPATH__/www/ ; +alias __FINALPATH__/www/; if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } - + # Protecting sensibles urls location ~ 403 { rewrite ^(.*)$ /include/ redirect; @@ -20,10 +20,9 @@ if ($scheme = http) { } # Example PHP configuration (remove if not used) - location __PATH__/ { index index.php /_route.php; try_files $uri $uri/ index.php /_route.php; - } + location ~ [^/]\.php(/|$) { try_files $uri $uri/ /_route.php; From 86dadf21b0909a62e9987842dab45f56a0c9ba45 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 28 Aug 2020 14:31:05 +0200 Subject: [PATCH 02/18] change sha256 sum for 0.9.8.tar.bz2 --- conf/app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index a24c59a..cba27f0 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-0.9.8.tar.bz2 -SOURCE_SUM=98aa01b86521ff66dcc951ab6f0eb1915e3cee5dada15ba20c96ab72512f1e83 +SOURCE_SUM=8a703936de30b45501ab759f0e1cae6623a96e562873d7c5fa24d233488a5945 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true From c25246ea5935eb3451e7807a48c70f064ecf743a Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 28 Aug 2020 15:48:41 +0200 Subject: [PATCH 03/18] add advertissment installing on root path can brake sso --- README.md | 3 ++- README_fr.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d4a6eb1..8d5a715 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,9 @@ LDAP is not supported yet. ## 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. -**More info on the documentation page:** +**More info on the documentation page:** https://yunohost.org/packaging_apps ## Links diff --git a/README_fr.md b/README_fr.md index ff88f39..15e9157 100644 --- a/README_fr.md +++ b/README_fr.md @@ -43,8 +43,9 @@ Garradin est un logiciel libre de gestion associative. il permet de gérer des m ## 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. -**Plus d'informations sur la page de documentation :** +**Plus d'informations sur la page de documentation :** https://yunohost.org/packaging_apps ## Liens From 95516502911fb6ba15f7aee36b7a59e7dcbe95e3 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 28 Aug 2020 15:50:58 +0200 Subject: [PATCH 04/18] remove key added with yunohost on install and upgarde script --- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index ec67600..d8c46ac 100644 --- a/scripts/install +++ b/scripts/install @@ -120,9 +120,9 @@ fi # 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; -key=$(ynh_string_random --length=50) +# key=$(ynh_string_random --length=50) # edit 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" +# ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" if [ "$path_url" == "/" ]; then ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" else diff --git a/scripts/upgrade b/scripts/upgrade index a708b02..d21dccf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -155,9 +155,9 @@ ynh_add_fpm_config #================================================= ynh_script_progression --message="final configuration needed..." --time --weight=1 -key=$(ynh_string_random --length=50) +# 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" +# ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" if [ "$path_url" == "/" ] then ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" From 4224b4c904b45a7f6737891a209910defface310 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 28 Aug 2020 16:13:34 +0200 Subject: [PATCH 05/18] keep a key added by yunohost for script install only --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index d8c46ac..ec67600 100644 --- a/scripts/install +++ b/scripts/install @@ -120,9 +120,9 @@ fi # 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; -# key=$(ynh_string_random --length=50) +key=$(ynh_string_random --length=50) # edit 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" +ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" if [ "$path_url" == "/" ]; then ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" else From 649a74f3e2cef6b5a200716fbabc08e4ac9eac4b Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 28 Aug 2020 16:24:53 +0200 Subject: [PATCH 06/18] comment the key added with the install script --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index d21dccf..d585519 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -155,7 +155,7 @@ ynh_add_fpm_config #================================================= ynh_script_progression --message="final configuration needed..." --time --weight=1 -# key=$(ynh_string_random --length=50) +# 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" if [ "$path_url" == "/" ] From 3423f5718817aef38ba8627b864cd3f090074012 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 28 Aug 2020 16:40:06 +0200 Subject: [PATCH 07/18] keep backup if exist of config.local.php --- scripts/upgrade | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d585519..3b3cb6d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,6 +71,7 @@ ynh_script_progression --message="Backing up the data before upgrading (may take bdd=$final_path/association.sqlite squelettes=$final_path/www/squelettes +config=$final_path/config.local.php if [ -d "$squelettes" ]; then cp -ar $squelettes /tmp/squelettes @@ -80,6 +81,10 @@ if [ -e "$bdd" ]; then cp -a $bdd /tmp/association.sqlite fi +if [ -e "$config" ]; then + cp -a $config /tmp/config +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -153,17 +158,17 @@ ynh_add_fpm_config # Change options in file config.dist.php # and copy in local.dist.php #================================================= -ynh_script_progression --message="final configuration needed..." --time --weight=1 +# ynh_script_progression --message="final configuration needed..." --time --weight=1 # key=$(ynh_string_random --length=50) -cp -a $final_path/config.dist.php $final_path/config.local.php +# 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" -if [ "$path_url" == "/" ] -then - ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" -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 +# if [ "$path_url" == "/" ] +# then +# ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" +# 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 #======================================================= # backup bdd, squelettes directory and config.local.php #======================================================= @@ -171,6 +176,7 @@ ynh_script_progression --message="restore data..." --time --weight=1 backup_bdd=/tmp/association.sqlite backup_squelettes=/tmp/squelettes +backup_config=/tmp/config if [ -d "$backup_squelettes" ] then @@ -182,6 +188,21 @@ then cp -a $backup_bdd $final_path/association.sqlite fi +if [ -e "$backup_config" ] +then + cp -a $backup_config $final_path/config.local.php +else + 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" + if [ "$path_url" == "/" ] + then + ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" + 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 +fi + #================================================= # Files owned by user app #================================================= From 1f773435808178a3a2285a72f59ec5ff24363042 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 28 Aug 2020 17:38:05 +0200 Subject: [PATCH 08/18] try debug nginx conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index c319377..f8e5244 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -28,7 +28,7 @@ if ($scheme = http) { try_files $uri $uri/ /_route.php; fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; - # fastcgi_index index.php; + fastcgi_index index.php; include fastcgi_params; fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; From da38439ccfe9925ec672974b12796c607e813feb Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Wed, 2 Sep 2020 16:46:27 +0200 Subject: [PATCH 09/18] change source package for update --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index cba27f0..01152be 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-0.9.8.tar.bz2 -SOURCE_SUM=8a703936de30b45501ab759f0e1cae6623a96e562873d7c5fa24d233488a5945 +SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-0.9.8.1.tar.bz2 +SOURCE_SUM=7cc64b51c9721c2dd7ee510f245bcfc4693ee07f74581ad74003906eb4716ef1 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true From 90a3b251fbbd0ee85018fbdcfcad0cdba5b3e894 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Wed, 2 Sep 2020 16:58:21 +0200 Subject: [PATCH 10/18] add version 0.9.8.1 in manifest --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 3a253d4..5068dea 100644 --- a/manifest.json +++ b/manifest.json @@ -10,7 +10,7 @@ "fr": "Logiciel libre de gestion d'association" }, - "version": "0.9.8~ynh3", + "version": "0.9.8.1~ynh3", "url": "http://garradin.eu/a-propos/", "license": "GPL-3.0-or-later", From 58e2d8ea1ed70aea8cf118ddf1c89b33d57c222c Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Thu, 24 Sep 2020 14:48:57 +0200 Subject: [PATCH 11/18] version updated --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8d5a715..0475fe4 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview Garradin is a free association managing software. -**Shipped version:** 0.9.6 +**Shipped version:** 0.9.8.1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 15e9157..cc0254e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install ## Vue d'ensemble Garradin est un logiciel libre de gestion associative. il permet de gérer des membres. -**Version incluse :** 0.9.6 +**Version incluse :** 0.9.8.1 ## Captures d'écran diff --git a/manifest.json b/manifest.json index 5068dea..147e7e8 100644 --- a/manifest.json +++ b/manifest.json @@ -9,9 +9,7 @@ "en": "Software to manage association", "fr": "Logiciel libre de gestion d'association" }, - - "version": "0.9.8.1~ynh3", - + "version": "0.9.8.1~ynh3", "url": "http://garradin.eu/a-propos/", "license": "GPL-3.0-or-later", "maintainer": { From 5a748643c092a31ade36387cee1e6563302fe40e Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Thu, 24 Sep 2020 23:40:05 +0200 Subject: [PATCH 12/18] try to have avatiable for php version, syntax for weigth, add a constant in config.local.php --- README.md | 8 +++--- README_fr.md | 7 ++--- conf/nginx.conf | 18 ++++++------- conf/php-fpm.conf | 2 +- manifest.json | 4 +-- scripts/_common.sh | 52 ++++++++++++++++++++---------------- scripts/backup | 10 +++---- scripts/change_url | 8 +++--- scripts/install | 22 ++++++++-------- scripts/remove | 14 +++++----- scripts/restore | 29 ++++++++++---------- scripts/upgrade | 66 ++++++++++++++-------------------------------- 12 files changed, 108 insertions(+), 132 deletions(-) diff --git a/README.md b/README.md index 0475fe4..e0d3834 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# Garradin +# 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.png)](https://install-app.yunohost.org/?app=garradin) *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Garradin quickly and simply on a YunoHost server. +> *This package allows you to install Garradin 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 @@ -27,7 +27,7 @@ Garradin is a free association managing software. ## Documentation - + * Official documentation: https://fossil.kd2.org/garradin/wiki?name=Documentation ## YunoHost specific features diff --git a/README_fr.md b/README_fr.md index cc0254e..5376a12 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,11 +1,11 @@ -# Garradin +# 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) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer REPLACEBYYOURAPP rapidement et simplement sur un serveur YunoHost. +> *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.* ## Vue d'ensemble @@ -45,9 +45,6 @@ Garradin est un logiciel libre de gestion associative. il permet de gérer des m * 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. -**Plus d'informations sur la page de documentation :** -https://yunohost.org/packaging_apps - ## Liens * Signaler un bug : https://github.com/YunoHost-Apps/garradin_ynh/issues diff --git a/conf/nginx.conf b/conf/nginx.conf index f8e5244..84bd542 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,12 +1,5 @@ location __PATH__ { -# Path to source -alias __FINALPATH__/www/; - -if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - # Protecting sensibles urls location ~ 403 { rewrite ^(.*)$ /include/ redirect; @@ -19,10 +12,17 @@ if ($scheme = http) { rewrite ^(.*)$ /config\.(.*)\.php redirect; } +# Path to source +alias __FINALPATH__/www/; + +if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + + # Example PHP configuration (remove if not used) index index.php /_route.php; - try_files $uri $uri/ index.php /_route.php; - + try_files $uri $uri/ /_route.php; location ~ [^/]\.php(/|$) { try_files $uri $uri/ /_route.php; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 3f4bc72..0626fd8 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php$YNH_PHP_VERSION-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. A value of '-1' means unlimited. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index 147e7e8..372d3f3 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "id": "garradin", "packaging_format": 1, "requirements": { - "yunohost": ">=3.7.0" + "yunohost": ">=3.7.1" }, "description": { "en": "Software to manage association", @@ -19,7 +19,7 @@ "multi_instance": true, "services": [ "nginx", - "php7.0-fpm" + "php$YNH_PHP_VERSION-fpm" ], "arguments": { "install" : [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 768fbe1..9904210 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,10 +3,10 @@ #================================================= # COMMON VARIABLES #================================================= - +echo $(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") = "phpversion" +YNH_PHP_VERSION="phpversion" # dependencies used by the app - -pkg_dependencies="php-sqlite3" +pkg_dependencies="php$YNH_PHP_VERSION-sqlite3" # ============= FUTURE YUNOHOST HELPER ============= @@ -22,25 +22,31 @@ pkg_dependencies="php-sqlite3" # example: ynh_permission_has_user --permission=main --user=visitors # # Requires YunoHost version 3.7.1 or higher. -ynh_permission_has_user() { - local legacy_args=pu - # Declare an array to define the options of this helper. - declare -Ar args_array=( [p]=permission= [u]=user= ) - local permission - local user - # Manage arguments with getopts - ynh_handle_getopts_args "$@" +# ynh_permission_has_user() { +# local legacy_args=pu +# # Declare an array to define the options of this helper. +# declare -Ar args_array=( [p]=permission= [u]=user= ) +# local permission +# local user +# # Manage arguments with getopts +# ynh_handle_getopts_args "$@" - if ! ynh_permission_exists --permission=$permission - then - return 1 - fi +# if ! ynh_permission_exists --permission=$permission +# then +# return 1 +# fi +#================================================= +# EXPERIMENTAL HELPERS +#================================================= - # List all permissions - # Filter only the required permission with a multiline sed (Here a cut from the permission to the next one), remove the url and his value - perm="$(yunohost user permission list --full --output-as plain | sed --quiet "/^#$app.$permission/,/^#[[:alnum:]]/p" | sed "/^##url/,+1d")" - # Remove all lines starting by # (got from the plain output before) - allowed_users="$(echo "$perm" | grep --invert-match '^#')" - # Grep the list of users an return the result if the user is indeed into the list - echo "$allowed_users" | grep --quiet --word "$user" -} +# # List all permissions +# # Filter only the required permission with a multiline sed (Here a cut from the permission to the next one), remove the url and his value +# perm="$(yunohost user permission list --full --output-as plain | sed --quiet "/^#$app.$permission/,/^#[[:alnum:]]/p" | sed "/^##url/,+1d")" +# # Remove all lines starting by # (got from the plain output before) +# allowed_users="$(echo "$perm" | grep --invert-match '^#')" +# # Grep the list of users an return the result if the user is indeed into the list +# echo "$allowed_users" | grep --quiet --word "$user" +# } +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 27102aa..67b04de 100644 --- a/scripts/backup +++ b/scripts/backup @@ -20,7 +20,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -32,23 +32,23 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." --time --weight=1 +ynh_script_progression --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Backing up php-fpm configuration..." -ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index d112cdc..353d613 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -50,7 +50,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating nginx web server configuration..." --weight=5 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf final_path=/var/www/$app @@ -90,7 +90,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload @@ -101,4 +101,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index ec67600..b54b211 100644 --- a/scripts/install +++ b/scripts/install @@ -28,7 +28,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 +ynh_script_progression --message="Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -44,7 +44,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --weight=1 +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain @@ -53,14 +53,14 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # Install dependency to convert tracks to a readable format for the browser #================================================= -ynh_script_progression --message="Installing dependencies..." --time --weight=1 +ynh_script_progression --message="Installing dependencies..." --weight=10 ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user ynh_system_user_create --username=$app @@ -68,24 +68,23 @@ ynh_system_user_create --username=$app #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --time --weight=1 +ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" - #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +ynh_script_progression --message="Configuring nginx web server..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 +ynh_script_progression --message="Configuring php-fpm..." --weight=20 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -102,7 +101,7 @@ ynh_app_setting_delete --app=$app --key=skipped_uris #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --time --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=8 # Make app public if necessary if [ $is_public -eq 1 ] @@ -123,6 +122,7 @@ cp -a $final_path/config.dist.php $final_path/config.local.php key=$(ynh_string_random --length=50) # edit 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" +ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = '/var/www/garradin';" --target_file="$final_path/config.local.php" if [ "$path_url" == "/" ]; then ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" else @@ -132,7 +132,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." systemctl reload nginx @@ -140,4 +140,4 @@ systemctl reload nginx # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last \ No newline at end of file +ynh_script_progression --message="Installation of $app completed" --last \ No newline at end of file diff --git a/scripts/remove b/scripts/remove index aac63fd..55ae2da 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME @@ -22,7 +22,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --time --weight=1 +ynh_script_progression --message="Removing dependencies..." --time --weight=10 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -30,7 +30,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing app main directory..." --time --weight=3 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -38,7 +38,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config @@ -46,7 +46,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=2 # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -56,7 +56,7 @@ ynh_remove_fpm_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=2 # Delete a system user ynh_system_user_delete --username=$app @@ -65,4 +65,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last \ No newline at end of file +ynh_script_progression --message="Removal of $app completed" --last \ No newline at end of file diff --git a/scripts/restore b/scripts/restore index 53d9726..0504490 100644 --- a/scripts/restore +++ b/scripts/restore @@ -20,7 +20,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --time --weight=1 +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=4 ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -49,14 +49,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 +ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file "$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app @@ -68,35 +68,34 @@ ynh_system_user_create --username=$app # Restore permissions on app files chown -R $app:$app $final_path -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restore php-fpm configuration..." --time --weight=1 - -ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" - #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=10 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restore php-fpm configuration..." --weight=30 + +ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 -ynh_systemd_action --service_name=php7.0-fpm --action=reload +ynh_systemd_action --service_name=php$YNH_PHP_VERSION-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last \ No newline at end of file +ynh_script_progression --message="Restoration completed for $app" --last \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index 3b3cb6d..4c706c0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=3 app=$YNH_APP_INSTANCE_NAME @@ -34,7 +34,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." # If final_path doesn't exist, create it if [ -z "$final_path" ]; then @@ -67,11 +67,10 @@ fi #================================================= # Backup Data #================================================= -ynh_script_progression --message="Backing up the data before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the data before upgrading (may take a while)..." --weight=30 bdd=$final_path/association.sqlite squelettes=$final_path/www/squelettes -config=$final_path/config.local.php if [ -d "$squelettes" ]; then cp -ar $squelettes /tmp/squelettes @@ -81,14 +80,10 @@ if [ -e "$bdd" ]; then cp -a $bdd /tmp/association.sqlite fi -if [ -e "$config" ]; then - cp -a $config /tmp/config -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=30 # Backup the current version of the app ynh_backup_before_upgrade @@ -114,7 +109,7 @@ ynh_abort_if_errors #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --time --weight=1 +ynh_script_progression --message="Upgrading source files..." if [ "$upgrade_type" == "UPGRADE_APP" ] then @@ -125,14 +120,14 @@ fi #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 +ynh_script_progression --message="Upgrading dependencies..." --time --weight=5 ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create --username=$app @@ -141,7 +136,7 @@ ynh_system_user_create --username=$app #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config @@ -149,34 +144,18 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 # Create a dedicated php-fpm config ynh_add_fpm_config -#================================================= -# Change options in file config.dist.php -# and copy in local.dist.php -#================================================= -# ynh_script_progression --message="final configuration needed..." --time --weight=1 - -# 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" -# if [ "$path_url" == "/" ] -# then -# ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" -# 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 #======================================================= # backup bdd, squelettes directory and config.local.php #======================================================= -ynh_script_progression --message="restore data..." --time --weight=1 +ynh_script_progression --message="restore data..." --weight=10 backup_bdd=/tmp/association.sqlite backup_squelettes=/tmp/squelettes -backup_config=/tmp/config if [ -d "$backup_squelettes" ] then @@ -188,19 +167,14 @@ then cp -a $backup_bdd $final_path/association.sqlite fi -if [ -e "$backup_config" ] -then - cp -a $backup_config $final_path/config.local.php +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" +ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="'/var/www/garradin';" --target_file="$final_path/config.local.php" +if [ "$path_url" == "/" ]; then +ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" else - 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" - if [ "$path_url" == "/" ] - then - ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" - 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 +ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php" fi #================================================= @@ -214,7 +188,7 @@ chmod 755 $final_path -R #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Upgrading permissions configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading permissions configuration..." --weight=2 # Create the visitors permission if needed if ! ynh_permission_exists --permission "visitors"; then @@ -224,11 +198,11 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last \ No newline at end of file +ynh_script_progression --message="Upgrade of $app completed" --last \ No newline at end of file From 73855697578a7c1f5ce372be26eac44f6adf1191 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 25 Sep 2020 00:10:13 +0200 Subject: [PATCH 13/18] forget and delete variale --- conf/php-fpm.conf | 2 +- manifest.json | 2 +- scripts/_common.sh | 9 ++++++--- scripts/backup | 2 +- scripts/restore | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 0626fd8..3f4bc72 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php$YNH_PHP_VERSION-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. A value of '-1' means unlimited. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index 372d3f3..adb9921 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ "multi_instance": true, "services": [ "nginx", - "php$YNH_PHP_VERSION-fpm" + "php7.0-fpm" ], "arguments": { "install" : [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 9904210..b6eaf62 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,10 +3,13 @@ #================================================= # COMMON VARIABLES #================================================= -echo $(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") = "phpversion" -YNH_PHP_VERSION="phpversion" # dependencies used by the app -pkg_dependencies="php$YNH_PHP_VERSION-sqlite3" +if +ynh_get_debian_release = "buster"; then +pkg_dependencies="php7.3-sqlite3" +else +pkg_dependencies="php7.0-sqlite3" +fi # ============= FUTURE YUNOHOST HELPER ============= diff --git a/scripts/backup b/scripts/backup index 67b04de..e6dfc95 100644 --- a/scripts/backup +++ b/scripts/backup @@ -48,7 +48,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Backing up php-fpm configuration..." -ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 0504490..199d043 100644 --- a/scripts/restore +++ b/scripts/restore @@ -83,7 +83,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= ynh_script_progression --message="Restore php-fpm configuration..." --weight=30 -ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # GENERIC FINALIZATION #================================================= @@ -91,7 +91,7 @@ ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" #================================================= ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 -ynh_systemd_action --service_name=php$YNH_PHP_VERSION-fpm --action=reload +ynh_systemd_action --service_name=php7.0-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= From 6b73c5f75a974d3faca43046dd328d65ba8a516b Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 25 Sep 2020 00:41:35 +0200 Subject: [PATCH 14/18] delete --time --- scripts/backup | 2 +- scripts/remove | 4 ++-- scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/backup b/scripts/backup index e6dfc95..29a9167 100644 --- a/scripts/backup +++ b/scripts/backup @@ -53,4 +53,4 @@ ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last diff --git a/scripts/remove b/scripts/remove index 55ae2da..a51df4f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -30,7 +30,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=3 +ynh_script_progression --message="Removing app main directory..." --weight=3 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -46,7 +46,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=2 +ynh_script_progression --message="Removing php-fpm configuration..." --weight=2 # Remove the dedicated php-fpm config ynh_remove_fpm_config diff --git a/scripts/upgrade b/scripts/upgrade index 4c706c0..98339c4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -120,7 +120,7 @@ fi #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=5 +ynh_script_progression --message="Upgrading dependencies..." --weight=5 ynh_install_app_dependencies $pkg_dependencies From 2a3e96d634e49c0ceb6c27fb43b80eb08328ee8e Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Fri, 25 Sep 2020 01:28:54 +0200 Subject: [PATCH 15/18] delete the command ynh_get_deian-release is not found in the file_common.sh ecause the helpers aren't sourced and so keep the package dependency without php version --- scripts/_common.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index b6eaf62..36d6e2b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,12 +4,8 @@ # COMMON VARIABLES #================================================= # dependencies used by the app -if -ynh_get_debian_release = "buster"; then -pkg_dependencies="php7.3-sqlite3" -else -pkg_dependencies="php7.0-sqlite3" -fi + +pkg_dependencies="php-sqlite3" # ============= FUTURE YUNOHOST HELPER ============= From d6f4e2f2937c9d24b9865f269741696f9dbc036d Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sun, 27 Sep 2020 23:02:11 +0200 Subject: [PATCH 16/18] add configuration nginx to enable redirection on urls and a condition in package dependencies for debian versions if or not buster --- conf/nginx.conf | 2 +- scripts/_common.sh | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 84bd542..7b3376b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -21,7 +21,7 @@ if ($scheme = http) { # Example PHP configuration (remove if not used) - index index.php /_route.php; + index index.php index.html; try_files $uri $uri/ /_route.php; location ~ [^/]\.php(/|$) { diff --git a/scripts/_common.sh b/scripts/_common.sh index 36d6e2b..c4ff904 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,11 @@ # COMMON VARIABLES #================================================= # dependencies used by the app - -pkg_dependencies="php-sqlite3" +if [ "$lsb_release --codename --short" = "buster"]; then + pkg_dependencies="php7.3-sqlite3" +else [ "$lsb_release --codename --short" = "stretch"]; then + pkg_dependencies="php7.0-sqlite3" +fi # ============= FUTURE YUNOHOST HELPER ============= From 281aed7f6a6ffa82ce522ac44d61d290696b57a7 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Mon, 28 Sep 2020 00:41:11 +0200 Subject: [PATCH 17/18] remove a blank line --- conf/nginx.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 7b3376b..e07a530 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,7 +19,6 @@ if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } - # Example PHP configuration (remove if not used) index index.php index.html; try_files $uri $uri/ /_route.php; From 5ef87897584bc3ed3dfa3050b279ab0f1dbed578 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Mon, 28 Sep 2020 00:49:07 +0200 Subject: [PATCH 18/18] correct bad syntax in _common.sh --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c4ff904..54847ea 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ # dependencies used by the app if [ "$lsb_release --codename --short" = "buster"]; then pkg_dependencies="php7.3-sqlite3" -else [ "$lsb_release --codename --short" = "stretch"]; then +else [ "$lsb_release --codename --short" = "stretch"] pkg_dependencies="php7.0-sqlite3" fi