mirror of
https://github.com/YunoHost-Apps/limesurvey_ynh.git
synced 2024-09-03 19:36:32 +02:00
Merge pull request #58 from YunoHost-Apps/testing
Apply last example_ynh
This commit is contained in:
commit
73fa31321a
17 changed files with 236 additions and 210 deletions
19
.gitattributes
vendored
19
.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
||||||
# Set default behaviour, in case users don't have core.autocrlf set.
|
|
||||||
* text=auto
|
|
||||||
|
|
||||||
# Declare files that will always have LF line endings on checkout.
|
|
||||||
*.php text eol=lf
|
|
||||||
*.css text eol=lf
|
|
||||||
*.js text eol=lf
|
|
||||||
*.pstpl text eol=lf
|
|
||||||
*.html text eol=lf
|
|
||||||
*.sql text eol=lf
|
|
||||||
*.txt text eol=lf
|
|
||||||
*.lss text eol=lf
|
|
||||||
|
|
||||||
# Denote all files that are truly binary and should not be modified.
|
|
||||||
*.jpg binary
|
|
||||||
*.png binary
|
|
||||||
*.gif binary
|
|
||||||
*.ico binary
|
|
||||||
*.mo binary
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
|
|
25
README.md
25
README.md
|
@ -5,7 +5,7 @@ It shall NOT be edited by hand.
|
||||||
|
|
||||||
# LimeSurvey for YunoHost
|
# LimeSurvey for YunoHost
|
||||||
|
|
||||||
[![Integration level](https://dash.yunohost.org/integration/limesurvey.svg)](https://dash.yunohost.org/appci/app/limesurvey) ![](https://ci-apps.yunohost.org/ci/badges/limesurvey.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/limesurvey.maintain.svg)
|
[![Integration level](https://dash.yunohost.org/integration/limesurvey.svg)](https://dash.yunohost.org/appci/app/limesurvey) ![Working status](https://ci-apps.yunohost.org/ci/badges/limesurvey.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/limesurvey.maintain.svg)
|
||||||
[![Install LimeSurvey with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=limesurvey)
|
[![Install LimeSurvey with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=limesurvey)
|
||||||
|
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
@ -17,13 +17,11 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
Create and distribute surveys
|
Create and distribute surveys
|
||||||
|
|
||||||
**Shipped version:** 5.2.6~ynh2
|
**Shipped version:** 5.2.6~ynh3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
![](./doc/screenshots/create_html_statistic_screen.png)
|
![Screenshot of LimeSurvey](./doc/screenshots/create_html_statistic_screen.png)
|
||||||
|
|
||||||
## Disclaimers / important information
|
## Disclaimers / important information
|
||||||
|
|
||||||
|
@ -32,22 +30,23 @@ Create and distribute surveys
|
||||||
* The application is integrated with YunoHost accounts (LDAP database)
|
* The application is integrated with YunoHost accounts (LDAP database)
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: https://www.limesurvey.org
|
* Official app website: <https://www.limesurvey.org>
|
||||||
* Official user documentation: https://help.limesurvey.org
|
* Official user documentation: <https://help.limesurvey.org>
|
||||||
* Official admin documentation: https://manual.limesurvey.org/LimeSurvey_Manual/fr
|
* Official admin documentation: <https://manual.limesurvey.org/LimeSurvey_Manual/fr>
|
||||||
* Upstream app code repository: https://github.com/LimeSurvey/LimeSurvey
|
* Upstream app code repository: <https://github.com/LimeSurvey/LimeSurvey>
|
||||||
* YunoHost documentation for this app: https://yunohost.org/app_limesurvey
|
* YunoHost documentation for this app: <https://yunohost.org/app_limesurvey>
|
||||||
* Report a bug: https://github.com/YunoHost-Apps/limesurvey_ynh/issues
|
* Report a bug: <https://github.com/YunoHost-Apps/limesurvey_ynh/issues>
|
||||||
|
|
||||||
## Developer info
|
## Developer info
|
||||||
|
|
||||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing).
|
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing).
|
||||||
|
|
||||||
To try the testing branch, please proceed like that.
|
To try the testing branch, please proceed like that.
|
||||||
```
|
|
||||||
|
``` bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
|
||||||
or
|
or
|
||||||
sudo yunohost app upgrade limesurvey -u https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
|
sudo yunohost app upgrade limesurvey -u https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||||
|
|
31
README_fr.md
31
README_fr.md
|
@ -1,10 +1,14 @@
|
||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
|
||||||
# LimeSurvey pour YunoHost
|
# LimeSurvey pour YunoHost
|
||||||
|
|
||||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/limesurvey.svg)](https://dash.yunohost.org/appci/app/limesurvey) ![](https://ci-apps.yunohost.org/ci/badges/limesurvey.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/limesurvey.maintain.svg)
|
[![Niveau d'intégration](https://dash.yunohost.org/integration/limesurvey.svg)](https://dash.yunohost.org/appci/app/limesurvey) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/limesurvey.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/limesurvey.maintain.svg)
|
||||||
[![Installer LimeSurvey avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=limesurvey)
|
[![Installer LimeSurvey avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=limesurvey)
|
||||||
|
|
||||||
*[Read this readme in english.](./README.md)*
|
*[Read this readme in english.](./README.md)*
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
|
||||||
|
|
||||||
> *Ce package vous permet d'installer LimeSurvey rapidement et simplement sur un serveur YunoHost.
|
> *Ce package vous permet d'installer LimeSurvey 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.*
|
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||||
|
@ -13,13 +17,11 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
||||||
|
|
||||||
Outil de création et diffusion de sondage
|
Outil de création et diffusion de sondage
|
||||||
|
|
||||||
**Version incluse :** 5.2.6~ynh2
|
**Version incluse :** 5.2.6~ynh3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Captures d'écran
|
## Captures d'écran
|
||||||
|
|
||||||
![](./doc/screenshots/create_html_statistic_screen.png)
|
![Capture d'écran de LimeSurvey](./doc/screenshots/create_html_statistic_screen.png)
|
||||||
|
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
|
@ -28,22 +30,23 @@ Outil de création et diffusion de sondage
|
||||||
* The application is integrated with YunoHost accounts (LDAP database)
|
* The application is integrated with YunoHost accounts (LDAP database)
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l'app : https://www.limesurvey.org
|
* Site officiel de l'app : <https://www.limesurvey.org>
|
||||||
* Documentation officielle utilisateur : https://help.limesurvey.org
|
* Documentation officielle utilisateur : <https://help.limesurvey.org>
|
||||||
* Documentation officielle de l'admin : https://manual.limesurvey.org/LimeSurvey_Manual/fr
|
* Documentation officielle de l'admin : <https://manual.limesurvey.org/LimeSurvey_Manual/fr>
|
||||||
* Dépôt de code officiel de l'app : https://github.com/LimeSurvey/LimeSurvey
|
* Dépôt de code officiel de l'app : <https://github.com/LimeSurvey/LimeSurvey>
|
||||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_limesurvey
|
* Documentation YunoHost pour cette app : <https://yunohost.org/app_limesurvey>
|
||||||
* Signaler un bug : https://github.com/YunoHost-Apps/limesurvey_ynh/issues
|
* Signaler un bug : <https://github.com/YunoHost-Apps/limesurvey_ynh/issues>
|
||||||
|
|
||||||
## Informations pour les développeurs
|
## Informations pour les développeurs
|
||||||
|
|
||||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing).
|
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing).
|
||||||
|
|
||||||
Pour essayer la branche testing, procédez comme suit.
|
Pour essayer la branche testing, procédez comme suit.
|
||||||
```
|
|
||||||
|
``` bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
|
||||||
ou
|
ou
|
||||||
sudo yunohost app upgrade limesurvey -u https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
|
sudo yunohost app upgrade limesurvey -u https://github.com/YunoHost-Apps/limesurvey_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
path="/path"
|
path="/path"
|
||||||
admin="john"
|
|
||||||
language="en"
|
language="en"
|
||||||
|
admin="john"
|
||||||
|
password="1Strong-Password"
|
||||||
is_admin_public=1
|
is_admin_public=1
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
|
@ -13,8 +14,10 @@
|
||||||
setup_private=0
|
setup_private=0
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
#3.17.1
|
# 3.17.1~ynh1
|
||||||
upgrade=1 from_commit=da4959616e67f89ef907a223f7c84607dc4771e5
|
upgrade=1 from_commit=da4959616e67f89ef907a223f7c84607dc4771e5
|
||||||
|
# 5.2.6~ynh2
|
||||||
|
upgrade=1 from_commit=58cac7dfc0d0b835898d56238e550c775be7255b
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
|
|
@ -2,5 +2,6 @@ SOURCE_URL=https://github.com/LimeSurvey/LimeSurvey/archive/refs/tags/5.2.6+2112
|
||||||
SOURCE_SUM=d097af55794000d87ad8f88698597f6cba2e972499819d3f4bd55748f1de1765
|
SOURCE_SUM=d097af55794000d87ad8f88698597f6cba2e972499819d3f4bd55748f1de1765
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FILENAME=limesurvey.tar.gz
|
SOURCE_FILENAME=limesurvey.tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
||||||
|
|
|
@ -28,10 +28,10 @@ return array(
|
||||||
'db' => array(
|
'db' => array(
|
||||||
'connectionString' => 'mysql:host=localhost;port=3306;dbname=__DB_NAME__;',
|
'connectionString' => 'mysql:host=localhost;port=3306;dbname=__DB_NAME__;',
|
||||||
'emulatePrepare' => true,
|
'emulatePrepare' => true,
|
||||||
'username' => '__DB_NAME__',
|
'username' => '__DB_USER__',
|
||||||
'password' => '__DB_PWD__',
|
'password' => '__DB_PWD__',
|
||||||
'charset' => 'utf8mb4',
|
'charset' => 'utf8mb4',
|
||||||
'tablePrefix' => 'lime_',
|
'tablePrefix' => '__PREFIX__',
|
||||||
),
|
),
|
||||||
|
|
||||||
'emcache' => array('class' => 'CFileCache'),
|
'emcache' => array('class' => 'CFileCache'),
|
||||||
|
@ -65,7 +65,7 @@ return array(
|
||||||
// 'use_asset_manager'=>true, // Uncomment if you want to use debug mode and asset manager at the same time
|
// 'use_asset_manager'=>true, // Uncomment if you want to use debug mode and asset manager at the same time
|
||||||
'enableLdap' => true,
|
'enableLdap' => true,
|
||||||
'force_ssl' => true,
|
'force_ssl' => true,
|
||||||
'uploaddir' => '__DATADIR__'
|
'uploaddir' => '__DATADIR__/upload'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
/* End of file config.php */
|
/* End of file config.php */
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
UPDATE lime_plugins SET active=1 WHERE name="AuthLDAP";
|
UPDATE __PREFIX__plugins SET active=1 WHERE name="AuthLDAP";
|
||||||
|
|
||||||
INSERT INTO `lime_permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES
|
INSERT INTO `__PREFIX__permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES
|
||||||
(2,'global',0,2,'auth_ldap',0,1,0,0,0,0),
|
(2,'global',0,2,'auth_ldap',0,1,0,0,0,0),
|
||||||
(3,'global',0,2,'surveys',1,0,0,0,0,0);
|
(3,'global',0,2,'surveys',1,0,0,0,0,0);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES
|
INSERT INTO `__PREFIX__plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES
|
||||||
(2, 5, NULL, NULL, 'server', '\"ldap:\\/\\/localhost\"'),
|
(2, 5, NULL, NULL, 'server', '\"ldap:\\/\\/localhost\"'),
|
||||||
(3, 5, NULL, NULL, 'ldapport', '\"\"'),
|
(3, 5, NULL, NULL, 'ldapport', '\"\"'),
|
||||||
(4, 5, NULL, NULL, 'ldapversion', '\"3\"'),
|
(4, 5, NULL, NULL, 'ldapversion', '\"3\"'),
|
||||||
|
@ -35,6 +35,6 @@ INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key
|
||||||
#(24, 7, NULL, NULL, 'serverkey', '"REMOTE_USER"'),
|
#(24, 7, NULL, NULL, 'serverkey', '"REMOTE_USER"'),
|
||||||
#(25, 7,NULL,NULL,'is_default','\"1\"');
|
#(25, 7,NULL,NULL,'is_default','\"1\"');
|
||||||
|
|
||||||
INSERT INTO `lime_settings_global` VALUES
|
INSERT INTO `__PREFIX__settings_global` VALUES
|
||||||
('defaultlang','__LANGUAGE__'),
|
('defaultlang','__LANGUAGE__'),
|
||||||
('AssetsVersion','30214');
|
('AssetsVersion','30214');
|
||||||
|
|
|
@ -1,37 +1,32 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
|
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __FINALPATH__/ ;
|
alias __FINALPATH__/;
|
||||||
|
|
||||||
more_set_headers "X-Frame-Options : ALLOWALL";
|
more_set_headers "X-Frame-Options : ALLOWALL";
|
||||||
|
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
# if (!-e $request_filename)
|
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
||||||
#{
|
client_max_body_size 50M;
|
||||||
# rewrite ^(.+)$ __PATH__/index.php?q=$1 last;
|
|
||||||
#}
|
|
||||||
|
|
||||||
client_max_body_size 50m;
|
try_files $uri $uri/ index.php;
|
||||||
|
location ~ [^/]\.php(/|$) {
|
||||||
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
|
|
||||||
try_files $uri $uri/ index.php;
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
location ~ [^/]\.php(/|$) {
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
|
}
|
||||||
fastcgi_index index.php;
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^__PATH__/(data|config|\.ht|db_structure\.xml|README) {
|
location ~ ^__PATH__/(data|config|\.ht|db_structure\.xml|README) {
|
||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Create and distribute surveys",
|
"en": "Create and distribute surveys",
|
||||||
"fr": "Outil de création et diffusion de sondage"
|
"fr": "Outil de création et diffusion de sondage"
|
||||||
},
|
},
|
||||||
"version": "5.2.6~ynh2",
|
"version": "5.2.6~ynh3",
|
||||||
"url": "https://www.limesurvey.org/",
|
"url": "https://www.limesurvey.org/",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "GPL-2.0+",
|
"license": "GPL-2.0+",
|
||||||
|
@ -42,10 +42,6 @@
|
||||||
"example": "/poll",
|
"example": "/poll",
|
||||||
"default": "/poll"
|
"default": "/poll"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"type": "user"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "language",
|
"name": "language",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -168,6 +164,14 @@
|
||||||
],
|
],
|
||||||
"default": "en"
|
"default": "en"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"type": "user"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "password",
|
||||||
|
"type": "password"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "is_admin_public",
|
"name": "is_admin_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
@ -176,10 +180,6 @@
|
||||||
"fr": "En mode privé, seuls les utilisateurs YunoHost autorisés peuvent créer un sondage. En mode public, il est possible de créer un sondage avec un compte Limesurvey mais sans compte YunoHost."
|
"fr": "En mode privé, seuls les utilisateurs YunoHost autorisés peuvent créer un sondage. En mode public, il est possible de créer un sondage avec un compte Limesurvey mais sans compte YunoHost."
|
||||||
},
|
},
|
||||||
"default": true
|
"default": true
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "password",
|
|
||||||
"type": "password"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ PKG_DIR=$(cd ../; pwd)
|
||||||
|
|
||||||
YNH_PHP_VERSION="7.3"
|
YNH_PHP_VERSION="7.3"
|
||||||
|
|
||||||
|
# dependencies used by the app
|
||||||
pkg_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-imap python3-pip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring"
|
pkg_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-imap python3-pip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
true
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -25,10 +28,10 @@ ynh_print_info --message="Loading installation settings..."
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -41,6 +44,12 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE DATA DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="$datadir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -60,13 +69,6 @@ ynh_print_info --message="Backing up the MySQL database..."
|
||||||
|
|
||||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE DATA DIRECTORY
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Backing up data directory..."
|
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -67,6 +67,8 @@ then
|
||||||
change_path=1
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -96,6 +98,8 @@ then
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALISATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
true
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -22,13 +25,15 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
|
||||||
is_admin_public=$YNH_APP_ARG_IS_ADMIN_PUBLIC
|
|
||||||
language=$YNH_APP_ARG_LANGUAGE
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
|
is_admin_public=$YNH_APP_ARG_IS_ADMIN_PUBLIC
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
prefix=lime_
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -47,8 +52,9 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
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=language --value=$language
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
|
ynh_app_setting_set --app=$app --key=prefix --value=$prefix
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -89,9 +95,15 @@ ynh_setup_source --dest_dir="$final_path"
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
chmod 750 "$final_path/tmp"
|
|
||||||
chmod 750 "$final_path/upload"
|
#=================================================
|
||||||
chmod 750 "$final_path/application/config/"
|
# PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated PHP-FPM config
|
||||||
|
ynh_add_fpm_config
|
||||||
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -101,55 +113,55 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
|
||||||
ynh_add_fpm_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE THE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||||
|
|
||||||
datadir=/home/yunohost.app/limesurvey/upload
|
datadir=/home/yunohost.app/$app
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||||
mkdir -p $datadir
|
|
||||||
|
mkdir -p $datadir/upload
|
||||||
|
|
||||||
# Remove upload if empty
|
# Remove upload if empty
|
||||||
rmdir $datadir 2> /dev/null && mv "$final_path/upload" $datadir || true
|
rmdir $datadir 2> /dev/null && mv "$final_path/upload" $datadir || true
|
||||||
chown -R $app:www-data "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
chmod -R o-rwx "$datadir"
|
||||||
ln -s $datadir $final_path/upload 2> /dev/null || true
|
chown -R $app:www-data "$datadir"
|
||||||
|
ln -s $datadir/upload $final_path/upload 2> /dev/null || true
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring Limesurvey..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.php" --destination="$final_path/application/config/config.php"
|
ynh_add_config --template="../conf/config.php" --destination="$final_path/application/config/config.php"
|
||||||
|
|
||||||
|
chmod 400 "$final_path/application/config/config.php"
|
||||||
|
chown $app:$app "$final_path/application/config/config.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL
|
# INSTALL APP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing app..."
|
||||||
|
|
||||||
ls_cli=$final_path/application/commands/console.php
|
ls_cli=$final_path/application/commands/console.php
|
||||||
|
|
||||||
fullname=$(ynh_user_get_info "$admin" "fullname")
|
fullname=$(ynh_user_get_info --username="$admin" --key="fullname")
|
||||||
mail=$(ynh_user_get_info "$admin" "mail")
|
mail=$(ynh_user_get_info --username="$admin" --key="mail")
|
||||||
|
|
||||||
# Permission should be correctly set before to do this
|
# Permission should be correctly set before to do this
|
||||||
ynh_exec_as "$app" php $ls_cli install "$admin" "$password" "$fullname" "$mail"
|
ynh_exec_as "$app" php$phpversion $ls_cli install "$admin" "$password" "$fullname" "$mail"
|
||||||
|
|
||||||
# Permission should be correctly set before to do this
|
# Permission should be correctly set before to do this
|
||||||
#ynh_exec_as "$app" php $ls_cli install "$admin" "$(ynh_string_random 24)" "$fullname" "$mail"
|
#ynh_exec_as "$app" php$phpversion $ls_cli install "$admin" "$(ynh_string_random 24)" "$fullname" "$mail"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SQL SPECIFIC CONFIG
|
# LOAD SQL SPECIFIC CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading SQL specific config..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/data.sql" --destination="./data.sql"
|
ynh_add_config --template="../conf/data.sql" --destination="./data.sql"
|
||||||
|
|
||||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./data.sql
|
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./data.sql
|
||||||
|
@ -157,30 +169,30 @@ ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name
|
||||||
ynh_secure_remove --file=./data.sql
|
ynh_secure_remove --file=./data.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Add nice themes
|
# ADD NICE THEMES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
#ynh_script_progression --message="Adding nice themes..."
|
||||||
|
|
||||||
#ynh_setup_source "$datadir/upload/templates/libreform" libreform
|
#ynh_setup_source "$datadir/upload/templates/libreform" libreform
|
||||||
#ynh_setup_source "$final_path/upload/templates/librepoll" librepoll
|
#ynh_setup_source "$final_path/upload/templates/librepoll" librepoll
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP FAIL2BAN
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
# No message in logs and the apps contains already a 10 minutes ban policy
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
|
# Everyone can access the app.
|
||||||
|
# The "main" permission is automatically created before the install script.
|
||||||
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
|
|
||||||
if [ $is_admin_public -eq 1 ]
|
if [ $is_admin_public -eq 1 ]
|
||||||
then
|
then
|
||||||
allowed_groups="visitors $admin"
|
allowed_groups="visitors $admin"
|
||||||
else
|
else
|
||||||
allowed_groups="$admin"
|
allowed_groups="$admin"
|
||||||
fi
|
fi
|
||||||
ynh_permission_update --permission="main" --show_tile="false" --add="visitors"
|
|
||||||
|
|
||||||
ynh_permission_create --permission="admin" --url="/admin" --allowed=$allowed_groups --show_tile="true"
|
ynh_permission_create --permission="admin" --url="/admin" --allowed=$allowed_groups --show_tile="true"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC STARTING
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -24,14 +24,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MYSQL DATABASE
|
# REMOVE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -41,7 +33,7 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1
|
||||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MAIN DIR OF THE APP
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||||
|
|
||||||
|
@ -56,11 +48,11 @@ ynh_secure_remove --file="$final_path"
|
||||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing app data directory..." --weight=1
|
ynh_script_progression --message="Removing app data directory..." --weight=1
|
||||||
ynh_secure_remove --file="$datadir"
|
ynh_secure_remove --file="$datadir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
|
@ -75,6 +67,16 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
|
||||||
# Remove the dedicated PHP-FPM config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
true
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -27,11 +30,10 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -43,13 +45,6 @@ test ! -d $final_path \
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -68,15 +63,20 @@ ynh_restore_file --origin_path="$final_path"
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
chmod 755 "$final_path/tmp"
|
|
||||||
chmod 755 "$final_path/application/config/"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
|
ynh_script_progression --message="Restoring the data directory..." --weight=2
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||||
|
|
||||||
|
mkdir -p "$datadir/upload"
|
||||||
|
|
||||||
|
chmod 750 "$datadir"
|
||||||
|
chmod -R o-rwx "$datadir"
|
||||||
|
chown -R $app:www-data "$datadir"
|
||||||
|
ln -s $datadir/upload $final_path/upload 2> /dev/null || true
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
@ -88,6 +88,20 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -97,19 +111,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE DATA DIRECTORY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring data directory..." --weight=2
|
|
||||||
|
|
||||||
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
|
||||||
|
|
||||||
mkdir -p "$datadir"
|
|
||||||
chown -R $app:www-data "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
ln -s $datadir $final_path/upload 2> /dev/null || true
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
101
scripts/upgrade
101
scripts/upgrade
|
@ -20,16 +20,18 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
db_user=$db_name
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
|
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
prefix=$(ynh_app_setting_get --app=$app --key=prefix)
|
||||||
prefix=$(ynh_app_setting_get $app prefix)
|
is_admin_public=$(ynh_app_setting_get --app=$app --key=is_admin_public)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Checking version..."
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
@ -41,12 +43,14 @@ ynh_script_progression --message="Backing up $app before upgrading (may take a w
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -54,43 +58,56 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# If db_name doesn't exist, create it
|
# If db_name doesn't exist, create it
|
||||||
if [ -z "$db_name" ]; then
|
if [ -z "$db_name" ]; then
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
# If final_path doesn't exist, create it
|
||||||
if [ -z "$final_path" ]; then
|
if [ -z "$final_path" ]; then
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If prefix doesn't exist, create it
|
||||||
|
if [ -z "$prefix" ]; then
|
||||||
|
prefix="lime_"
|
||||||
|
ynh_app_setting_set --app=$app --key=prefix --value=$prefix
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If datadir doesn't exist, create it
|
# If datadir doesn't exist, create it
|
||||||
if [ -z "$datadir" ]; then
|
if [ -z "$datadir" ]; then
|
||||||
datadir=/home/yunohost.app/$app/upload
|
datadir=/home/yunohost.app/$app/upload
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||||
mkdir -p $datadir
|
mkdir -p $datadir
|
||||||
# Remove upload if empty
|
# Remove upload if empty
|
||||||
rmdir $datadir 2> /dev/null && mv "$final_path/upload" $datadir || true
|
rmdir $datadir 2> /dev/null && mv "$final_path/upload" $datadir || true
|
||||||
chown -R $app:www-data "$datadir"
|
chown -R $app:www-data "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
chmod -R o-rwx "$datadir"
|
||||||
ln -s $datadir $final_path/upload
|
ln -s $datadir/upload $final_path/upload
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
# Cleaning legacy permissions
|
||||||
if ynh_legacy_permissions_exists; then
|
if ynh_legacy_permissions_exists; then
|
||||||
ynh_legacy_permissions_delete_all
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_admin_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ynh_permission_exists --permission="admin"; then
|
if ! ynh_permission_exists --permission="admin"; then
|
||||||
# Create the required permissions
|
# Create the required permissions
|
||||||
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
if [ $is_admin_public -eq 1 ]
|
||||||
|
then
|
||||||
|
allowed_groups="visitors $admin"
|
||||||
|
else
|
||||||
|
allowed_groups="$admin"
|
||||||
|
fi
|
||||||
|
ynh_permission_create --permission="admin" --url="/admin" --allowed=$allowed_groups --show_tile="true"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a permission if needed
|
# Create a permission if needed
|
||||||
if ! ynh_permission_exists --permission="api"; then
|
if ! ynh_permission_exists --permission="api"; then
|
||||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
|
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -101,18 +118,16 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path" --keep="$(echo $final_path/plugins/*) $final_path/application/config/config.php $final_path/upload"
|
ynh_setup_source --dest_dir="$final_path" --keep="$(echo $final_path/plugins/*) $final_path/application/config/config.php $final_path/upload"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
|
@ -122,15 +137,7 @@ chmod 750 "$final_path/tmp"
|
||||||
chmod 750 "$final_path/application/config/"
|
chmod 750 "$final_path/application/config/"
|
||||||
chown -R $app:www-data "$datadir"
|
chown -R $app:www-data "$datadir"
|
||||||
chmod 750 $datadir
|
chmod 750 $datadir
|
||||||
ln -s $datadir $final_path/upload 2> /dev/null || true
|
ln -s $datadir/upload $final_path/upload 2> /dev/null || true
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
|
@ -148,19 +155,35 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring Limesurvey..." --weight=1
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
|
#=================================================
|
||||||
|
# UPDATE A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.php" --destination="$final_path/application/config/config.php"
|
ynh_add_config --template="../conf/config.php" --destination="$final_path/application/config/config.php"
|
||||||
|
|
||||||
|
chmod 400 "$final_path/application/config/config.php"
|
||||||
|
chown $app:$app "$final_path/application/config/config.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DB
|
# UPGRADE DB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading DB..."
|
||||||
|
|
||||||
# Migrate DB
|
# Migrate DB
|
||||||
ynh_exec_as "$app" php $final_path/application/commands/console.php updatedb
|
ynh_exec_as "$app" php$phpversion $final_path/application/commands/console.php updatedb
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue