1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/opennote_ynh.git synced 2024-09-03 19:46:28 +02:00

Merge pull request #4 from YunoHost-Apps/upgrade

Apply example_ynh
This commit is contained in:
yalh76 2022-06-23 16:11:40 +02:00 committed by GitHub
commit 85fda85c56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 69 additions and 66 deletions

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# OpenNote for YunoHost # OpenNote for YunoHost
[![Integration level](https://dash.yunohost.org/integration/opennote.svg)](https://dash.yunohost.org/appci/app/opennote) ![](https://ci-apps.yunohost.org/ci/badges/opennote.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/opennote.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/opennote.svg)](https://dash.yunohost.org/appci/app/opennote) ![Working status](https://ci-apps.yunohost.org/ci/badges/opennote.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/opennote.maintain.svg)
[![Install OpenNote with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=opennote) [![Install OpenNote with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=opennote)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -17,13 +17,13 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Web based text editor/note taking software Web based text editor/note taking software
**Shipped version:** 18.03.00~ynh1 **Shipped version:** 18.03.00~ynh2
**Demo:** https://foxusa.github.io/OpenNote/OpenNote/#/folder **Demo:** https://foxusa.github.io/OpenNote/OpenNote/#/folder
## Screenshots ## Screenshots
![](./doc/screenshots/screenshot.png) ![Screenshot of OpenNote](./doc/screenshots/screenshot.png)
## Disclaimers / important information ## Disclaimers / important information
@ -31,20 +31,21 @@ This app works with the browser's local storage, so users won't find the notes i
## Documentation and resources ## Documentation and resources
* Official app website: https://foxusa.github.io/OpenNote/OpenNote/ * Official app website: <https://foxusa.github.io/OpenNote/OpenNote/>
* Upstream app code repository: https://github.com/FoxUSA/OpenNote/ * Upstream app code repository: <https://github.com/FoxUSA/OpenNote/>
* YunoHost documentation for this app: https://yunohost.org/app_opennote * YunoHost documentation for this app: <https://yunohost.org/app_opennote>
* Report a bug: https://github.com/YunoHost-Apps/opennote_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/opennote_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/opennote_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/opennote_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/opennote_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/opennote_ynh/tree/testing --debug
or or
sudo yunohost app upgrade opennote -u https://github.com/YunoHost-Apps/opennote_ynh/tree/testing --debug sudo yunohost app upgrade opennote -u https://github.com/YunoHost-Apps/opennote_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# OpenNote pour YunoHost # OpenNote pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/opennote.svg)](https://dash.yunohost.org/appci/app/opennote) ![](https://ci-apps.yunohost.org/ci/badges/opennote.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/opennote.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/opennote.svg)](https://dash.yunohost.org/appci/app/opennote) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/opennote.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/opennote.maintain.svg)
[![Installer OpenNote avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=opennote) [![Installer OpenNote avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=opennote)
*[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 OpenNote rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer OpenNote rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
@ -13,13 +17,13 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Éditeur WEB de texte/logiciel de prise de notes Éditeur WEB de texte/logiciel de prise de notes
**Version incluse :** 18.03.00~ynh1 **Version incluse :** 18.03.00~ynh2
**Démo :** https://foxusa.github.io/OpenNote/OpenNote/#/folder **Démo :** https://foxusa.github.io/OpenNote/OpenNote/#/folder
## Captures d'écran ## Captures d'écran
![](./doc/screenshots/screenshot.png) ![Capture d'écran de OpenNote](./doc/screenshots/screenshot.png)
## Avertissements / informations importantes ## Avertissements / informations importantes
@ -27,20 +31,21 @@ This app works with the browser's local storage, so users won't find the notes i
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://foxusa.github.io/OpenNote/OpenNote/ * Site officiel de l'app : <https://foxusa.github.io/OpenNote/OpenNote/>
* Dépôt de code officiel de l'app : https://github.com/FoxUSA/OpenNote/ * Dépôt de code officiel de l'app : <https://github.com/FoxUSA/OpenNote/>
* Documentation YunoHost pour cette app : https://yunohost.org/app_opennote * Documentation YunoHost pour cette app : <https://yunohost.org/app_opennote>
* Signaler un bug : https://github.com/YunoHost-Apps/opennote_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/opennote_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/opennote_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/opennote_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/opennote_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/opennote_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade opennote -u https://github.com/YunoHost-Apps/opennote_ynh/tree/testing --debug sudo yunohost app upgrade opennote -u https://github.com/YunoHost-Apps/opennote_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps **Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -2,7 +2,6 @@
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
admin="john"
is_public=1 is_public=1
; Checks ; Checks
pkg_linter=1 pkg_linter=1
@ -12,14 +11,12 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
#upgrade=1 from_commit=CommitHash # 18.03.00~ynh1
upgrade=1 from_commit=4620f73e067ea2d7cb00ffd59ba042314ff756c7
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=18.03.00.zip SOURCE_FILENAME=18.03.00.zip
SOURCE_EXTRACT=true

View file

@ -2,12 +2,7 @@
location __PATH__/ { location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/ ; alias __FINALPATH__/;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
index index.html; index index.html;

View file

@ -6,7 +6,7 @@
"en": "Web based text editor/note taking software", "en": "Web based text editor/note taking software",
"fr": "Éditeur WEB de texte/logiciel de prise de notes" "fr": "Éditeur WEB de texte/logiciel de prise de notes"
}, },
"version": "18.03.00~ynh1", "version": "18.03.00~ynh2",
"url": "https://foxusa.github.io/OpenNote/OpenNote/", "url": "https://foxusa.github.io/OpenNote/OpenNote/",
"upstream": { "upstream": {
"license": "MIT", "license": "MIT",
@ -20,18 +20,17 @@
"email": "apulido@free.fr" "email": "apulido@free.fr"
}, },
"requirements": { "requirements": {
"yunohost": ">> 4.2.4" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx" "nginx"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"example": "example.com"
}, },
{ {
"name": "path", "name": "path",

View file

@ -11,3 +11,7 @@
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -22,7 +22,6 @@ ynh_abort_if_errors
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." ynh_print_info --message="Loading installation settings..."
# See comments in install script
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)

View file

@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -24,14 +23,12 @@ ynh_abort_if_errors
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
path=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
@ -88,6 +85,8 @@ ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"
fi fi

View file

@ -32,7 +32,7 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -38,12 +38,6 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -63,6 +57,13 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -27,6 +27,22 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=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
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -45,20 +61,6 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public ynh_app_setting_delete --app=$app --key=is_public
fi fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --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 DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================