mirror of
https://github.com/YunoHost-Apps/jirafeau_ynh.git
synced 2024-09-03 19:35:53 +02:00
Add rights (#90)
This commit is contained in:
parent
bdc4f95f33
commit
8275615365
14 changed files with 187 additions and 181 deletions
57
README.md
57
README.md
|
@ -1,3 +1,8 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Jirafeau for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/jirafeau.svg)](https://dash.yunohost.org/appci/app/jirafeau) ![](https://ci-apps.yunohost.org/ci/badges/jirafeau.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/jirafeau.maintain.svg)
|
||||
|
@ -5,53 +10,43 @@
|
|||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allow you to install Jirafeau quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||
> *This package allows you to install Jirafeau 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
|
||||
|
||||
Jirafeau is a web site permitting to upload a file in a simple way and give an unique link to it.
|
||||
Jirafeau offers the possibility to host and share your files with ease. Choose a file, Jirafeau will provide you with a link with many options. It is possible to protect your links with a password as well as to choose how long the file will be kept on the server. The file and the link will self-destruct after this time. Downloads of transmitted files can be limited to a certain date, and each file can self-destruct after the first download. Jirafeau allows you to configure maximum retention times and maximum size per file. Encryption is available as an option.
|
||||
|
||||
**Shipped version:** 4.3.0
|
||||
|
||||
**Shipped version:** 4.3.0~ynh2
|
||||
|
||||
**Demo:** https://demo.yunohost.org/jirafeau/
|
||||
|
||||
## Screenshots
|
||||
|
||||
![](http://i.imgur.com/TPjh48P.png)
|
||||
![](./doc/screenshots/TPjh48P.png)
|
||||
|
||||
## Demo
|
||||
|
||||
* [YunoHost demo](https://demo.yunohost.org/jirafeau/)
|
||||
## Disclaimers / important information
|
||||
|
||||
## Configuration
|
||||
|
||||
## Documentation
|
||||
### Changing the conditions of use of the service
|
||||
|
||||
* Official documentation:
|
||||
* YunoHost documentation: https://yunohost.org/en/app_jirafeau
|
||||
The license text on the "Terms of Service" page, which is shipped with the default installation, is "based on the Open Source Initiative Terms of Service". To change this text simply copy the file `/lib/tos.original.txt`, rename it to `/lib/tos.local.txt` and adapt it to your own needs. If you update the installation, then only the `tos.original.txt` file may change eventually, not your `tos.local.txt file`.
|
||||
|
||||
## YunoHost specific features
|
||||
## Administration
|
||||
|
||||
#### Supported architectures
|
||||
To administer the files within Jirafeau it is enough to go to the address `jirafeau.domaine.tld/admin.php`.
|
||||
## Documentation and resources
|
||||
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jirafeau.svg)](https://ci-apps.yunohost.org/ci/apps/jirafeau/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jirafeau.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jirafeau/)
|
||||
* Official app website: https://gitlab.com/mojo42/Jirafeau
|
||||
* Upstream app code repository: https://gitlab.com/mojo42/Jirafeau
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_jirafeau
|
||||
* Report a bug: https://github.com/YunoHost-Apps/jirafeau_ynh/issues
|
||||
|
||||
## Limitations
|
||||
## Developer info
|
||||
|
||||
## Additional information
|
||||
|
||||
## Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/jirafeau_ynh/issues
|
||||
* Jirafeau website: https://gitlab.com/mojo42/Jirafeau
|
||||
* Upstream app repository: https://gitlab.com/mojo42/Jirafeau
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
|
||||
## Developers info
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/jirafeau_ynh/tree/testing).
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/jirafeau_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
@ -59,3 +54,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/jirafeau_ynh/tree/tes
|
|||
or
|
||||
sudo yunohost app upgrade jirafeau -u https://github.com/YunoHost-Apps/jirafeau_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
45
README_fr.md
45
README_fr.md
|
@ -4,50 +4,41 @@
|
|||
[![Installer Jirafeau avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=jirafeau)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Jirafeau 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
|
||||
|
||||
Jirafeau est un site web permettant d'héberger et de partager des fichiers de manière simple en leur donnant un lien unique.
|
||||
Jirafeau offre la possibilité d'héberger et de partager vos fichiers, le tout en toute simplicité. Choisissez un fichier, Jirafeau vous fournira un lien avec beaucoup d'options. Il est possible de protéger vos liens avec mot de passe ainsi que de choisir la durée de rétention du fichier sur le serveur. Le fichier et le lien s'autodétruiront passé ce délai. Les téléchargements des fichiers transmis peuvent être limités à une certaine date, et chaque fichier peut s'autodétruire après le premier téléchargement. Jirafeau permet de configurer les temps maximum de rétention ainsi que la taille maximale par fichier. Le chiffrement est disponible en option.
|
||||
|
||||
**Version incluse :** 4.3.0
|
||||
|
||||
**Version incluse :** 4.3.0~ynh2
|
||||
|
||||
**Démo :** https://demo.yunohost.org/jirafeau/
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![](http://i.imgur.com/TPjh48P.png)
|
||||
![](./doc/screenshots/TPjh48P.png)
|
||||
|
||||
## Démo
|
||||
|
||||
* [Démo officielle](https://demo.yunohost.org/jirafeau/)
|
||||
## Avertissements / informations importantes
|
||||
|
||||
## Configuration
|
||||
|
||||
## Documentation
|
||||
### Changer les conditions d'utilisation du service
|
||||
|
||||
* Documentation officielle :
|
||||
* Documentation YunoHost : https://yunohost.org/fr/app_jirafeau
|
||||
Le texte de la licence sur la page "Conditions d'utilisation du service", qui est livrée avec l'installation par défaut, est basé sur les "Conditions d'utilisation du service de l'Initiative Open Source". Pour modifier ce texte, il suffit de copier le fichier `/lib/tos.original.txt`, de le renommer en `/lib/tos.local.txt` et de l'adapter à vos propres besoins. Si vous mettez à jour l'installation, alors seul le fichier `tos.original.txt` peut changer éventuellement, et non votre fichier `tos.local.txt`.
|
||||
|
||||
## Caractéristiques spécifiques YunoHost
|
||||
## Administration
|
||||
|
||||
#### Architectures supportées
|
||||
Pour administrer les fichiers présents au sein de Jirafeau il suffit de se rendre à l'adresse `jirafeau.domaine.tld/admin.php`.
|
||||
## Documentations et ressources
|
||||
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jirafeau.svg)](https://ci-apps.yunohost.org/ci/apps/jirafeau/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jirafeau.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jirafeau/)
|
||||
|
||||
## Limitations
|
||||
|
||||
## Informations additionnelles
|
||||
|
||||
## Liens
|
||||
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/jirafeau_ynh/issues
|
||||
* Site de l'application : https://gitlab.com/mojo42/Jirafeau
|
||||
* Dépôt de l'application principale : https://gitlab.com/mojo42/Jirafeau
|
||||
* Site web YunoHost : https://yunohost.org/
|
||||
|
||||
---
|
||||
* Site officiel de l'app : https://gitlab.com/mojo42/Jirafeau
|
||||
* Dépôt de code officiel de l'app : https://gitlab.com/mojo42/Jirafeau
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_jirafeau
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/jirafeau_ynh/issues
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
|
@ -59,3 +50,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/jirafeau_ynh/tree/tes
|
|||
ou
|
||||
sudo yunohost app upgrade jirafeau -u https://github.com/YunoHost-Apps/jirafeau_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
|
@ -31,7 +31,7 @@ $cfg['web_root'] = 'https://' . '__DOMAIN__' . '__PATH__' . '/';
|
|||
|
||||
/* Path to data directory, with trailing slash (eg. »/var/www/data/var_314159265358979323846264«
|
||||
*/
|
||||
$cfg['var_root'] = '__VAR_ROOT__' . '/';
|
||||
$cfg['var_root'] = '__DATADIR__' . '/';
|
||||
|
||||
/* Language - choice between 'auto' or any language located in the /lib/locales/ folder.
|
||||
* The mode »auto« will cause the script to detect the user's browser information
|
||||
|
|
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
|||
Jirafeau offers the possibility to host and share your files with ease. Choose a file, Jirafeau will provide you with a link with many options. It is possible to protect your links with a password as well as to choose how long the file will be kept on the server. The file and the link will self-destruct after this time. Downloads of transmitted files can be limited to a certain date, and each file can self-destruct after the first download. Jirafeau allows you to configure maximum retention times and maximum size per file. Encryption is available as an option.
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
|||
Jirafeau offre la possibilité d'héberger et de partager vos fichiers, le tout en toute simplicité. Choisissez un fichier, Jirafeau vous fournira un lien avec beaucoup d'options. Il est possible de protéger vos liens avec mot de passe ainsi que de choisir la durée de rétention du fichier sur le serveur. Le fichier et le lien s'autodétruiront passé ce délai. Les téléchargements des fichiers transmis peuvent être limités à une certaine date, et chaque fichier peut s'autodétruire après le premier téléchargement. Jirafeau permet de configurer les temps maximum de rétention ainsi que la taille maximale par fichier. Le chiffrement est disponible en option.
|
9
doc/DISCLAIMER.md
Normal file
9
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
## Configuration
|
||||
|
||||
### Changing the conditions of use of the service
|
||||
|
||||
The license text on the "Terms of Service" page, which is shipped with the default installation, is "based on the Open Source Initiative Terms of Service". To change this text simply copy the file `/lib/tos.original.txt`, rename it to `/lib/tos.local.txt` and adapt it to your own needs. If you update the installation, then only the `tos.original.txt` file may change eventually, not your `tos.local.txt file`.
|
||||
|
||||
## Administration
|
||||
|
||||
To administer the files within Jirafeau it is enough to go to the address `jirafeau.domaine.tld/admin.php`.
|
9
doc/DISCLAIMER_fr.md
Normal file
9
doc/DISCLAIMER_fr.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
## Configuration
|
||||
|
||||
### Changer les conditions d'utilisation du service
|
||||
|
||||
Le texte de la licence sur la page "Conditions d'utilisation du service", qui est livrée avec l'installation par défaut, est basé sur les "Conditions d'utilisation du service de l'Initiative Open Source". Pour modifier ce texte, il suffit de copier le fichier `/lib/tos.original.txt`, de le renommer en `/lib/tos.local.txt` et de l'adapter à vos propres besoins. Si vous mettez à jour l'installation, alors seul le fichier `tos.original.txt` peut changer éventuellement, et non votre fichier `tos.local.txt`.
|
||||
|
||||
## Administration
|
||||
|
||||
Pour administrer les fichiers présents au sein de Jirafeau il suffit de se rendre à l'adresse `jirafeau.domaine.tld/admin.php`.
|
BIN
doc/screenshots/TPjh48P.png
Normal file
BIN
doc/screenshots/TPjh48P.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
|
@ -8,13 +8,19 @@
|
|||
},
|
||||
"version": "4.3.0~ynh2",
|
||||
"url": "https://gitlab.com/mojo42/Jirafeau",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-only",
|
||||
"website": "https://gitlab.com/mojo42/Jirafeau",
|
||||
"demo": "https://demo.yunohost.org/jirafeau/",
|
||||
"code": "https://gitlab.com/mojo42/Jirafeau"
|
||||
},
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": {
|
||||
"name": "julien",
|
||||
"email": "julien.malik@paraiso.me"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.7"
|
||||
"yunohost": ">= 4.2.4"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
|
@ -25,8 +31,7 @@
|
|||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"example": "domain.org"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
|
@ -40,18 +45,16 @@
|
|||
"ask": {
|
||||
"en": "Choose an admin user (will be able to access admin.php page)",
|
||||
"fr": "Choisissez l'administrateur (seul autorisé à accéder à la page admin.php)"
|
||||
},
|
||||
"example": "johndoe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "upload_password",
|
||||
"type": "password",
|
||||
"optional": true,
|
||||
"ask": {
|
||||
"en": "Set the password granting upload permissions (leave empty to allow anybody to upload)",
|
||||
"fr": "Définissez le mot de passe permettant l'accès à l'envoi de fichiers (laissez vide pour autoriser tout le monde)"
|
||||
},
|
||||
"example": "supersecretpassword"
|
||||
"en": "Set the password granting upload permissions (leave empty to allow anybody to upload). Please avoid using ' (quotes) in the password as it will fail the app...",
|
||||
"fr": "Définissez le mot de passe permettant l'accès à l'envoi de fichiers (laissez vide pour autoriser tout le monde). Veuillez éviter d'utiliser ' (guillemets) dans le mot de passe car cela fera échouer l'application..."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
|
|
|
@ -24,6 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
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)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
@ -40,7 +41,7 @@ ynh_backup --src_path="$final_path"
|
|||
# BACKUP OF THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/home/yunohost.app/$app" --is_big
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE NGINX CONFIGURATION
|
||||
|
|
|
@ -23,9 +23,7 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin_user=$YNH_APP_ARG_ADMIN_USER
|
||||
ynh_print_OFF
|
||||
upload_password=$YNH_APP_ARG_UPLOAD_PASSWORD
|
||||
ynh_print_ON
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
@ -51,6 +49,14 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
|
|||
ynh_app_setting_set --app=$app --key=admin --value=$admin_user
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=2
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
@ -62,6 +68,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -70,14 +80,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=2
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -97,7 +99,6 @@ jirafeauconfigfile="$final_path/lib/config.local.php"
|
|||
cp "../conf/config.local.php" "$jirafeauconfigfile"
|
||||
|
||||
# Set and save upload password, allowing an empty one
|
||||
ynh_print_OFF
|
||||
if [ -z "$upload_password" ]
|
||||
then
|
||||
ynh_replace_string --match_string="__UPLOAD_PASSWORD__" --replace_string="" --target_file="$jirafeauconfigfile"
|
||||
|
@ -106,15 +107,26 @@ else
|
|||
ynh_replace_special_string --match_string="__UPLOAD_PASSWORD__" --replace_string="'$upload_password'" --target_file="$jirafeauconfigfile"
|
||||
ynh_app_setting_set --app=$app --key=upload_password --value="$upload_password"
|
||||
fi
|
||||
ynh_print_ON
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
mkdir -p $datadir/{files,links,async,block}
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE JIRAFEAU
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Jirafeau..." --weight=2
|
||||
|
||||
var_root=/home/yunohost.app/$app
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$jirafeauconfigfile"
|
||||
if [ "$path_url" = "/" ]
|
||||
then
|
||||
|
@ -122,7 +134,7 @@ then
|
|||
else
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$jirafeauconfigfile"
|
||||
fi
|
||||
ynh_replace_string --match_string="__VAR_ROOT__" --replace_string="$var_root" --target_file="$jirafeauconfigfile"
|
||||
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$jirafeauconfigfile"
|
||||
ynh_replace_string --match_string="__ADMIN_USER__" --replace_string="$admin_user" --target_file="$jirafeauconfigfile"
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
|
@ -131,24 +143,17 @@ ynh_store_file_checksum --file="$jirafeauconfigfile"
|
|||
# Remove the install.php
|
||||
ynh_secure_remove --file=$final_path/install.php
|
||||
|
||||
chmod 400 "$jirafeauconfigfile"
|
||||
chown $app:$app "$jirafeauconfigfile"
|
||||
|
||||
#=================================================
|
||||
# SET THE CRON FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring the cron file..." --weight=2
|
||||
|
||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
chown -R root: $final_path
|
||||
|
||||
mkdir -p $var_root/{files,links,async,block}
|
||||
chown -R $app:root $var_root
|
||||
chmod -R 700 $var_root
|
||||
chown root: "/etc/cron.d/$app"
|
||||
chmod 644 "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -18,13 +18,14 @@ 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)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE MAIN DIR OF THE APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing Jirafeau main directory..." --weight=2
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=2
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
@ -59,7 +60,7 @@ ynh_secure_remove --file="/etc/cron.d/$app"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing data directory..." --weight=1
|
||||
|
||||
ynh_secure_remove --file="/home/yunohost.app/$app"
|
||||
ynh_secure_remove --file="$datadir"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
@ -75,4 +76,4 @@ ynh_system_user_delete --username=$app
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of Jirafeau completed" --last
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
|
|
|
@ -26,6 +26,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
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
|
||||
|
@ -40,27 +41,46 @@ test ! -d $final_path \
|
|||
#=================================================
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Jirafeau main directory..." --weight=2
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring $app main directory..." --weight=2
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
|
||||
mkdir -p "$datadir/{files,links,async,block}"
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
|
@ -72,26 +92,8 @@ ynh_add_fpm_config
|
|||
ynh_script_progression --message="Restoring the cron file..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORE
|
||||
#=================================================
|
||||
# RESTORE THE DATA OF JIRAFEAU
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=2
|
||||
|
||||
datadir="/home/yunohost.app/$app"
|
||||
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Create app folders
|
||||
mkdir -p "$datadir"/{files,links,async,block}
|
||||
chown -R $app:root /home/yunohost.app/$app
|
||||
chown root: "/etc/cron.d/$app"
|
||||
chmod 644 "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
@ -107,4 +109,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for Jirafeau" --last
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
|
|
|
@ -21,10 +21,9 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
admin_user=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
ynh_print_OFF
|
||||
upload_password=$(ynh_app_setting_get --app=$app --key=upload_password)
|
||||
ynh_print_ON
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -32,26 +31,37 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up Jirafeau before upgrading (may take a while)..." --weight=3
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Fix is_public as a boolean value
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=1
|
||||
is_public=1
|
||||
elif [ "$is_public" = "No" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||
is_public=0
|
||||
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
|
||||
|
||||
# Migrate files from 3.4.1 to 4.1.1
|
||||
current_version="$(ynh_app_upstream_version --manifest="/etc/yunohost/apps/$app/manifest.json")"
|
||||
update_version="$(ynh_app_upstream_version)"
|
||||
|
@ -60,8 +70,6 @@ if [ ${current_version:0:1} -le 3 ] && [ ${update_version:0:1} -ge 4 ]
|
|||
then
|
||||
ynh_script_progression --message="Migrating files..." --weight=5
|
||||
|
||||
var_root=/home/yunohost.app/$app
|
||||
|
||||
# Migrate files and links to the new directory structure
|
||||
for type in files links
|
||||
do
|
||||
|
@ -78,7 +86,7 @@ then
|
|||
|
||||
# Split the file name every 8 characters
|
||||
split=0
|
||||
full_path="$var_root/$type"
|
||||
full_path="$datadir/$type"
|
||||
while [ $split -le ${#file} ]
|
||||
do
|
||||
part_dir="${file:$split:8}"
|
||||
|
@ -94,7 +102,7 @@ then
|
|||
if [ "$type" = "files" ]; then
|
||||
mv "${full_file}_count" "$full_path"
|
||||
fi
|
||||
done <<< "$(find "$var_root/$type" -type f)" # List all files, without directories
|
||||
done <<< "$(find "$datadir/$type" -type f)" # List all files, without directories
|
||||
done
|
||||
|
||||
# And clean the old directories
|
||||
|
@ -109,23 +117,17 @@ then
|
|||
then
|
||||
ynh_secure_remove --file="$file"
|
||||
fi
|
||||
done <<< "$(find "$var_root/$type" -maxdepth 1 -mindepth 1 -type d)" # List all first level directories
|
||||
done <<< "$(find "$datadir/$type" -maxdepth 1 -mindepth 1 -type d)" # List all first level directories
|
||||
done
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up Jirafeau before upgrading (may take a while)..." --weight=3
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -141,6 +143,10 @@ then
|
|||
ynh_setup_source --dest_dir="$final_path"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -149,14 +155,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -178,7 +176,6 @@ ynh_backup_if_checksum_is_different --file="$final_path/lib/config.local.php"
|
|||
cp "../conf/config.local.php" "$final_path/lib/config.local.php"
|
||||
|
||||
# Set and save upload password, allowing an empty one
|
||||
ynh_print_OFF
|
||||
if [ -z "$upload_password" ]
|
||||
then
|
||||
ynh_replace_string --match_string="__UPLOAD_PASSWORD__" --replace_string="" --target_file="$jirafeauconfigfile"
|
||||
|
@ -187,14 +184,11 @@ else
|
|||
ynh_replace_special_string --match_string="__UPLOAD_PASSWORD__" --replace_string="'$upload_password'" --target_file="$jirafeauconfigfile"
|
||||
ynh_app_setting_set --app=$app --key=upload_password --value="$upload_password"
|
||||
fi
|
||||
ynh_print_ON
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE JIRAFEAU
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading Jirafeau configuration..." --weight=2
|
||||
|
||||
var_root=/home/yunohost.app/$app
|
||||
ynh_script_progression --message="Upgrading $app configuration..." --weight=2
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$jirafeauconfigfile"
|
||||
if [ "$path_url" = "/" ]
|
||||
|
@ -203,7 +197,7 @@ then
|
|||
else
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$jirafeauconfigfile"
|
||||
fi
|
||||
ynh_replace_string --match_string="__VAR_ROOT__" --replace_string="$var_root" --target_file="$jirafeauconfigfile"
|
||||
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$jirafeauconfigfile"
|
||||
ynh_replace_string --match_string="__ADMIN_USER__" --replace_string="$admin_user" --target_file="$jirafeauconfigfile"
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
|
@ -218,18 +212,8 @@ ynh_secure_remove --file=$final_path/install.php
|
|||
ynh_script_progression --message="Configuring the cron file..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
chown -R root: $final_path
|
||||
|
||||
mkdir -p $var_root/{files,links,async,block}
|
||||
chown -R $app:root $var_root
|
||||
chmod -R 700 $var_root
|
||||
chown root: "/etc/cron.d/$app"
|
||||
chmod 644 "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
@ -256,4 +240,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of Jirafeau completed" --last
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
|
Loading…
Reference in a new issue