1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/droppy_ynh.git synced 2024-09-03 18:26:27 +02:00
This commit is contained in:
Éric Gaspar 2021-11-07 23:19:46 +01:00 committed by GitHub
parent cf621e81a3
commit 4ff6d27bfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 197 additions and 194 deletions

View file

@ -1,6 +1,6 @@
--- ---
name: Bug report name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all. about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
--- ---
@ -8,28 +8,30 @@ about: Create a report to help us debug, it would be nice to fill the template a
1. *Read this whole template first.* 1. *Read this whole template first.*
2. *Determine if you are on the right place:* 2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to Droppy itself. Refer to its documentation or repository for help.* - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.* - *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.* 3. *Delete the italic comments as you write over them below, and remove this guide.*
--- ---
**Describe the bug** ### Describe the bug
*A clear and concise description of what the bug is.* *A clear and concise description of what the bug is.*
**Versions** ### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x - YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* - I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* - Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain: - If yes, please explain:
- Using, or trying to install package version/branch: - Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info droppy`* - If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
**To Reproduce**
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:* - *If you performed a command from the CLI, the command itself is enough. For example:*
```sh ```sh
sudo yunohost app install droppy sudo yunohost app install the_app
``` ```
- *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:* - *If the error occurs in your browser, explain what you did:*
@ -38,9 +40,16 @@ about: Create a report to help us debug, it would be nice to fill the template a
3. *Scroll down to '...'* 3. *Scroll down to '...'*
4. *See error* 4. *See error*
**Expected behavior** ### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* *A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs** ### Logs
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.* *If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -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~ynh7
**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
#### Multi-user support
* 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
* Upstream app code repository: https://github.com/silverwind/droppy
* YunoHost documentation for this app: https://yunohost.org/app_droppy
* Report a bug: https://github.com/YunoHost-Apps/droppy_ynh/issues * 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

View file

@ -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~ynh7
**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

View file

@ -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
@ -12,15 +12,14 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
#upgrade=1 from_commit=CommitHash upgrade=1 from_commit=cf621e81a3df37b77cdc97a305e10dfb27631c6a
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=
Notification=none Notification=none
;;; Upgrade options ;;; Upgrade options
; commit=CommitHash ; commit=cf621e81a3df37b77cdc97a305e10dfb27631c6a
name=Name and date of the commit. name=Testing (#12)
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -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
View 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
View 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
View 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
View 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/`

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

View file

@ -6,14 +6,18 @@
"en": "Self-hosted file storage server", "en": "Self-hosted file storage server",
"fr": "Serveur de stockage de fichiers auto-hébergé" "fr": "Serveur de stockage de fichiers auto-hébergé"
}, },
"version": "12.2.0~ynh6", "version": "12.2.0~ynh7",
"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",

View file

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -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

View file

@ -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

View file

@ -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
#================================================= #=================================================

View file

@ -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!"

View file

@ -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
#================================================= #=================================================
@ -79,11 +78,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --weight=10 ynh_script_progression --message="Upgrading source files..." --weight=10
# Remove the app directory securely
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 +103,20 @@ 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
#================================================= chmod 755 "$final_path"
# CREATE DIRECTORY FOR DATA AND CONFIG chmod -R o-rwx "$final_path"
#================================================= chown -R $app: "$final_path"
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
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=2
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -147,7 +124,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 +131,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 +148,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!"