mirror of
https://github.com/YunoHost-Apps/bozon_ynh.git
synced 2024-09-03 18:16:09 +02:00
commit
d67d242d43
19 changed files with 446 additions and 380 deletions
63
README.md
63
README.md
|
@ -1,64 +1,45 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
# BoZoN for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/bozon.svg)](https://dash.yunohost.org/appci/app/bozon) ![](https://ci-apps.yunohost.org/ci/badges/bozon.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/bozon.maintain.svg)
|
||||
[![Install BoZoN with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=bozon)
|
||||
[![Integration level](https://dash.yunohost.org/integration/bozon.svg)](https://dash.yunohost.org/appci/app/bozon) ![Working status](https://ci-apps.yunohost.org/ci/badges/bozon.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/bozon.maintain.svg)
|
||||
[![Install BoZoN with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=bozon)
|
||||
|
||||
> *This package allows you to install BoZoN quickly and simply on a YunoHost server.
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allows you to install BoZoN 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
|
||||
|
||||
BoZoN is a minimalist Drag & drop file sharing app.
|
||||
|
||||
**Shipped version:** 2.4.18
|
||||
|
||||
**Shipped version:** 2.4.18~ynh2
|
||||
|
||||
## Screenshots
|
||||
|
||||
![](sources/bozon_screenshot.png)
|
||||
![Screenshot of BoZoN](./doc/screenshots/bozon_screenshot.png)
|
||||
|
||||
## Configuration
|
||||
## Documentation and resources
|
||||
|
||||
How to configure this app: From an admin panel, a plain file with SSH, or any other way.
|
||||
|
||||
## Documentation
|
||||
|
||||
* Official documentation: Link to the official documentation of this app
|
||||
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
#### Multi-user support
|
||||
|
||||
* Are LDAP and HTTP auth supported?
|
||||
* Can the app be used by multiple users?
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bozon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/bozon/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/bozon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/bozon/)
|
||||
|
||||
## Limitations
|
||||
|
||||
* Any known limitations.
|
||||
|
||||
## Additional information
|
||||
|
||||
* Other info you would like to add about this app.
|
||||
|
||||
## Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/bozon_ynh/issues
|
||||
* Upstream app repository: https://github.com/broncowdd/BoZoN
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
* Upstream app code repository: <https://github.com/broncowdd/BoZoN>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_bozon>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/bozon_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/bozon_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/bozon_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade bozon -u https://github.com/YunoHost-Apps/bozon_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
45
README_fr.md
Normal file
45
README_fr.md
Normal file
|
@ -0,0 +1,45 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
# BoZoN pour YunoHost
|
||||
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/bozon.svg)](https://dash.yunohost.org/appci/app/bozon) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/bozon.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/bozon.maintain.svg)
|
||||
[![Installer BoZoN avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=bozon)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
|
||||
> *Ce package vous permet d'installer BoZoN rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
BoZoN is a minimalist Drag & drop file sharing app.
|
||||
|
||||
|
||||
**Version incluse :** 2.4.18~ynh2
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![Capture d'écran de BoZoN](./doc/screenshots/bozon_screenshot.png)
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Dépôt de code officiel de l'app : <https://github.com/broncowdd/BoZoN>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_bozon>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/bozon_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/bozon_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/bozon_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade bozon -u https://github.com/YunoHost-Apps/bozon_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
|
@ -1,20 +1,17 @@
|
|||
;; Test complet (bozon=sans bdd)
|
||||
auto_remove=1
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
is_public=1
|
||||
language="fr"
|
||||
filesize="2G"
|
||||
admin="john" (USER)
|
||||
password="super_secret_password" (PASSWORD)
|
||||
backup_core_only=1
|
||||
admin="john"
|
||||
password="super_secret_password"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=03e787291ba1104f195fdeb5103071b9546b4ad5
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
SOURCE_URL=https://github.com/broncowdd/BoZoN/archive/ce0265e0dd13bc1e3cbbf0d96b846f65d1a17173.zip
|
||||
SOURCE_SUM=42e8e81771cb3489297a75138a69cf83c82edc3e6ea5988b8d436254ac502b1b
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
|
||||
#sha256sum obtain with shasum -a 256 $SOURCE_URL
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
||||
|
|
125
conf/nginx.conf
125
conf/nginx.conf
|
@ -1,67 +1,64 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
# Path to source
|
||||
alias __FINALPATH__/;
|
||||
|
||||
# Force usage of https
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
# Add headers to serve security related headers
|
||||
more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;";
|
||||
more_set_headers "X-Content-Type-Options: nosniff";
|
||||
more_set_headers "X-XSS-Protection: 1; mode=block";
|
||||
more_set_headers "X-Robots-Tag: none";
|
||||
more_set_headers "X-Download-Options: noopen";
|
||||
more_set_headers "X-Permitted-Cross-Domain-Policies: none";
|
||||
more_set_headers "Referrer-Policy: no-referrer";
|
||||
|
||||
# Set max upload size
|
||||
client_max_body_size 10G;
|
||||
fastcgi_buffers 64 4K;
|
||||
client_body_timeout 60m;
|
||||
proxy_read_timeout 60m;
|
||||
|
||||
# Disable gzip to avoid the removal of the ETag header
|
||||
gzip off;
|
||||
|
||||
index index.php;
|
||||
try_files $uri $uri/ index.php;
|
||||
|
||||
location ~ [^/]\.php(/|$) {
|
||||
include fastcgi_params;
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
fastcgi_param HTTPS on;
|
||||
fastcgi_param modHeadersAvailable true;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_read_timeout 60m;
|
||||
fastcgi_send_timeout 60m;
|
||||
}
|
||||
|
||||
location ^~ __PATH__/(uploads|thumbs){
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ^~ __PATH__/private {
|
||||
deny all;
|
||||
location ~* __PATH__/private/temp/.*\.zip$ {
|
||||
allow all;
|
||||
}
|
||||
}
|
||||
|
||||
location ^~ __PATH__/core {
|
||||
deny all;
|
||||
location ~* __PATH__/core/.*\.js$ {
|
||||
allow all;
|
||||
}
|
||||
}
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/;
|
||||
|
||||
# Add headers to serve security related headers
|
||||
more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;";
|
||||
more_set_headers "X-Content-Type-Options: nosniff";
|
||||
more_set_headers "X-XSS-Protection: 1; mode=block";
|
||||
more_set_headers "X-Robots-Tag: none";
|
||||
more_set_headers "X-Download-Options: noopen";
|
||||
more_set_headers "X-Permitted-Cross-Domain-Policies: none";
|
||||
more_set_headers "Referrer-Policy: no-referrer";
|
||||
|
||||
# Set max upload size
|
||||
client_max_body_size 10G;
|
||||
fastcgi_buffers 64 4K;
|
||||
client_body_timeout 60m;
|
||||
proxy_read_timeout 60m;
|
||||
|
||||
# Disable gzip to avoid the removal of the ETag header
|
||||
gzip off;
|
||||
|
||||
index index.php;
|
||||
|
||||
try_files $uri $uri/ index.php;
|
||||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
|
||||
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;
|
||||
fastcgi_param HTTPS on;
|
||||
fastcgi_param modHeadersAvailable true;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_read_timeout 60m;
|
||||
fastcgi_send_timeout 60m;
|
||||
}
|
||||
|
||||
location ^~ __PATH__/(uploads|thumbs){
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ^~ __PATH__/private {
|
||||
deny all;
|
||||
location ~* __PATH__/private/temp/.*\.zip$ {
|
||||
allow all;
|
||||
}
|
||||
}
|
||||
|
||||
location ^~ __PATH__/core {
|
||||
deny all;
|
||||
location ~* __PATH__/core/.*\.js$ {
|
||||
allow all;
|
||||
}
|
||||
}
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ group = __USER__
|
|||
; (IPv6 and IPv4-mapped) on a 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__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
|
||||
|
||||
; Set listen(2) backlog.
|
||||
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
|||
BoZoN is a minimalist Drag & drop file sharing app.
|
0
doc/DISCLAIMER.md
Normal file
0
doc/DISCLAIMER.md
Normal file
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
Before Width: | Height: | Size: 240 KiB After Width: | Height: | Size: 240 KiB |
|
@ -6,77 +6,49 @@
|
|||
"en": "Minimalist Drag & drop file sharing app",
|
||||
"fr": "Application minimaliste de partage de fichiers"
|
||||
},
|
||||
"version": "2.4.18~ynh2",
|
||||
"url": "https://github.com/broncowdd/BoZoN",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0",
|
||||
"code": "https://github.com/broncowdd/BoZoN"
|
||||
},
|
||||
"license": "AGPL-3.0",
|
||||
"version": "2.4.18~ynh1",
|
||||
"maintainer": {
|
||||
"name": "ewilly",
|
||||
"email": "ewilly@neuf.fr"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.8.1"
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.0-fpm"
|
||||
"php7.3-fpm"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for BoZoN",
|
||||
"fr": "Choisissez un domaine pour BoZoN"
|
||||
},
|
||||
"example": "domain.org"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for BoZoN",
|
||||
"fr": "Choisissez un chemin pour BoZoN"
|
||||
},
|
||||
"example": "/bozon",
|
||||
"default": "/bozon"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Should this application be public? (if not, sharing file with unregistered users will still work)",
|
||||
"fr": "Est-ce que cette application doit être visible publiquement ? (dans le cas contraire, le partage de fichiers avec des utilisateurs externes fonctionnera tout de même)"
|
||||
},
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose an admin user for BoZoN",
|
||||
"fr": "Choisissez un administrateur pour BoZoN"
|
||||
},
|
||||
"example": "homer"
|
||||
"type": "user"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Choose an admin password for BoZoN",
|
||||
"fr": "Choisissez un mot de passe administrateur pour BoZoN"
|
||||
},
|
||||
"example": "super_secret_password"
|
||||
},
|
||||
{
|
||||
"name": "backup_core_only",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "When backing up, should only the core of the app be backed up? (uploaded files to BoZoN such as videos, pictures, documents, etc. will not be backed up)",
|
||||
"fr": "En cas de sauvegarde, doit-être uniquement sauvegardé le cœur de l'application ? (les fichiers transférés dans BoZoN tels que les vidéos, images, documents, etc. ne seront pas sauvegardés)"
|
||||
},
|
||||
"default": true
|
||||
"type": "password"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="php-zip php-curl php-gd"
|
||||
pkg_dependencies="php$YNH_DEFAULT_PHP_VERSION-zip php$YNH_DEFAULT_PHP_VERSION-curl php$YNH_DEFAULT_PHP_VERSION-gd"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Check if directory/file already exists (path in argument)
|
||||
myynh_check_path () {
|
||||
[ -z "$1" ] && ynh_die --message="No argument supplied"
|
||||
|
@ -31,12 +32,12 @@ myynh_clean_source () {
|
|||
myynh_set_permissions () {
|
||||
[ $(find "$final_path" -type f | wc -l) -gt 0 ] && find "$final_path" -type f | xargs chmod 0644
|
||||
[ $(find "$final_path" -type d | wc -l) -gt 0 ] && find "$final_path" -type d | xargs chmod 0755
|
||||
[ $(find "$data_path" -type f | wc -l) -gt 0 ] && find "$data_path" -type f | xargs chmod 0644
|
||||
[ $(find "$data_path" -type d | wc -l) -gt 0 ] && find "$data_path" -type d | xargs chmod 0755
|
||||
chown -R root:"$app" "$final_path"
|
||||
chown -R "$app": "$final_path/private"
|
||||
chown -R "$app": "$data_path"
|
||||
chown root: "$data_path"
|
||||
[ $(find "$datadir" -type f | wc -l) -gt 0 ] && find "$datadir" -type f | xargs chmod 0644
|
||||
[ $(find "$datadir" -type d | wc -l) -gt 0 ] && find "$datadir" -type d | xargs chmod 0755
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
}
|
||||
|
||||
#Convert --data to --data-urlencode before ynh_local_curl
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
#!/bin/bash
|
||||
# to test the functionnality :
|
||||
# yunohost backup create -n "bozon-test" --apps bozon
|
||||
# yunohost backup delete bozon-test
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -21,44 +18,48 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app="$app" --key=data_path)
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the main app directory..."
|
||||
if [ -e "$final_path" ]; then
|
||||
ynh_backup --src_path="$final_path"
|
||||
fi
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
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..."
|
||||
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||
|
||||
##=================================================
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIRECTORY
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up data directory..."
|
||||
if [ -e "$data_path" ]; then
|
||||
backup_core_only=$(ynh_app_setting_get "$app" backup_core_only)
|
||||
if [ $backup_core_only -eq 0 ]; then
|
||||
ynh_backup --src_path="$data_path" --is_big
|
||||
else
|
||||
echo "Data dir will not be saved, because backup_core_only is set to true." >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -12,34 +12,36 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
# definie useful vars
|
||||
old_nginx_conf="/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
||||
new_nginx_conf="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
new_path=$(ynh_normalize_url_path --path_url="$new_path")
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1
|
||||
# backup the current version of the app
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
# restore it if the upgrade fails
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -48,12 +50,16 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]; then
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]; then
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
fi
|
||||
|
||||
|
@ -62,42 +68,42 @@ 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=1
|
||||
|
||||
# Change the path in the nginx config file
|
||||
if [ $change_path -eq 1 ]; then
|
||||
# Make a backup of the original nginx config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$old_nginx_conf"
|
||||
# Set global variables for nginx helper
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
if [ "$path_url" != "/" ]; then
|
||||
ynh_replace_string --match_string="^#sub_path_only" --replace_string="" --target_file="$old_nginx_conf"
|
||||
fi
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="$old_nginx_conf"
|
||||
fi
|
||||
|
||||
# Change the domain for nginx
|
||||
if [ $change_domain -eq 1 ]; then
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$old_nginx_conf"
|
||||
mv "$old_nginx_conf" "$new_nginx_conf"
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="$new_nginx_conf"
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
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
|
||||
|
|
104
scripts/install
104
scripts/install
|
@ -18,27 +18,28 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
backup_core_only=$YNH_APP_ARG_BACKUP_CORE_ONLY
|
||||
|
||||
# definie useful vars
|
||||
final_path="/var/www/$app"
|
||||
data_path="/home/yunohost.app/$app"
|
||||
path_url=$(ynh_normalize_url_path --path_url="$path_url")
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
## check domain/path availability
|
||||
|
||||
final_path=/var/www/$app
|
||||
datadir="/home/yunohost.app/$app"
|
||||
path_url=$(ynh_normalize_url_path --path_url="$path_url")
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
## register (book) web path
|
||||
ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
## check that admin user is an existing account
|
||||
ynh_user_exists --username="$admin"
|
||||
|
||||
|
@ -46,13 +47,12 @@ ynh_user_exists --username="$admin"
|
|||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
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=is_public --value=$is_public
|
||||
ynh_app_setting_set --app="$app" --key=admin_user --value="$admin"
|
||||
ynh_app_setting_set --app="$app" --key=backup_core_only --value=$backup_core_only
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
ynh_app_setting_set --app="$app" --key=data_path --value="$data_path"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=admin_user --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=final_path --value="$final_path"
|
||||
ynh_app_setting_set --app=$app --key=datadir --value="$datadir"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -60,59 +60,83 @@ ynh_app_setting_set --app="$app" --key=data_path --value="$data_path"
|
|||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=3
|
||||
ynh_install_app_dependencies "$pkg_dependencies"
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
ynh_system_user_create --username="$app"
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=3
|
||||
|
||||
## download source
|
||||
tmpdir=$(mktemp -d)
|
||||
ynh_setup_source --dest_dir="$tmpdir"
|
||||
## clean & copy files needed to final folder
|
||||
myynh_clean_source
|
||||
mv "$tmpdir" "$final_path"
|
||||
## create private & data folders
|
||||
myynh_create_dir "$final_path/private"
|
||||
myynh_create_dir "$data_path/uploads"
|
||||
myynh_create_dir "$data_path/thumbs"
|
||||
ln -s "$data_path/uploads" "$final_path/uploads"
|
||||
ln -s "$data_path/thumbs" "$final_path/thumbs"
|
||||
## set permissions
|
||||
myynh_set_permissions
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..."
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring nginx web server..."
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
if [ "$path_url" != "/" ]; then
|
||||
ynh_replace_string --match_string="^#sub_path_only" --replace_string="" --target_file="../conf/nginx.conf"
|
||||
fi
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring php-fpm..."
|
||||
ynh_add_fpm_config
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
mkdir -p $datadir
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
## create private & data folders
|
||||
myynh_create_dir "$final_path/private"
|
||||
myynh_create_dir "$datadir/uploads"
|
||||
myynh_create_dir "$datadir/thumbs"
|
||||
ln -s "$datadir/uploads" "$final_path/uploads"
|
||||
ln -s "$datadir/thumbs" "$final_path/thumbs"
|
||||
## set permissions
|
||||
myynh_set_permissions
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
# create admin user in bozon
|
||||
ynh_script_progression --message="Configuring admin user in BoZon..." --weight=2
|
||||
## set the app as temporarily public for curl call
|
||||
ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
|
||||
## reload SSOwat config
|
||||
yunohost app ssowatconf
|
||||
## reload Nginx
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
# Set the app as temporarily public for curl call
|
||||
ynh_script_progression --message="Configuring SSOwat..."
|
||||
# Making the app public for curl
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
||||
## fill the superadmin creation form (helper ynh_local_curl doesn't work due to --data vs --data-urlencode ?)
|
||||
admin_url="/index.php?p=login"
|
||||
admin=$(myynh_urlencode $admin)
|
||||
|
@ -127,21 +151,23 @@ ynh_print_ON
|
|||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..."
|
||||
|
||||
if [ $is_public -eq 0 ]; then
|
||||
# escape magic chars in vars (lua magic chars are ().%+-*?[^$ according to https://www.lua.org/pil/20.2.html)
|
||||
domainluaregex=$(echo "$domain" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g')
|
||||
pathluaregex=$([ "$path_url" == "/" ] || echo "$path_url" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g')
|
||||
regexList="${domainluaregex}${pathluaregex}/index%.php$","${domainluaregex}${pathluaregex}/index%.php%?p=.*$"
|
||||
ynh_app_setting_set --app="$app" --key=protected_regex --value="$regexList"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#!/bin/bash
|
||||
# to test the functionnality :
|
||||
# yunohost app remove bozon
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -14,41 +13,57 @@ source /usr/share/yunohost/helpers
|
|||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app="$app" --key=data_path)
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Remove the data directory if --purge option is used
|
||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing app data directory..."
|
||||
ynh_secure_remove --file="$datadir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing php-fpm configuration..." --weight=1
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_secure_remove --file="$data_path"
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -56,9 +71,12 @@ ynh_secure_remove --file="$data_path"
|
|||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
ynh_system_user_delete --username="$app"
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
#!/bin/bash
|
||||
# to test the functionnality :
|
||||
# yunohost backup create -n "bozon-test" --apps bozon
|
||||
# yunohost app remove bozon
|
||||
# yunohost backup restore "bozon-test"
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -23,43 +20,48 @@ ynh_abort_if_errors
|
|||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||
backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app="$app" --key=data_path)
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
ynh_webpath_available --domain="$domain" --path_url="$path_url" || ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path"
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
ynh_system_user_create --username="$app"
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
|
||||
mkdir -p $datadir
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
|
@ -67,26 +69,28 @@ ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
|||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIR
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=2
|
||||
if [ ! -d "$data_path" ]; then
|
||||
if [ $backup_core_only -eq 0 ]; then
|
||||
ynh_restore_file --origin_path="$data_path"
|
||||
else
|
||||
myynh_create_dir "$data_path/uploads"
|
||||
myynh_create_dir "$data_path/thumbs"
|
||||
fi
|
||||
else
|
||||
echo "$data_path already exists and will not be overwritten" >&2
|
||||
fi
|
||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
|
||||
|
||||
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..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
myynh_set_permissions
|
||||
|
||||
#=================================================
|
||||
|
@ -94,12 +98,13 @@ myynh_set_permissions
|
|||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
|
||||
ynh_systemd_action --service_name=php7.0-fpm --action=reload
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
|
|
144
scripts/upgrade
144
scripts/upgrade
|
@ -1,11 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
set -eu
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -13,54 +13,76 @@ source /usr/share/yunohost/helpers
|
|||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
|
||||
admin_user=$(ynh_app_setting_get --app="$app" --key=admin_user)
|
||||
backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only)
|
||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app="$app" --key=data_path)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path="/var/www/$app"
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
fi
|
||||
# If data_path doesn't exist, create it
|
||||
if [ -z "$data_path" ]; then
|
||||
data_path="/home/yunohost.app/$app"
|
||||
ynh_app_setting_set --app="$app" --key=data_path --value="$data_path"
|
||||
fi
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin_user=$(ynh_app_setting_get --app=$app --key=admin_user)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
|
||||
if [ -f "/etc/yunohost/apps/$app/scripts/backup" ]; then
|
||||
ynh_backup_before_upgrade # Backup the current version of the app
|
||||
ynh_clean_setup () {
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
fi
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path="/var/www/$app"
|
||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
||||
fi
|
||||
# If datadir doesn't exist, create it
|
||||
if [ -z "$datadir" ]; then
|
||||
datadir="/home/yunohost.app/$app"
|
||||
ynh_app_setting_set --app="$app" --key=datadir --value="$datadir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
# download & unpack bozon
|
||||
ynh_script_progression --message="Setting up source files..." --weight=2
|
||||
## download source
|
||||
|
@ -71,68 +93,60 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
|||
[ -e "$tmpdir/config.php" ] && ynh_secure_remove "$tmpdir/config.php"
|
||||
cp -a "$tmpdir/." "$final_path"
|
||||
ynh_secure_remove "$tmpdir"
|
||||
## set permissions
|
||||
myynh_set_permissions
|
||||
fi
|
||||
|
||||
## set permissions
|
||||
myynh_set_permissions
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading nginx web server configuration..."
|
||||
|
||||
if [ "$path_url" != "/" ]; then
|
||||
ynh_replace_string --match_string="^#sub_path_only" --replace_string="" --target_file="../conf/nginx.conf"
|
||||
fi
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
ynh_system_user_create --username="$app"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading php-fpm configuration..."
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..."
|
||||
if [ $is_public -eq 0 ]; then
|
||||
# escape magic chars in vars (lua magic chars are ().%+-*?[^$ according to https://www.lua.org/pil/20.2.html)
|
||||
domainluaregex=$(echo "$domain" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g')
|
||||
pathluaregex=$([ "$path_url" == "/" ] || echo "$path_url" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g')
|
||||
regexList="${domainluaregex}${pathluaregex}/index%.php$","${domainluaregex}${pathluaregex}/index%.php%?p=.*$"
|
||||
ynh_app_setting_set --app="$app" --key=protected_regex --value="$regexList"
|
||||
else
|
||||
ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
|
||||
fi
|
||||
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# CLEAN PHP SESSIONS STORED IN /var/lib/phpx/sessions
|
||||
#=================================================
|
||||
ynh_script_progression --message="Cleaning php sessions stored..."
|
||||
|
||||
if [ -d "/usr/lib/php5" ]; then
|
||||
[ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean
|
||||
elif [ -d "/usr/lib/php" ]; then
|
||||
[ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..."
|
||||
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" --last
|
||||
|
|
Loading…
Reference in a new issue