mirror of
https://github.com/YunoHost-Apps/trilium_ynh.git
synced 2024-10-01 13:34:49 +02:00
Merge pull request #25 from YunoHost-Apps/upgrade
Apply last example_ynh
This commit is contained in:
commit
5abaa5d122
23 changed files with 256 additions and 257 deletions
52
README.md
52
README.md
|
@ -1,56 +1,54 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
# Trilium Notes for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/trilium.svg)](https://dash.yunohost.org/appci/app/trilium) ![](https://ci-apps.yunohost.org/ci/badges/trilium.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/trilium.maintain.svg)
|
||||
[![Install trilium with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=trilium)
|
||||
[![Integration level](https://dash.yunohost.org/integration/trilium.svg)](https://dash.yunohost.org/appci/app/trilium) ![Working status](https://ci-apps.yunohost.org/ci/badges/trilium.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/trilium.maintain.svg)
|
||||
[![Install Trilium Notes with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=trilium)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allows you to install Trilium Notes and simply on a YunoHost server.
|
||||
> *This package allows you to install Trilium Notes 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
|
||||
|
||||
Trilium Notes is an Evernote-like hierarchical note taking application with many advanced features, focused on building a large personal knowledge base.
|
||||
|
||||
**Shipped version:** 0.52.3
|
||||
|
||||
**Shipped version:** 0.52.3~ynh2
|
||||
|
||||
## Screenshots
|
||||
|
||||
![](https://raw.githubusercontent.com/wiki/zadam/trilium/images/screenshot.png)
|
||||
![Screenshot of Trilium Notes](./doc/screenshots/screenshot.png)
|
||||
![Screenshot of Trilium Notes](./doc/screenshots/example.jpg)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
## Configuration
|
||||
|
||||
You will be asked to choose a username and password when you first access the app. You can configure Trillium from the settings menu of the app interface.
|
||||
|
||||
## Documentation
|
||||
## Documentation and resources
|
||||
|
||||
* Official documentation: https://github.com/zadam/trilium/wiki
|
||||
|
||||
#### Multi-user support
|
||||
|
||||
Are LDAP and HTTP auth supported? **No**
|
||||
Can the app be used by multiple users? **No**
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64
|
||||
* ARMv8-A
|
||||
|
||||
## Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/trilium_ynh/issues
|
||||
* Upstream app repository: https://github.com/zadam/trilium
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
* Official app website: <https://github.com/zadam/trilium>
|
||||
* Official admin documentation: <https://github.com/zadam/trilium/wiki>
|
||||
* Upstream app code repository: <https://github.com/zadam/trilium>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_trilium>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/trilium_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/trilium_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/trilium_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade trilium -u https://github.com/YunoHost-Apps/trilium_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
54
README_fr.md
54
README_fr.md
|
@ -1,56 +1,54 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
# Trilium Notes pour YunoHost
|
||||
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/trilium.svg)](https://dash.yunohost.org/appci/app/trilium) ![](https://ci-apps.yunohost.org/ci/badges/trilium.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/trilium.maintain.svg)
|
||||
[![Installer trilium avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=trilium)
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/trilium.svg)](https://dash.yunohost.org/appci/app/trilium) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/trilium.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/trilium.maintain.svg)
|
||||
[![Installer Trilium Notes avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=trilium)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Trilium Notes 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.*
|
||||
> *Ce package vous permet d'installer Trilium Notes 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
|
||||
|
||||
Trilium Notes est une application de prise de note hiérarchique semblable a Evernote, avec maintes fonctions avancées, centrée sur la construction d'une large base de connaissances personnelle.
|
||||
|
||||
**Version incluse :** 0.52.3
|
||||
|
||||
**Version incluse :** 0.52.3~ynh2
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![](https://raw.githubusercontent.com/wiki/zadam/trilium/images/screenshot.png)
|
||||
![Capture d'écran de Trilium Notes](./doc/screenshots/screenshot.png)
|
||||
![Capture d'écran de Trilium Notes](./doc/screenshots/example.jpg)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
## Configuration
|
||||
|
||||
On vous demandera de choisir un nom d'utilisateur et mot de passe quand vous installez l'application. Vous pouvez configurer Trillium depuis le menu de configuration de l'interface web.
|
||||
|
||||
## Documentation
|
||||
## Documentations et ressources
|
||||
|
||||
* Documentation officielle : https://github.com/zadam/trilium/wiki
|
||||
|
||||
#### Support multi-utilisateur
|
||||
|
||||
* L'authentification LDAP et HTTP est-elle prise en charge ? **Non**
|
||||
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Non**
|
||||
|
||||
#### Architectures supportées
|
||||
|
||||
* x86-64
|
||||
* ARMv8-A
|
||||
|
||||
## Liens
|
||||
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/trilium_ynh/issues
|
||||
* Dépôt de l'application principale : https://github.com/zadam/trilium
|
||||
* Site web YunoHost : https://yunohost.org/
|
||||
|
||||
---
|
||||
* Site officiel de l'app : <https://github.com/zadam/trilium>
|
||||
* Documentation officielle de l'admin : <https://github.com/zadam/trilium/wiki>
|
||||
* Dépôt de code officiel de l'app : <https://github.com/zadam/trilium>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_trilium>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/trilium_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
**Seulement si vous voulez utiliser une branche de test pour le codage, au lieu de fusionner directement dans la banche principale.**
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/trilium_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/trilium_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade trilium -u https://github.com/YunoHost-Apps/trilium_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
# See here for more information
|
||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
||||
|
||||
# Move this file from check_process.default to check_process when you have filled it.
|
||||
|
||||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
domain="domain.tld"
|
||||
is_public=1
|
||||
instance_name="MyTrillium"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
|
@ -15,7 +11,8 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=0 from_commit=CommitHash
|
||||
# 0.50.2~ynh1
|
||||
upgrade=0 from_commit=1a944e70223108bc16a28d236eca6e7efd25018e
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
|
@ -23,8 +20,3 @@
|
|||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=CommitHash
|
||||
name=Name and date of the commit.
|
||||
manifest_arg=domain=DOMAIN&admin=USER&is_public=1&
|
||||
|
||||
|
|
|
@ -20,4 +20,4 @@ port=__PORT__
|
|||
https=false
|
||||
# path to certificate (run "bash bin/generate-cert.sh" to generate self-signed certificate). Relevant only if https=true
|
||||
certPath=
|
||||
keyPath=
|
||||
keyPath=
|
||||
|
|
|
@ -6,10 +6,12 @@ After=network.target
|
|||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
Environment=TRILIUM_DATA_DIR=/home/yunohost.app/__APP__
|
||||
Environment=TRILIUM_DATA_DIR=__DATADIR__
|
||||
Environment=TRILIUM_PORT=__PORT__
|
||||
Environment="__YNH_NODE_LOAD_PATH__"
|
||||
Environment=NODE_ENV=production
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=/usr/bin/env bash -c "PATH=__NODEJS_PATH__:$PATH node __FINALPATH__/src/www"
|
||||
ExecStart=__YNH_NODE__ __FINALPATH__/src/www
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
|||
Trilium Notes is an Evernote-like hierarchical note taking application with many advanced features, focused on building a large personal knowledge base.
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
|||
Trilium Notes est une application de prise de note hiérarchique semblable a Evernote, avec maintes fonctions avancées, centrée sur la construction d'une large base de connaissances personnelle.
|
3
doc/DISCLAIMER.md
Normal file
3
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
## Configuration
|
||||
|
||||
You will be asked to choose a username and password when you first access the app. You can configure Trillium from the settings menu of the app interface.
|
3
doc/DISCLAIMER_fr.md
Normal file
3
doc/DISCLAIMER_fr.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
## Configuration
|
||||
|
||||
On vous demandera de choisir un nom d'utilisateur et mot de passe quand vous installez l'application. Vous pouvez configurer Trillium depuis le menu de configuration de l'interface web.
|
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/example.jpg
Normal file
BIN
doc/screenshots/example.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
BIN
doc/screenshots/screenshot.png
Normal file
BIN
doc/screenshots/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 KiB |
|
@ -6,26 +6,31 @@
|
|||
"en": "A hierarchical note taking application with focus on building large personal knowledge base",
|
||||
"fr": "Une application de prise de note hiérarchique centrée sur la construction d'une large base de connaissances personnelle"
|
||||
},
|
||||
"version": "0.52.3~ynh1",
|
||||
"version": "0.52.3~ynh2",
|
||||
"url": "https://github.com/zadam/trilium",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-only",
|
||||
"website": "https://github.com/zadam/trilium",
|
||||
"admindoc": "https://github.com/zadam/trilium/wiki",
|
||||
"code": "https://github.com/zadam/trilium"
|
||||
},
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": {
|
||||
"name": "Jules Bertholet",
|
||||
"email": "jules.bertholet@gmail.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.3"
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"example": "example.com"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
|
|
|
@ -4,52 +4,15 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
nodejs_version=16
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="nodejs npm libpng16-16 libpng-dev pkg-config autoconf libtool build-essential nasm libx11-dev libxkbfile-dev"
|
||||
pkg_dependencies="libpng16-16 libpng-dev pkg-config autoconf libtool build-essential nasm libx11-dev libxkbfile-dev"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
function set_node_vars {
|
||||
nodejs_version=$(ynh_app_setting_get --app=$app --key=nodejs_version)
|
||||
if [ "$nodejs_version" -ne 16 ]; then
|
||||
ynh_exec_warn_less ynh_remove_nodejs
|
||||
fi
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=16
|
||||
ynh_use_nodejs
|
||||
node_path="$nodejs_path:$(sudo -u $app sh -c 'echo $PATH')"
|
||||
}
|
||||
|
||||
function build_node_app {
|
||||
set_node_vars
|
||||
|
||||
grep -v electron "$final_path/package.json" > "$final_path/server-package.json"
|
||||
mv "$final_path/server-package.json" "$final_path/package.json"
|
||||
pushd "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
sudo -u $app touch "$final_path/.yarnrc"
|
||||
sudo -u $app env "PATH=$node_path" yarn --cache-folder "$final_path/yarn-cache" --use-yarnrc "$final_path/.yarnrc" import 2>&1
|
||||
sudo -u $app env "PATH=$node_path" yarn --cache-folder "$final_path/yarn-cache" --use-yarnrc "$final_path/.yarnrc" install --production 2>&1
|
||||
chown -R root:root "$final_path"
|
||||
popd
|
||||
|
||||
set_permissions
|
||||
}
|
||||
|
||||
function set_permissions {
|
||||
chown -R root:$app "$final_path"
|
||||
chmod -R g=u,g-w,o-rwx "$final_path"
|
||||
chown -R $app:$app "$data_path"
|
||||
chmod -R g=u,g-w,o-rwx "$data_path"
|
||||
}
|
||||
|
||||
function setup_sources {
|
||||
ynh_secure_remove "$final_path"
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
mkdir -p "$data_path"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -27,9 +27,9 @@ ynh_print_info --message="Loading installation settings..."
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
@ -42,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -56,12 +62,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$data_path" --is_big
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -30,13 +30,14 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=15
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
|
@ -57,6 +58,10 @@ then
|
|||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -91,7 +96,7 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -27,6 +27,7 @@ domain=$YNH_APP_ARG_DOMAIN
|
|||
path_url="/"
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
instance_name=$YNH_APP_ARG_INSTANCE_NAME
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
|
@ -36,8 +37,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
|
|||
|
||||
final_path=/opt/yunohost/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
data_path=/home/yunohost.app/$app
|
||||
test ! -e "$data_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
@ -59,7 +58,7 @@ ynh_app_setting_set --app=$app --key=instance_name --value=$instance_name
|
|||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8080)
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
|
@ -67,8 +66,17 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=60
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
@ -76,9 +84,15 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
|
|||
ynh_script_progression --message="Setting up source files..." --weight=5
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
setup_sources
|
||||
grep -v electron "$final_path/package.json" > "$final_path/server-package.json"
|
||||
mv "$final_path/server-package.json" "$final_path/package.json"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -88,15 +102,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|||
# Create a dedicated 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
|
||||
usermod -d $final_path $app 2>&1
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -104,7 +109,36 @@ usermod -d $final_path $app 2>&1
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing Node.js packages ..." --weight=45
|
||||
|
||||
build_node_app
|
||||
pushd "$final_path"
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install
|
||||
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm rebuild
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
mkdir -p $datadir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini"
|
||||
ln -sf $final_path/config.ini $datadir/config.ini
|
||||
|
||||
chmod 400 "$final_path/config.ini"
|
||||
chown $app:$app "$final_path/config.ini"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -114,22 +148,8 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
|||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_add_config --template="config.ini" --destination="$final_path/config.ini"
|
||||
ln -sf $final_path/config.ini $data_path/config.ini
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
set_permissions
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
@ -143,7 +163,7 @@ yunohost service add $app --description="Trilium Notes app" --log="systemd"
|
|||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -42,14 +42,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=30
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -58,6 +50,17 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
|
|||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Remove the data directory if --purge option is used
|
||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing app data directory..."
|
||||
ynh_secure_remove --file="$datadir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -67,21 +70,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
|
|||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE NODE
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing Node.js version..." --weight=1
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=30
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
# Remove the data directory
|
||||
ynh_secure_remove --file="$data_path"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -15,8 +15,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -31,55 +30,49 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app directories..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="$data_path" --not_mandatory
|
||||
mkdir -p $data_path
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
usermod -d $final_path $app 2>&1
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
# Restore permissions on app files
|
||||
set_permissions
|
||||
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..."
|
||||
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
|
||||
mkdir -p $datadir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
|
@ -89,15 +82,16 @@ set_permissions
|
|||
ynh_script_progression --message="Reinstalling dependencies..." --weight=40
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring Node.js installation..." --weight=1
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
set_node_vars
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
|
@ -119,7 +113,7 @@ yunohost service add $app --description="Trilium Notes app" --log="systemd"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -20,14 +20,14 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
instance_name=""
|
||||
instance_name=$(ynh_app_setting_get --app=$app --key=instance_name)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
|
@ -39,6 +39,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
|||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
|
@ -54,17 +55,54 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=60
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# If datadir doesn't exist, create it
|
||||
if [ -z "$datadir" ]; then
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
ynh_app_setting_delete --app=$app --key=data_path
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# 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 --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=5
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
|
||||
setup_sources
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path" --keep="config.ini"
|
||||
|
||||
grep -v electron "$final_path/package.json" > "$final_path/server-package.json"
|
||||
mv "$final_path/server-package.json" "$final_path/package.json"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -73,31 +111,29 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
usermod -d $final_path $app 2>&1
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# INSTALL NODE PACKAGES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Node.js packages ..." --weight=1
|
||||
ynh_script_progression --message="Installing Node.js packages ..." --weight=45
|
||||
|
||||
build_node_app
|
||||
pushd "$final_path"
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install
|
||||
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm rebuild
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini"
|
||||
ln -sf $final_path/config.ini $datadir/config.ini
|
||||
|
||||
chmod 400 "$final_path/config.ini"
|
||||
chown $app:$app "$final_path/config.ini"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -107,22 +143,8 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
|||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
ynh_add_config --template="config.ini" --destination="$final_path/config.ini"
|
||||
ln -sf $final_path/config.ini $data_path/config.ini
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
set_permissions
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
@ -135,7 +157,7 @@ yunohost service add $app --description="Trilium Notes app" --log="systemd"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
2
sources/patches/.gitignore
vendored
2
sources/patches/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
Loading…
Reference in a new issue