mirror of
https://github.com/YunoHost-Apps/droppy_ynh.git
synced 2024-09-03 18:26:27 +02:00
fix (#16)
This commit is contained in:
parent
a78a536caf
commit
6a603f7a3a
15 changed files with 160 additions and 153 deletions
42
README.md
42
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.
|
||||||
|
-->
|
||||||
|
|
||||||
# Droppy for YunoHost
|
# Droppy for YunoHost
|
||||||
|
|
||||||
[![Integration level](https://dash.yunohost.org/integration/droppy.svg)](https://dash.yunohost.org/appci/app/droppy) ![](https://ci-apps.yunohost.org/ci/badges/droppy.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/droppy.maintain.svg)
|
[![Integration level](https://dash.yunohost.org/integration/droppy.svg)](https://dash.yunohost.org/appci/app/droppy) ![](https://ci-apps.yunohost.org/ci/badges/droppy.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/droppy.maintain.svg)
|
||||||
|
@ -10,42 +15,29 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Droppy is a self-hosted file storage server with a web interface and capabilities to edit files and view media directly in the browser.
|
Self-hosted file storage server
|
||||||
|
|
||||||
|
**Shipped version:** 12.2.0~ynh6
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 12.2.0
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
![](https://i.imgur.com/Ziv79rJ.png)
|
![](./doc/screenshots/screenshot.png)
|
||||||
|
|
||||||
|
## Disclaimers / important information
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
How to configure this app: a JSON configuration file with SSH. `/var/www/droppy/config/config.json`.
|
How to configure this app: a JSON configuration file with SSH. `/var/www/droppy/config/config.json`.
|
||||||
Shared files are stored in the following directory: `/home/yunohost.app/droppy/files`
|
Shared files are stored in the following directory: `/home/yunohost.app/droppy/files`
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
* Official documentation: https://github.com/silverwind/droppy
|
## Documentation and resources
|
||||||
|
|
||||||
## YunoHost specific features
|
* Upstream app code repository: https://github.com/silverwind/droppy
|
||||||
|
* YunoHost documentation for this app: https://yunohost.org/app_droppy
|
||||||
#### Multi-user support
|
* Report a bug: https://github.com/YunoHost-Apps/droppy_ynh/issues
|
||||||
|
|
||||||
* Is LDAP supported? **No**
|
|
||||||
* Can the app be used by multiple users? **Yes**
|
|
||||||
|
|
||||||
#### Supported architectures
|
|
||||||
|
|
||||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/droppy%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/droppy/)
|
|
||||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/droppy%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/droppy/)
|
|
||||||
|
|
||||||
## Links
|
|
||||||
|
|
||||||
* Report a bug: https://github.com/YunoHost-Apps/droppy_ynh/issues
|
|
||||||
* Upstream app repository: https://github.com/silverwind/droppy
|
|
||||||
* YunoHost website: https://yunohost.org/
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Developer info
|
## Developer info
|
||||||
|
|
||||||
|
@ -57,3 +49,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/droppy_ynh/tree/testi
|
||||||
or
|
or
|
||||||
sudo yunohost app upgrade droppy -u https://github.com/YunoHost-Apps/droppy_ynh/tree/testing --debug
|
sudo yunohost app upgrade droppy -u https://github.com/YunoHost-Apps/droppy_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
41
README_fr.md
41
README_fr.md
|
@ -4,48 +4,35 @@
|
||||||
[![Installer Droppy avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=droppy)
|
[![Installer Droppy avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=droppy)
|
||||||
|
|
||||||
*[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 Droppy rapidement et simplement sur un serveur YunoHost.
|
> *Ce package vous permet d'installer Droppy rapidement et simplement sur un serveur YunoHost.
|
||||||
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
|
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||||
|
|
||||||
## Vue d'ensemble
|
## Vue d'ensemble
|
||||||
|
|
||||||
Droppy est un serveur de stockage de fichiers auto-hébergé avec une interface Web et des capacités pour éditer des fichiers et afficher des médias directement dans le navigateur.
|
Serveur de stockage de fichiers auto-hébergé
|
||||||
|
|
||||||
|
**Version incluse :** 12.2.0~ynh6
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 12.2.0
|
|
||||||
|
|
||||||
## Captures d'écran
|
## Captures d'écran
|
||||||
|
|
||||||
![](https://i.imgur.com/Ziv79rJ.png)
|
![](./doc/screenshots/screenshot.png)
|
||||||
|
|
||||||
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Comment configurer cette application : un fichier de configuration `/var/www/droppy/config/config.json` en SSH.
|
Comment configurer cette application : un fichier de configuration `/var/www/droppy/config/config.json` en SSH.
|
||||||
Les fichiers partagés sont stockés dans le répertoire suivant : `/home/yunohost.app/droppy/files/`
|
Les fichiers partagés sont stockés dans le répertoire suivant : `/home/yunohost.app/droppy/files/`
|
||||||
|
|
||||||
## Documentation
|
## Documentations et ressources
|
||||||
|
|
||||||
* Documentation officielle : https://github.com/silverwind/droppy
|
* Dépôt de code officiel de l'app : https://github.com/silverwind/droppy
|
||||||
|
* Documentation YunoHost pour cette app : https://yunohost.org/app_droppy
|
||||||
## Caractéristiques spécifiques YunoHost
|
* Signaler un bug : https://github.com/YunoHost-Apps/droppy_ynh/issues
|
||||||
|
|
||||||
#### Support multi-utilisateur
|
|
||||||
|
|
||||||
* L'authentification LDAP est-elle prise en charge ? **Non**
|
|
||||||
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
|
|
||||||
|
|
||||||
#### Architectures supportées
|
|
||||||
|
|
||||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/droppy%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/droppy/)
|
|
||||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/droppy%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/droppy/)
|
|
||||||
|
|
||||||
## Liens
|
|
||||||
|
|
||||||
* Signaler un bug : https://github.com/YunoHost-Apps/droppy_ynh/issues
|
|
||||||
* Dépôt de l'application principale : https://github.com/silverwind/droppy
|
|
||||||
* Site web YunoHost : https://yunohost.org/
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Informations pour les développeurs
|
## Informations pour les développeurs
|
||||||
|
|
||||||
|
@ -57,3 +44,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/droppy_ynh/tree/testi
|
||||||
ou
|
ou
|
||||||
sudo yunohost app upgrade droppy -u https://github.com/YunoHost-Apps/droppy_ynh/tree/testing --debug
|
sudo yunohost app upgrade droppy -u https://github.com/YunoHost-Apps/droppy_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
|
@ -1,9 +1,9 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
path="/path" (PATH)
|
path="/path"
|
||||||
admin="john" (USER)
|
admin="john"
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
|
@ -15,7 +15,6 @@
|
||||||
#upgrade=1 from_commit=CommitHash
|
#upgrade=1 from_commit=CommitHash
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
port_already_use=0
|
|
||||||
change_url=1
|
change_url=1
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
|
|
|
@ -3,4 +3,3 @@ SOURCE_SUM=6bdb9f9e629d942c81b4228ba3b49749ddf5e2b7e3c484540adb4196c43efc44
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
SOURCE_FILENAME=
|
|
||||||
|
|
1
doc/DESCRITION.md
Normal file
1
doc/DESCRITION.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Droppy is a self-hosted file storage server with a web interface and capabilities to edit files and view media directly in the browser.
|
1
doc/DESCRITION_fr.md
Normal file
1
doc/DESCRITION_fr.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Droppy est un serveur de stockage de fichiers auto-hébergé avec une interface Web et des capacités pour éditer des fichiers et afficher des médias directement dans le navigateur.
|
5
doc/DISCLAIMER.md
Normal file
5
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
How to configure this app: a JSON configuration file with SSH. `/var/www/droppy/config/config.json`.
|
||||||
|
Shared files are stored in the following directory: `/home/yunohost.app/droppy/files`
|
||||||
|
|
4
doc/DISCLAIMER_fr.md
Normal file
4
doc/DISCLAIMER_fr.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Comment configurer cette application : un fichier de configuration `/var/www/droppy/config/config.json` en SSH.
|
||||||
|
Les fichiers partagés sont stockés dans le répertoire suivant : `/home/yunohost.app/droppy/files/`
|
BIN
doc/screenshots/screenshot.png
Normal file
BIN
doc/screenshots/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 261 KiB |
|
@ -8,12 +8,16 @@
|
||||||
},
|
},
|
||||||
"version": "12.2.0~ynh6",
|
"version": "12.2.0~ynh6",
|
||||||
"url": "https://github.com/silverwind/droppy",
|
"url": "https://github.com/silverwind/droppy",
|
||||||
|
"upstream": {
|
||||||
|
"license": "BSD-2-Clause",
|
||||||
|
"code": "https://github.com/silverwind/droppy"
|
||||||
|
},
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "eric_G"
|
"name": "eric_G"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.1.7"
|
"yunohost": ">= 4.2.8"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -23,8 +27,7 @@
|
||||||
"install" : [
|
"install" : [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain"
|
||||||
"example": "domain.org"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
|
|
|
@ -28,6 +28,7 @@ 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)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -47,12 +48,18 @@ ynh_backup --src_path="$final_path"
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
|
||||||
# BACKUP DATADIR DIRECTORY
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/home/yunohost.app/$app"
|
ynh_backup --src_path="$data_path" --is_big
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC BACKUP
|
||||||
|
#=================================================
|
||||||
|
# BACKUP LOGROTATE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
|
|
|
@ -67,6 +67,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=2
|
||||||
# Install Nodejs
|
# Install Nodejs
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -84,14 +92,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=3
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#==============================================
|
#==============================================
|
||||||
|
@ -99,10 +99,10 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
#==============================================
|
#==============================================
|
||||||
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=26
|
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=26
|
||||||
|
|
||||||
pushd "$final_path" || ynh_die
|
pushd "$final_path"
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_exec_warn_less ynh_npm install
|
ynh_exec_warn_less ynh_npm install
|
||||||
popd || ynh_die
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DIRECTORY FOR DATA AND CONFIG
|
# CREATE DIRECTORY FOR DATA AND CONFIG
|
||||||
|
@ -110,16 +110,16 @@ popd || ynh_die
|
||||||
ynh_script_progression --message="Creating the data directory..." --weight=1
|
ynh_script_progression --message="Creating the data directory..." --weight=1
|
||||||
|
|
||||||
# Define app's data directory
|
# Define app's data directory
|
||||||
data_path="/home/yunohost.app/${app}"
|
data_path=/home/yunohost.app/$app
|
||||||
|
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
|
||||||
|
|
||||||
# Create datadir folder
|
# Create datadir folder
|
||||||
mkdir -p $data_path
|
mkdir -p $data_path
|
||||||
|
|
||||||
# Create config folder
|
|
||||||
mkdir -p $final_path/config
|
|
||||||
|
|
||||||
# Give permission to the datadir
|
# Give permission to the datadir
|
||||||
chown -R $app: "$data_path"
|
chmod 750 "$data_path"
|
||||||
|
chmod -R o-rwx "$data_path"
|
||||||
|
chown -R $app:www-data "$data_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -127,7 +127,6 @@ chown -R $app: "$data_path"
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||||
ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
|
|
||||||
|
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
|
@ -136,19 +135,27 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modifying a config file..." --weight=1
|
ynh_script_progression --message="Modifying a config file..." --weight=1
|
||||||
|
|
||||||
|
# Create config folder
|
||||||
|
mkdir -p $final_path/config
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json"
|
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json"
|
||||||
|
|
||||||
|
chmod 600 "$final_path/config/config.json"
|
||||||
|
chown $app:$app "$final_path/config/config.json"
|
||||||
|
|
||||||
|
chmod 755 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app: "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Securing files and directories..." --weight=1
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||||
|
|
||||||
# Set permissions to app files
|
# Use logrotate to manage application logfile(s)
|
||||||
chown -R $app: $final_path
|
ynh_use_logrotate
|
||||||
chmod 755 $final_path
|
|
||||||
chmod 600 $final_path/config/config.json
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
|
|
@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -56,11 +57,15 @@ ynh_script_progression --message="Removing app main directory..." --weight=6
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DATADIR DIRECTORY
|
# REMOVE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_secure_remove --file="/home/yunohost.app/$app"
|
# 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..." --weight=1
|
||||||
|
ynh_secure_remove --file="$data_path"
|
||||||
|
fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -29,14 +29,13 @@ 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)
|
||||||
|
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=2
|
ynh_script_progression --message="Validating restoration parameters..." --weight=2
|
||||||
|
|
||||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
|
||||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
|
||||||
|
@ -64,15 +63,6 @@ ynh_script_progression --message="Restoring $app main directory..." --weight=20
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE USER RIGHTS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring user rights..."
|
|
||||||
|
|
||||||
# Restore permissions on app files
|
|
||||||
chown -R $app:$app $final_path
|
|
||||||
chmod 755 $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -92,12 +82,28 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file "/home/yunohost.app/$app"
|
ynh_restore_file --origin_path="$data_path" --not_mandatory
|
||||||
chown -R $app: "/home/yunohost.app/$app"
|
|
||||||
chmod 600 $final_path/config/config.json
|
mkdir -p $data_path
|
||||||
|
|
||||||
|
chmod 750 "$data_path"
|
||||||
|
chmod -R o-rwx "$data_path"
|
||||||
|
chown -R $app:www-data "$data_path"
|
||||||
|
|
||||||
|
chmod 755 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app: "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
@ -109,7 +115,7 @@ yunohost service add $app --description="Self-hosted file storage server" --log=
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=40
|
ynh_script_progression --message="Starting a systemd service..." --weight=20
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Ready for requests!"
|
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Ready for requests!"
|
||||||
|
|
||||||
|
|
|
@ -24,22 +24,9 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Checking version..." --weight=1
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -54,6 +41,18 @@ ynh_clean_setup () {
|
||||||
# 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -80,10 +79,10 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=10
|
ynh_script_progression --message="Upgrading source files..." --weight=10
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file=$final_path
|
#ynh_secure_remove --file=$final_path
|
||||||
|
|
||||||
# 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
|
ynh_setup_source --dest_dir=$final_path --keep="$final_path/config/config.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -107,39 +106,30 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
#==============================================
|
#==============================================
|
||||||
# INSTALL DROPPY
|
# INSTALL DROPPY
|
||||||
#==============================================
|
#==============================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=25
|
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=25
|
||||||
|
|
||||||
pushd "$final_path" || ynh_die
|
pushd "$final_path"
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_exec_warn_less ynh_npm install
|
ynh_exec_warn_less ynh_npm install
|
||||||
popd || ynh_die
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DIRECTORY FOR DATA AND CONFIG
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating the data directory..." --weight=1
|
|
||||||
|
|
||||||
# Define app's data directory
|
|
||||||
data_path="/home/yunohost.app/${app}"
|
|
||||||
|
|
||||||
# Create datadir folder
|
|
||||||
mkdir -p $data_path
|
|
||||||
|
|
||||||
# Create config folder
|
|
||||||
mkdir -p $final_path/config
|
|
||||||
|
|
||||||
# Give permission to the datadir
|
|
||||||
chown -R $app:$app "$data_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modifying a config file..." --weight=2
|
#ynh_script_progression --message="Modifying a config file..." --weight=2
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json"
|
# ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json"
|
||||||
|
|
||||||
|
# chmod 600 "$final_path/config/config.json"
|
||||||
|
# chown $app:$app "$final_path/config/config.json"
|
||||||
|
|
||||||
|
chmod 755 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app: "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -147,7 +137,6 @@ ynh_add_config --template="../conf/config.json.example" --destination="$final_pa
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
||||||
|
|
||||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||||
ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
@ -155,14 +144,12 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Securing files and directories..." --weight=2
|
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||||
|
|
||||||
# Set permissions on app files
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
chown -R $app:$app $final_path
|
ynh_use_logrotate --non-append
|
||||||
chmod 755 $final_path
|
|
||||||
chmod 600 $final_path/config/config.json
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
@ -174,7 +161,7 @@ yunohost service add $app --description="Self-hosted file storage server" --log=
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=40
|
ynh_script_progression --message="Starting a systemd service..." --weight=20
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Ready for requests!"
|
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Ready for requests!"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue