1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git synced 2024-09-03 18:36:09 +02:00

Merge pull request #180 from YunoHost-Apps/version-2

Version 2
This commit is contained in:
Éric Gaspar 2023-05-20 19:51:44 +02:00 committed by GitHub
commit 3ef1949897
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 320 additions and 1984 deletions

View file

@ -1,129 +0,0 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*".tar.gz"*)
src="app"
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -1,49 +0,0 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
branch: ci-auto-update-v${{ env.VERSION }}
base: testing
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade etherpad_mypads to v${{ env.VERSION }}
draft: false

View file

@ -1,132 +0,0 @@
Changelog
=========
## [1.8.18~ynh2]() - 2022-07-26
#### Fixed
* [Fix unicode support](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/174/commits/f9afcc4447fc2ec97355622645023a56551e3d4b)
## [1.8.18~ynh1]() - 2022-07-18
#### Changed
* [Upgrade to 1.8.18](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/171)
## [1.8.17~ynh1]() - 2022-02-24
#### Changed
* [Upgrade to 1.8.17](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/160/commits/4c6951773bc4cf7955bc1b7407973cacc7db9302)
* [Upgrade plugins to upstream](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/160/commits/5a4944af34fb09c1e915bd43edc0de5ac8bf6538)
## [1.8.16~ynh2]() - 2021-12-21
#### Changed
* [Upgrade to 1.8.16 (for real)](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/159/commits/d08a7d53b0b350dcbbdd983d421c68c2eb065c34)
* [Upgrade plugins to upstream](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/159/commits/e4929cf6e31b71970a24165845365c2342d1fd61)
## [1.8.16~ynh1]() - 2021-12-09
#### Changed
* [Upgrade to 1.8.16](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/157/commits/e82f22685697428a0f24b15a9682dd075d0c5223)
* [Upgrade ep_comments_page to 0.1.80](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/157/commits/0395fb13763a14ad6a85967809da7473f030f58c)
## [1.8.15~ynh1]() - 2021-11-20
#### Changed
* [Upgrade to 1.8.15](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/154/commits/d176478017e8524984657f302262516901cdc427)
* [Upgrade plugins to upstream](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/154/commits/2f7e3e25ec9e7d7e48a8d14742a8cf081e56a8b4)
* [Set YunoHost requirements to 4.3.0](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/154/commits/51a380c77711fdd70eb36a34a1af4a50e8b840a6)
* [Add more language (gl, hu, nl, pt)](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/154/commits/63a460165ad9d5bb754d8954fdf69a098e3bf35b)
## [1.8.14~ynh2]() - 2021-10-01
#### Changed
* [Harden systemd](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/149/commits/5900064ea950d98c0bf28e336a5e2d85012e5e52)
* [Fix login to admin page](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/149/commits/3659fb84bcd52d16937a25998395e7889a731412)
* [Add autoupdate mecanism](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/149/commits/b53b5830e5c3521db00fe2f4c8b8c1d953e5664a)
* [Code clean up](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/149/commits/e4168cde0a8611a09ff5bfea6059bdc98a36af38)
## [1.8.14~ynh1]() - 2021-06-04
#### Changed
* [Upgrade to 1.8.14](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/452b42c106f9e67f84165e1f62ba7cc516240351)
* [Update to MyPads 1.7.21](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/678da97ecac67491028cdeba1493ba11650b992b)
* [Upgrade plugins to upstream](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/34d5d0a002c3ca74c8151d365efaaba0e6fb96b2)
## [1.8.13~ynh2]() - 2021-05-14
#### Disabled
* [ep_automatic_logut plugin](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/140/files)
## [1.8.13~ynh1]() - 2021-03-23
#### Changed
* [Upgrade to 1.8.13](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/9684b59824b18ea781efb8a26df5d7c3d51a8264)
* [Upgrade NodeJS to 14](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/5d3ce9996e3f4d0812b000467e5ae2d9ee5416e0)
* [Update to MyPads 1.7.20]()
* [Upgrade plugins to upstream](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/943ec31536dabe4f2146253f3e478598cdafe4bf)
#### Added
* [ep_countable plugin (working again)](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/commit/5d3ce9996e3f4d0812b000467e5ae2d9ee5416e0)
## [1.8.4~ynh3](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/133) - 2021-04-23
#### Changed
* [Remove page_view plugin (part of the core now)](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/133/commits/def10182c0d7e7aa8a9123e3606203fbd37a20ea)
* [New permissions](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/133/commits/943ec31536dabe4f2146253f3e478598cdafe4bf)
## [1.8.4~ynh1](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/105) - 2020-08-09
#### Changed
* [Upgrade to 1.8.4](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/105/commits/db2ffa6fc5ebac447410e1018c9b3d1bd3be79a2)
* [Update to MyPads 1.7.17](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/105/commits/db2ffa6fc5ebac447410e1018c9b3d1bd3be79a2)
* [Upgrade packages to upstream](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/105/commits/28f2069099fe81d8c9b188e3461494323e437cfe)
* [Set colibris as skin default](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/105/commits/5201c05185b8e65635267a73339fe9d3ce255a4f)
#### Disabled
* [ep_countable plugin (not working with this version)](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/105/commits/0a0d26cc5cadb5d51ae0e8dbbef41c9488af2433)
## [1.8.0~ynh1](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/74) - 2019-10-08
#### Added
* [Add actions and config-panel](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/49)
* [Add changelog](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/76)
#### Fixed
* [Show a link to mypads only if installed](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/74/commits/46b50b32e58edfb74c143fe5a50362629294f50b)
#### Changed
* [Upgrade to 1.8.0](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/78)
* [Update to mypads 1.7.10](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/74/commits/00060c99db7f0fcac57c910256a37b6deeb8c2fe)
* [Allow to enable or disable automatic logout](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/74/commits/fdc8d6cbdd8eb0931336311d53857dad7f966d93)
## [1.7.5~ynh2](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/69) - 2019-05-26
#### Changed
* [Upgrade to Etherpad 1.7.5](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/69/commits/d299b77dd865e9fff306c121235450e27ab9372a)
## [1.7.0~ynh2](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63) - 2019-03-29
#### Added
- [Progress bar](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/4489e07a059477802cfeb402e1980b79e1ddce97)
#### Fixed
* [Fix regression on ynh_system_user_create](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/c0de9b2ee3ebc5ecb11e02655984e1fe793dd9d5)
#### Changed
* [Update to last standart](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/c663ec74c1d97cccbc1291a9d3e74cdf3b7586e9)
* [Update to mypads 1.7.6](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/c87caaad6507a52a71572ef21529cc4f1022b53b)
* [Update helpers](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/bab779a39f3f6f45c0fcc6bdf640baa47a5e6821)
* [Allow to include a pad in an other page](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/f27cca79957f88fd9972452db146fe6867ba3f79)
## [1.7.0~ynh1](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/55) - 2018-12-08
#### Fixed
* [Set permissions during the restore script](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/55/commits/85be69b5ce15db0d9df0f0ca191be43c2ea6bc31)
#### Changed
* [Update mypads to 1.6.8](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/55/commits/8c73fd242286029991b774d02ce9209c88793c21)

View file

@ -18,16 +18,21 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Etherpad is a real-time collaborative editor scalable to thousands of simultaneous real time users. It provides full data export capabilities, and runs on your server, under your control.
### Features
This version of Etherpad is preconfigured with a collection of plugins:
- Rich Editing - A full rich text WYSIWYG editor.
- Minimalist editor - A minimalist editor that can be embedded within your tool.
- Dark Mode - Theme settings to have Etherpad start in dark mode, ideal for using Etherpad at night or for long durations.
- Images - Plugins to improve provide Image support within a pad.
- Video Chat - Plugins to enable Video and Audio chat in a pad.
- Collaboration++ - Plugins to improve the really-real time collaboration experience, suitable for busy pads.
- Document Analysis - Plugins to improve author and document analysis during and post creation.
- Scale - Etherpad running at scale with pad sharding which allows Etherpad to scale to ∞ number of Active Pads with up to 20,000 edits per second, per pad.
- [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groups and private pads for etherpad*
- [ep_table_of_contents](https://www.npmjs.com/package/ep_table_of_contents) - *Display pad's table of contents*
- [ep_align](https://www.npmjs.com/package/ep_align) - *Add Left/Center/Right/Justify alignment*
- [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Display author names when hovereing text*
- [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Add comments on sidebar and link it to the text.*
- [ep_countable](https://www.npmjs.com/package/ep_countable) - *Add paragraphs, words and characters count*
- [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Delete pads which were never edited*
- [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Be able to change font color*
- [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Be able to change font size*
- [ep_headings2](https://www.npmjs.com/package/ep_headings2) - *Be able to set text as headers*
- [ep_markdown](https://www.npmjs.com/package/ep_markdown) - *Edit and export as Markdown*
- [ep_spellcheck](https://www.npmjs.com/package/ep_spellcheck) - *Add spell checking*
- [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Support for subscript and superscript*
**Shipped version:** 1.8.18~ynh2
@ -38,40 +43,6 @@ Etherpad is a real-time collaborative editor scalable to thousands of simultaneo
![Screenshot of Etherpad MyPads](./doc/screenshots/etherpad_demo.gif)
## Disclaimers / important information
## Configuration
You can access two different admin panels, for Etherpad by accessing `domain.tld/admin` and for MyPads by `domain.tld/mypads/?/admin`.
You can also find a configuration file for Etherpad at this path `/var/www/etherpad_mypads/settings.json`.
*Skin Builder* (accessible at this address `domain.tld/pad/p/test#skinvariantsbuilder`) allows you to customize the skin of your pad. It will give you a parameter to copy into your configuration file `/var/www/etherpad_mypads/settings.json`.
## YunoHost specific features
#### Multi-users support
* Is LDAP auth supported (for MyPads access only)? **Yes**
* Can the app be used by multiple users? **Yes**
## Additionnal informations
* This package will install the following plugins:
* [ep_align](https://www.npmjs.com/package/ep_align) - *Add Left/Center/Right/Justify to lines of text in a pad*
* [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Adds author names to span titles*
* [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Adds comments on sidebar and link it to the text.*
* [ep_countable](https://www.npmjs.com/package/ep_countable) - *Adds paragraphs, words and characters count*
* [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Delete pads which were never edited*
* [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Apply colors to fonts*
* [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Add support for Font Sizes*
* [ep_headings2](https://www.npmjs.com/package/ep_headings2) - *Adds heading support to Etherpad Lite.*
* [ep_markdown](https://www.npmjs.com/package/ep_markdown) - *Edit and Export as Markdown in Etherpad*
* [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groups and private pads for etherpad*
* [ep_spellcheck](https://www.npmjs.com/package/ep_spellcheck) - *Add support to do 'Spell checking'*
* [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Add support for Subscript and Superscript*
* [ep_table_of_contents](https://www.npmjs.com/package/ep_table_of_contents) - *View a table of contents for your pad*
## Documentation and resources
* Official app website: <http://etherpad.org>

View file

@ -18,6 +18,22 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
Etherpad est un éditeur collaboratif en temps réel évolutif pour des milliers d'utilisateurs simultanés en temps réel. Il fournit des capacités complètes d'exportation de données et s'exécute sur votre serveur, sous votre contrôle.
Cette version d'Etherpad est préconfigurée avec une collection de plugins:
- [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groupes et pads privés pour etherpad*
- [ep_table_of_contents](https://www.npmjs.com/package/ep_table_of_contents) - *Affichage de la table des matières*
- [ep_align](https://www.npmjs.com/package/ep_align) - *Ajout de l'alignement à gauche/centre/droit/justifié*
- [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Affichage de l'auteur lorsqu'on passe la souris au dessus d'un texte*
- [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Ajout de commentaire dans la barre latéral + lien avec le texte du pad*
- [ep_countable](https://www.npmjs.com/package/ep_countable) - *Ajout du compte de paragraphes, mots, caractères*
- [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Suppression des pads qui n'ont jamais été édités*
- [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Possibilité de changer la couleur de la police*
- [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Possibilité de changer la taille de la police*
- [ep_headings2](https://www.npmjs.com/package/ep_headings2) - *Possibilité de définir des titres*
- [ep_markdown](https://www.npmjs.com/package/ep_markdown) - *Editiion et export en Markdown*
- [ep_spellcheck](https://www.npmjs.com/package/ep_spellcheck) - *Ajout de la correction orthographique*
- [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Support des exposants et indices*
**Version incluse :** 1.8.18~ynh2
@ -27,41 +43,6 @@ Etherpad est un éditeur collaboratif en temps réel évolutif pour des milliers
![Capture décran de Etherpad MyPads](./doc/screenshots/etherpad_demo.gif)
## Avertissements / informations importantes
## Configuration
Vous pouvez accéder à deux panneaux d'administration différents, pour Etherpad en accédant à `domain.tld/admin` et pour MyPads par `domain.tld/mypads/?/admin`. Vous pouvez également trouver le fichier de configuration pour Etherpad à `/var/www/etherpad_mypads/settings.json`.
*Skin Builder* (accessible à cette adresse `domain.tld/pad/p/test#skinvariantsbuilder`) vous permet de personnaliser l'apparence de votre pad. Il vous donnera un paramètre à copier dans votre fichier de configuration `/var/www/etherpad_mypads/settings.json`.
## Fonctionnalités spécifiques à YunoHost
#### Support multi-utilisateurs
* L'authentification LDAP est-elle prise en charge (pour l'accès MyPads uniquement) ? **Oui**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
## Limitations
## Informations additionnelles
* Ce paquet installera les plugins suivants :
* [ep_align](https://www.npmjs.com/package/ep_align) - *Ajoute Gauche/Centre/Droite/Justifier à des lignes de texte dans un pad*
* [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Ajoute des noms d'auteurs*
* [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Ajoute des commentaires sur la sidebar et le lie au texte.*
* [ep_countable](https://www.npmjs.com/package/ep_countable) - *Ajoute l'afficher le nombre de paragraphes, de mots et de caractères*
* [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Supprimer les pads qui n'ont jamais été édités*
* [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Appliquer les couleurs aux polices de caractères*
* [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Permet de définir la taille de la police*.
* [ep_headings2](https://www.npmjs.com/package/ep_headings2) - *Ajoute le support de titre à Etherpad Lite.*
* [ep_markdown](https://www.npmjs.com/package/ep_markdown) - *Modifier et exporter en tant que Markdown dans Etherpad*
* [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groupes et pads privés pour etherpad*
* [ep_spellcheck](https://www.npmjs.com/package/ep_spellcheck) - *Ajouter le support pour faire de la vérification orthographique*
* [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Ajouter la prise en charge de Subscript et Superscript*.
* [ep_table_of_contents](https://www.npmjs.com/package/ep_table_of_contents) - *Voir une table des matières pour votre pad*
## Documentations et ressources
* Site officiel de lapp : <http://etherpad.org>

View file

@ -1,35 +0,0 @@
[add_remove_abiword]
name = "Install/remove AbiWord"
command = "/bin/bash scripts/actions/add_remove_abiword"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "Install or remove AbiWord"
[add_remove_libreoffice]
name = "Install/remove LibreOffice"
command = "/bin/bash scripts/actions/add_remove_libreoffice"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "Install or remove LibreOffice"
[list_all_pads]
name = "List all existing pads"
command = "/bin/bash scripts/actions/list_all_pads"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "List all existing pads."
[reset_default_config]
name = "Reset the config file and restore a default one."
command = "/bin/bash scripts/actions/reset_default_config \"settings.json\""
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "Reset the config file settings.json."

View file

@ -1,75 +0,0 @@
;; Test complet avec LibreOffice et MyPads
; Manifest
domain="domain.tld"
path="/path"
is_public=1
language="en"
admin="john"
password="1Strong-Password"
export="libreoffice"
mypads=1
useldap=1
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
# 1.8.17~ynh1
upgrade=1 from_commit=4d613658f120a05537f11f6814cc28e09d74a3c8
backup_restore=1
multi_instance=1
change_url=1
;; Test sans MyPads
; Manifest
domain="domain.tld"
path="/path"
admin="john"
password="1Strong-Password"
language="en"
is_public=1
export="libreoffice"
mypads=0
useldap=0
; Checks
setup_sub_dir=1
setup_root=1
upgrade=1
backup_restore=1
;; Test Abiword
; Manifest
domain="domain.tld"
path="/path"
admin="john"
password="1Strong-Password"
language="en"
is_public=1
export="abiword"
mypads=1
useldap=0
; Checks
setup_root=1
# 1.8.17~ynh1
upgrade=1 from_commit=4d613658f120a05537f11f6814cc28e09d74a3c8
;; Test sans export
; Manifest
domain="domain.tld"
path="/path"
admin="john"
password="1Strong-Password"
language="en"
is_public=1
export="none"
mypads=1
useldap=0
; Checks
setup_root=1
;;; Options
Email=
Notification=change
;;; Upgrade options
; commit=4d613658f120a05537f11f6814cc28e09d74a3c8
name= #166
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=password&language=en&is_public=1&abiword=0&

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.8.18.tar.gz
SOURCE_SUM=67ccc0bac94e146b26fbddcf8330e0f543a4ff82213c420a376644614a7ff2c4
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,15 +1,15 @@
[Unit]
Description=Etherpad-lite, the collaborative editor.
Description=Etherpad-lite: the collaborative editor.
After=syslog.target network.target
[Service]
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/
WorkingDirectory=__INSTALL_DIR__/
Environment=NODE_ENV=production
Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=__YNH_NODE__ __FINALPATH__/src/node/server.js
ExecStart=__YNH_NODE__ __INSTALL_DIR__/src/node/server.js
StandardOutput=append:/var/log/__APP__/etherpad.log
StandardError=inherit
Restart=always

4
doc/ADMIN.md Normal file
View file

@ -0,0 +1,4 @@
You can access two different admin panels, for Etherpad by accessing `__DOMAIN____PATH__/admin` and for MyPads by `__DOMAIN____PATH__/mypads/?/admin`.
You can also find a configuration file for Etherpad at this path `__INSTALL_DIR__/settings.json`.
*Skin Builder* (accessible at this address `https://__DOMAIN____PATH__/pad/p/test#skinvariantsbuilder`) allows you to customize the skin of your pad. It will give you a parameter to copy into your configuration file `__INSTALL_DIR__/settings.json`.

3
doc/ADMIN_fr.md Normal file
View file

@ -0,0 +1,3 @@
Vous pouvez accéder à deux panneaux d'administration différents, pour Etherpad en accédant à `__DOMAIN____PATH__/admin` et pour MyPads par `domain.tld/mypads/?/admin`. Vous pouvez également trouver le fichier de configuration pour Etherpad à `__INSTALL_DIR__/settings.json`.
*Skin Builder* (accessible à cette adresse `https://__DOMAIN____PATH__/pad/p/test#skinvariantsbuilder`) vous permet de personnaliser l'apparence de votre pad. Il vous donnera un paramètre à copier dans votre fichier de configuration `__INSTALL_DIR__/settings.json`.

View file

@ -1,12 +1,17 @@
Etherpad is a real-time collaborative editor scalable to thousands of simultaneous real time users. It provides full data export capabilities, and runs on your server, under your control.
### Features
This version of Etherpad is preconfigured with a collection of plugins:
- Rich Editing - A full rich text WYSIWYG editor.
- Minimalist editor - A minimalist editor that can be embedded within your tool.
- Dark Mode - Theme settings to have Etherpad start in dark mode, ideal for using Etherpad at night or for long durations.
- Images - Plugins to improve provide Image support within a pad.
- Video Chat - Plugins to enable Video and Audio chat in a pad.
- Collaboration++ - Plugins to improve the really-real time collaboration experience, suitable for busy pads.
- Document Analysis - Plugins to improve author and document analysis during and post creation.
- Scale - Etherpad running at scale with pad sharding which allows Etherpad to scale to ∞ number of Active Pads with up to 20,000 edits per second, per pad.
- [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groups and private pads for etherpad*
- [ep_table_of_contents](https://www.npmjs.com/package/ep_table_of_contents) - *Display pad's table of contents*
- [ep_align](https://www.npmjs.com/package/ep_align) - *Add Left/Center/Right/Justify alignment*
- [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Display author names when hovereing text*
- [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Add comments on sidebar and link it to the text.*
- [ep_countable](https://www.npmjs.com/package/ep_countable) - *Add paragraphs, words and characters count*
- [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Delete pads which were never edited*
- [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Be able to change font color*
- [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Be able to change font size*
- [ep_headings2](https://www.npmjs.com/package/ep_headings2) - *Be able to set text as headers*
- [ep_markdown](https://www.npmjs.com/package/ep_markdown) - *Edit and export as Markdown*
- [ep_spellcheck](https://www.npmjs.com/package/ep_spellcheck) - *Add spell checking*
- [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Support for subscript and superscript*

View file

@ -1 +1,17 @@
Etherpad est un éditeur collaboratif en temps réel évolutif pour des milliers d'utilisateurs simultanés en temps réel. Il fournit des capacités complètes d'exportation de données et s'exécute sur votre serveur, sous votre contrôle.
Cette version d'Etherpad est préconfigurée avec une collection de plugins:
- [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groupes et pads privés pour etherpad*
- [ep_table_of_contents](https://www.npmjs.com/package/ep_table_of_contents) - *Affichage de la table des matières*
- [ep_align](https://www.npmjs.com/package/ep_align) - *Ajout de l'alignement à gauche/centre/droit/justifié*
- [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Affichage de l'auteur lorsqu'on passe la souris au dessus d'un texte*
- [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Ajout de commentaire dans la barre latéral + lien avec le texte du pad*
- [ep_countable](https://www.npmjs.com/package/ep_countable) - *Ajout du compte de paragraphes, mots, caractères*
- [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Suppression des pads qui n'ont jamais été édités*
- [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Possibilité de changer la couleur de la police*
- [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Possibilité de changer la taille de la police*
- [ep_headings2](https://www.npmjs.com/package/ep_headings2) - *Possibilité de définir des titres*
- [ep_markdown](https://www.npmjs.com/package/ep_markdown) - *Editiion et export en Markdown*
- [ep_spellcheck](https://www.npmjs.com/package/ep_spellcheck) - *Ajout de la correction orthographique*
- [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Support des exposants et indices*

View file

@ -1,31 +0,0 @@
## Configuration
You can access two different admin panels, for Etherpad by accessing `domain.tld/admin` and for MyPads by `domain.tld/mypads/?/admin`.
You can also find a configuration file for Etherpad at this path `/var/www/etherpad_mypads/settings.json`.
*Skin Builder* (accessible at this address `domain.tld/pad/p/test#skinvariantsbuilder`) allows you to customize the skin of your pad. It will give you a parameter to copy into your configuration file `/var/www/etherpad_mypads/settings.json`.
## YunoHost specific features
#### Multi-users support
* Is LDAP auth supported (for MyPads access only)? **Yes**
* Can the app be used by multiple users? **Yes**
## Additionnal informations
* This package will install the following plugins:
* [ep_align](https://www.npmjs.com/package/ep_align) - *Add Left/Center/Right/Justify to lines of text in a pad*
* [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Adds author names to span titles*
* [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Adds comments on sidebar and link it to the text.*
* [ep_countable](https://www.npmjs.com/package/ep_countable) - *Adds paragraphs, words and characters count*
* [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Delete pads which were never edited*
* [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Apply colors to fonts*
* [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Add support for Font Sizes*
* [ep_headings2](https://www.npmjs.com/package/ep_headings2) - *Adds heading support to Etherpad Lite.*
* [ep_markdown](https://www.npmjs.com/package/ep_markdown) - *Edit and Export as Markdown in Etherpad*
* [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groups and private pads for etherpad*
* [ep_spellcheck](https://www.npmjs.com/package/ep_spellcheck) - *Add support to do 'Spell checking'*
* [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Add support for Subscript and Superscript*
* [ep_table_of_contents](https://www.npmjs.com/package/ep_table_of_contents) - *View a table of contents for your pad*

View file

@ -1,32 +0,0 @@
## Configuration
Vous pouvez accéder à deux panneaux d'administration différents, pour Etherpad en accédant à `domain.tld/admin` et pour MyPads par `domain.tld/mypads/?/admin`. Vous pouvez également trouver le fichier de configuration pour Etherpad à `/var/www/etherpad_mypads/settings.json`.
*Skin Builder* (accessible à cette adresse `domain.tld/pad/p/test#skinvariantsbuilder`) vous permet de personnaliser l'apparence de votre pad. Il vous donnera un paramètre à copier dans votre fichier de configuration `/var/www/etherpad_mypads/settings.json`.
## Fonctionnalités spécifiques à YunoHost
#### Support multi-utilisateurs
* L'authentification LDAP est-elle prise en charge (pour l'accès MyPads uniquement) ? **Oui**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
## Limitations
## Informations additionnelles
* Ce paquet installera les plugins suivants :
* [ep_align](https://www.npmjs.com/package/ep_align) - *Ajoute Gauche/Centre/Droite/Justifier à des lignes de texte dans un pad*
* [ep_author_hover](https://www.npmjs.com/package/ep_author_hover) - *Ajoute des noms d'auteurs*
* [ep_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Ajoute des commentaires sur la sidebar et le lie au texte.*
* [ep_countable](https://www.npmjs.com/package/ep_countable) - *Ajoute l'afficher le nombre de paragraphes, de mots et de caractères*
* [ep_delete_empty_pads](https://www.npmjs.com/package/ep_delete_empty_pads) - *Supprimer les pads qui n'ont jamais été édités*
* [ep_font_color](https://www.npmjs.com/package/ep_font_color) - *Appliquer les couleurs aux polices de caractères*
* [ep_font_size](https://www.npmjs.com/package/ep_font_size) - *Permet de définir la taille de la police*.
* [ep_headings2](https://www.npmjs.com/package/ep_headings2) - *Ajoute le support de titre à Etherpad Lite.*
* [ep_markdown](https://www.npmjs.com/package/ep_markdown) - *Modifier et exporter en tant que Markdown dans Etherpad*
* [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groupes et pads privés pour etherpad*
* [ep_spellcheck](https://www.npmjs.com/package/ep_spellcheck) - *Ajouter le support pour faire de la vérification orthographique*
* [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Ajouter la prise en charge de Subscript et Superscript*.
* [ep_table_of_contents](https://www.npmjs.com/package/ep_table_of_contents) - *Voir une table des matières pour votre pad*

3
doc/POST_INSTALL.md Normal file
View file

@ -0,0 +1,3 @@
You can access two different admin panels:
- for Etherpad by accessing https://__DOMAIN____PATH__/admin
- for MyPads (if installed) by accessing https://__DOMAIN____PATH__/mypads/?/admin

View file

@ -1,128 +0,0 @@
{
"name": "Etherpad MyPads",
"id": "etherpad_mypads",
"packaging_format": 1,
"description": {
"en": "Online editor providing collaborative editing in real-time",
"fr": "Éditeur en ligne fournissant l'édition collaborative en temps réel"
},
"version": "1.8.18~ynh2",
"url": "http://etherpad.org",
"upstream": {
"license": "Apache-2.0",
"website": "http://etherpad.org",
"demo": "https://video.etherpad.com",
"admindoc": "http://etherpad.org/doc/v1.8.18",
"code": "https://github.com/ether/etherpad-lite"
},
"license": "Apache-2.0",
"maintainer": {
"name": "",
"email": ""
},
"previous_maintainers": [
{
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
}
],
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
"nginx",
"mysql"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/pad",
"default": "/pad"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If your Etherpad instance is public, everyone will be able to create a pad or see an existing one.",
"fr": "Si votre instance Etherpad est publique, tout le monde pourra créer un pad ou voir un pad existant."
},
"default": true
},
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose your language",
"fr": "Choisissez la langue"
},
"choices": [
"ca",
"de",
"en",
"es",
"fr",
"gl",
"hu",
"it",
"nl",
"pt"
],
"default": "en"
},
{
"name": "admin",
"type": "user"
},
{
"name": "password",
"type": "password"
},
{
"name": "export",
"type": "string",
"ask": {
"en": "Use AbiWord (~260 Mo) or LibreOffice (~400 Mo) (more stable) to expand export possibilities (PDF, doc)?",
"fr": "Utiliser AbiWord (~260 Mo) ou LibreOffice (~400 Mo) (plus stable) pour étendre les possibilités d'export (PDF, doc) ?"
},
"choices": [
"none",
"abiword",
"libreoffice"
],
"default": "none"
},
{
"name": "mypads",
"type": "boolean",
"ask": {
"en": "Do you want to install MyPads plugin?",
"fr": "Voulez-vous installer le plugin MyPads ?"
},
"help": {
"en": "<a href=https://git.framasoft.org/framasoft/ep_mypads target=_blank>MyPads plugin</a>"
},
"default": true
},
{
"name": "useldap",
"type": "boolean",
"ask": {
"en": "Do you want to use LDAP with MyPads?",
"fr": "Voulez-vous utiliser LDAP avec MyPads ?"
},
"help": {
"en": "Using LDAP won't let you add new user aside from YunoHost users.",
"fr": "Utiliser LDAP ne vous permettra pas d'ajouter un nouvel utilisateur en dehors des utilisateurs de YunoHost."
},
"default": true
}
]
}
}

115
manifest.toml Normal file
View file

@ -0,0 +1,115 @@
packaging_format = 2
id = "etherpad_mypads"
name = "Etherpad MyPads"
description.en = "Online editor providing collaborative editing in real-time"
description.fr = "Éditeur en ligne fournissant l'édition collaborative en temps réel"
version = "1.8.18~ynh2"
maintainers = []
[upstream]
license = "Apache-2.0"
website = "http://etherpad.org"
demo = "https://video.etherpad.com"
admindoc = "http://etherpad.org/doc/v1.8.18"
code = "https://github.com/ether/etherpad-lite"
[integration]
yunohost = ">= 11.1.19"
architectures = "all"
multi_instance = true
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/pad"
[install.init_main_permission]
help.en = "If your Etherpad instance is set to Visitors, everyone will be able to create a pad or see an existing one."
help.fr = "Si votre instance Etherpad est définie sur Visiteurs, tout le monde pourra créer un pad ou en voir un existant."
type = "group"
default = "visitors"
[install.language]
ask.en = "Choose your language"
ask.fr = "Choisissez la langue"
type = "string"
choices = ["ca", "de", "en", "es", "fr", "gl", "hu", "it", "nl", "pt"]
default = "en"
[install.admin]
type = "user"
[install.password]
type = "password"
[install.export]
ask.en = "Use AbiWord (~260 Mo) or LibreOffice (~400 Mo) (more stable) to expand export possibilities (PDF, doc)?"
ask.fr = "Utiliser AbiWord (~260 Mo) ou LibreOffice (~400 Mo) (plus stable) pour étendre les possibilités d'export (PDF, doc) ?"
type = "string"
choices = ["none", "abiword", "libreoffice"]
default = "none"
[install.mypads]
ask.en = "Do you want to install MyPads plugin?"
ask.fr = "Voulez-vous installer le plugin MyPads ?"
help.en = "<a href=https://git.framasoft.org/framasoft/ep_mypads target=_blank>MyPads plugin</a>"
type = "boolean"
default = true
[install.useldap]
ask.en = "Do you want to use LDAP with MyPads?"
ask.fr = "Voulez-vous utiliser LDAP avec MyPads ?"
help.en = "Using LDAP won't let you add new user aside from YunoHost users."
help.fr = "Utiliser LDAP ne vous permettra pas d'ajouter un nouvel utilisateur en dehors des utilisateurs de YunoHost."
type = "boolean"
default = true
[resources]
[resources.sources]
[resources.sources.main]
url = "https://github.com/ether/etherpad-lite/archive/1.8.18.tar.gz"
sha256 = "67ccc0bac94e146b26fbddcf8330e0f543a4ff82213c420a376644614a7ff2c4"
autoupdate.strategy = "latest_github_tag"
[resources.system_user]
[resources.install_dir]
[resources.ports]
[resources.permissions]
main.url = "/"
admin.url = "/admin"
admin.auth_header = false
api.show_tile = false
admin.allowed = ["admins"]
[resources.apt]
packages = "mariadb-server"
packages_from_raw_bash = """
if [[ "$export" == "libreoffice" ]]
then
echo "unoconv libreoffice-writer"
elif [[ "$export" == "abiword" ]]
then
echo "abiword"
fi
"""
[resources.database]
type = "mysql"

View file

@ -4,12 +4,6 @@
# COMMON VARIABLES
#=================================================
# Dependencies for AbiWord
abiword_app_depencencies="abiword"
# Dependencies for LibreOffice
libreoffice_app_dependencies="unoconv libreoffice-writer"
# NodeJS version
nodejs_version=14
@ -39,151 +33,10 @@ ep_font_size_version=0.4.44
# EXPERIMENTAL HELPERS
#=================================================
# Send an email to inform the administrator
#
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
# | arg: -m --app_message= - The file with the content to send to the administrator.
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
# example: "root admin@domain"
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
# example: "root admin@domain user1 user2"
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
ynh_send_readme_to_admin() {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
local app_message
local recipients
local type
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
app_message="${app_message:-}"
recipients="${recipients:-root}"
type="${type:-install}"
# Get the value of admin_mail_html
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
admin_mail_html="${admin_mail_html:-0}"
# Retrieve the email of users
find_mails () {
local list_mails="$1"
local mail
local recipients=" "
# Read each mail in argument
for mail in $list_mails
do
# Keep root or a real email address as it is
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
then
recipients="$recipients $mail"
else
# But replace an user name without a domain after by its email
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
then
recipients="$recipients $mail"
fi
fi
done
echo "$recipients"
}
recipients=$(find_mails "$recipients")
# Subject base
local mail_subject="☁️🆈🅽🅷☁️: \`$app\`"
# Adapt the subject according to the type of mail required.
if [ "$type" = "backup" ]; then
mail_subject="$mail_subject has just been backup."
elif [ "$type" = "change_url" ]; then
mail_subject="$mail_subject has just been moved to a new URL!"
elif [ "$type" = "remove" ]; then
mail_subject="$mail_subject has just been removed!"
elif [ "$type" = "restore" ]; then
mail_subject="$mail_subject has just been restored!"
elif [ "$type" = "upgrade" ]; then
mail_subject="$mail_subject has just been upgraded!"
else # install
mail_subject="$mail_subject has just been installed!"
fi
local mail_message="This is an automated message from your beloved YunoHost server.
Specific information for the application $app.
$(if [ -n "$app_message" ]
then
cat "$app_message"
else
echo "...No specific information..."
fi)
---
Automatic diagnosis data from YunoHost
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
# Store the message into a file for further modifications.
echo "$mail_message" > mail_to_send
# If a html email is required. Apply html tags to the message.
if [ "$admin_mail_html" -eq 1 ]
then
# Insert 'br' tags at each ending of lines.
ynh_replace_string "$" "<br>" mail_to_send
# Insert starting HTML tags
sed --in-place '1s@^@<!DOCTYPE html>\n<html>\n<head></head>\n<body>\n@' mail_to_send
# Keep tabulations
ynh_replace_string " " "\&#160;\&#160;" mail_to_send
ynh_replace_string "\t" "\&#160;\&#160;" mail_to_send
# Insert url links tags
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
# Insert pre tags
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
# Insert finishing HTML tags
echo -e "\n</body>\n</html>" >> mail_to_send
# Otherwise, remove tags to keep a plain text.
else
# Remove URL tags
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
# Remove PRE tags
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
fi
# Define binary to use for mail command
if [ -e /usr/bin/bsd-mailx ]
then
local mail_bin=/usr/bin/bsd-mailx
else
local mail_bin=/usr/bin/mail.mailutils
fi
if [ "$admin_mail_html" -eq 1 ]
then
content_type="text/html"
else
content_type="text/plain"
fi
# Send the email to the recipients
cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
}
#=================================================
ynh_maintenance_mode_ON () {
# Load value of $path_url and $domain from the config if their not set
if [ -z $path_url ]; then
path_url=$(ynh_app_setting_get $app path)
# Load value of $path and $domain from the config if their not set
if [ -z $path ]; then
path=$(ynh_app_setting_get $app path)
fi
if [ -z $domain ]; then
domain=$(ynh_app_setting_get $app domain)
@ -213,10 +66,10 @@ ynh_maintenance_mode_ON () {
</html>" > "/var/www/html/maintenance.$app.html"
# Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice
rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect;
echo "# All request to the app will be redirected to ${path}_maintenance and fall on the maintenance notice
rewrite ^${path}/(.*)$ ${path}_maintenance/? redirect;
# Use another location, to not be in conflict with the original config file
location ${path_url}_maintenance/ {
location ${path}_maintenance/ {
alias /var/www/html/ ;
try_files maintenance.$app.html =503;
@ -227,7 +80,7 @@ include conf.d/yunohost_panel.conf.inc;
# The current config file will redirect all requests to the root of the app.
# To keep the full path, we can use the following rewrite rule:
# rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect;
# rewrite ^${path}/(.*)$ ${path}_maintenance/\$1? redirect;
# The difference will be in the $1 at the end, which keep the following queries.
# But, if it works perfectly for a html request, there's an issue with any php files.
# This files are treated as simple files, and will be downloaded by the browser.
@ -237,16 +90,16 @@ include conf.d/yunohost_panel.conf.inc;
}
ynh_maintenance_mode_OFF () {
# Load value of $path_url and $domain from the config if their not set
if [ -z $path_url ]; then
path_url=$(ynh_app_setting_get $app path)
# Load value of $path and $domain from the config if their not set
if [ -z $path ]; then
path=$(ynh_app_setting_get $app path)
fi
if [ -z $domain ]; then
domain=$(ynh_app_setting_get $app domain)
fi
# Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app.
echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
# Rewrite the nginx config file to redirect from ${path}_maintenance to the real url of the app.
echo "rewrite ^${path}_maintenance/(.*)$ ${path}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
systemctl reload nginx
# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
@ -259,144 +112,6 @@ ynh_maintenance_mode_OFF () {
systemctl reload nginx
}
#=================================================
# Create a changelog for an app after an upgrade from the file CHANGELOG.md.
#
# usage: ynh_app_changelog [--format=markdown/html/plain] [--output=changelog_file] --changelog=changelog_source]
# | arg: -f --format= - Format in which the changelog will be printed
# markdown: Default format.
# html: Turn urls into html format.
# plain: Plain text changelog
# | arg: -o --output= - Output file for the changelog file (Default ./changelog)
# | arg: -c --changelog= - CHANGELOG.md source (Default ../CHANGELOG.md)
#
# The changelog is printed into the file ./changelog and ./changelog_lite
ynh_app_changelog () {
# Declare an array to define the options of this helper.
local legacy_args=foc
declare -Ar args_array=( [f]=format= [o]=output= [c]=changelog= )
local format
local output
local changelog
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
format=${format:-markdown}
output=${output:-changelog}
changelog=${changelog:-../CHANGELOG.md}
local original_changelog="$changelog"
local temp_changelog="changelog_temp"
local final_changelog="$output"
if [ ! -n "$original_changelog" ]
then
echo "No changelog available..." > "$final_changelog"
echo "No changelog available..." > "${final_changelog}_lite"
return 0
fi
local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version")
local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version")
# Get the line of the version to update to into the changelog
local update_version_line=$(grep --max-count=1 --line-number "^## \[$update_version" "$original_changelog" | cut -d':' -f1)
# If there's no entry for this version yet into the changelog
# Get the first available version
if [ -z "$update_version_line" ]
then
update_version_line=$(grep --max-count=1 --line-number "^##" "$original_changelog" | cut -d':' -f1)
fi
# Get the length of the complete changelog.
local changelog_length=$(wc --lines "$original_changelog" | awk '{print $1}')
# Cut the file before the version to update to.
tail --lines=$(( $changelog_length - $update_version_line + 1 )) "$original_changelog" > "$temp_changelog"
# Get the length of the troncated changelog.
changelog_length=$(wc --lines "$temp_changelog" | awk '{print $1}')
# Get the line of the current version into the changelog
# Keep only the last line found
local current_version_line=$(grep --line-number "^## \[$current_version" "$temp_changelog" | cut -d':' -f1 | tail --lines=1)
# If there's no entry for this version into the changelog
# Get the last available version
if [ -z "$current_version_line" ]
then
current_version_line=$(grep --line-number "^##" "$original_changelog" | cut -d':' -f1 | tail --lines=1)
fi
# Cut the file before the current version.
# Then grep the previous version into the changelog to get the line number of the previous version
local previous_version_line=$(tail --lines=$(( $changelog_length - $current_version_line )) \
"$temp_changelog" | grep --max-count=1 --line-number "^## " | cut -d':' -f1)
# If there's no previous version into the changelog
# Go until the end of the changelog
if [ -z "$previous_version_line" ]
then
previous_version_line=$changelog_length
fi
# Cut the file after the previous version to keep only the changelog between the current version and the version to update to.
head --lines=$(( $current_version_line + $previous_version_line - 1 )) "$temp_changelog" | tee "$final_changelog"
if [ "$format" = "html" ]
then
# Replace markdown links by html links
ynh_replace_string --match_string="\[\(.*\)\](\(.*\)))" --replace_string="<a href=\"\2\">\1</a>)" --target_file="$final_changelog"
ynh_replace_string --match_string="\[\(.*\)\](\(.*\))" --replace_string="<a href=\"\2\">\1</a>" --target_file="$final_changelog"
elif [ "$format" = "plain" ]
then
# Change title format.
ynh_replace_string --match_string="^##.*\[\(.*\)\](\(.*\)) - \(.*\)$" --replace_string="## \1 (\3) - \2" --target_file="$final_changelog"
# Change modifications lines format.
ynh_replace_string --match_string="^\([-*]\).*\[\(.*\)\]\(.*\)" --replace_string="\1 \2 \3" --target_file="$final_changelog"
fi
# else markdown. As the file is already in markdown, nothing to do.
# Keep only important changes into the changelog
# Remove all minor changes
sed '/^-/d' "$final_changelog" > "${final_changelog}_lite"
# Remove all blank lines (to keep a clear workspace)
sed --in-place '/^$/d' "${final_changelog}_lite"
# Add a blank line at the end
echo "" >> "${final_changelog}_lite"
# Clean titles if there's no significative changes
local line
local previous_line=""
while read line <&3
do
if [ -n "$previous_line" ]
then
# Remove the line if it's a title or a blank line, and the previous one was a title as well.
if ( [ "${line:0:1}" = "#" ] || [ ${#line} -eq 0 ] ) && [ "${previous_line:0:1}" = "#" ]
then
ynh_replace_special_string --match_string="${previous_line//[/.}" --replace_string="" --target_file="${final_changelog}_lite"
fi
fi
previous_line="$line"
done 3< "${final_changelog}_lite"
# Remove all blank lines again
sed --in-place '/^$/d' "${final_changelog}_lite"
# Restore changelog format with blank lines
ynh_replace_string --match_string="^##.*" --replace_string="\n\n&\n" --target_file="${final_changelog}_lite"
# Remove the 2 first blank lines
sed --in-place '1,2d' "${final_changelog}_lite"
# Add a blank line at the end
echo "" >> "${final_changelog}_lite"
# If changelog are empty, add an info
if [ $(wc --words "$final_changelog" | awk '{print $1}') -eq 0 ]
then
echo "No changes from the changelog..." > "$final_changelog"
fi
if [ $(wc --words "${final_changelog}_lite" | awk '{print $1}') -eq 0 ]
then
echo "No significative changes from the changelog..." > "${final_changelog}_lite"
fi
}
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -1,110 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
# Check the dependencies of the meta packages of etherpad_mypads with apt-cache
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet abiword
then
# Abiword is already a dependence of etherpad_mypads.
# Abiword should be removed.
abiword=0
action1=removed
action2=Removing
else
# Abiword isn't a dependence of etherpad_mypads.
# Abiword should be installed.
abiword=1
action1=installed
action2=Installing
fi
ynh_print_info --message="Abiword will be $action1."
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer
then
# LibreOffice is already a dependence of Etherpad MyPads.
# Keep it
libreoffice=1
else
# LibreOffice isn't a dependence of Etherpad MyPads.
# Do not add it
libreoffice=0
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# INSTALL OR REMOVE ABIWORD
#=================================================
ynh_script_progression --message="$action2 AbiWord..." --weight=3
dependencies=""
if [ $abiword -eq 1 ]
then
# Add abiword dependencies if Abiword has to be installed
dependencies="$dependencies $abiword_app_depencencies"
fi
if [ $libreoffice -eq 1 ]
then
# Add LibreOffice dependencies if LibreOffice is already installed to keep it as a dependence.
dependencies="$dependencies $libreoffice_app_dependencies"
fi
# Rebuild the meta package and install the new dependencies
( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it.
ynh_exec_warn_less ynh_install_app_dependencies $dependencies)
# Remove all unused dependencies
ynh_package_autopurge
#=================================================
# SET THE DEFAULT EXPORT APP
#=================================================
if [ $abiword -eq 1 ]
then
# Set Abiword as default export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword"
elif [ $libreoffice -eq 1 ]
then
# Set LibreOffice as default export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice"
else
# Remove any export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=none"
fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

View file

@ -1,110 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
# Check the dependencies of the meta packages of Etherpad MyPads with apt-cache
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer
then
# LibreOffice is already a dependence of Etherpad myPads.
# LibreOffice should be removed.
libreoffice=0
action1=removed
action2=Removing
else
# LibreOffice isn't a dependence of Etherpad MyPads.
# LibreOffice should be installed.
libreoffice=1
action1=installed
action2=Installing
fi
ynh_print_info --message="LibreOffice will be $action1."
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet abiword
then
# Abiword is already a dependence of Etherpad MyPads.
# Keep it
abiword=1
else
# Abiword isn't a dependence of Etherpad MyPads.
# Do not add it
abiword=0
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# INSTALL OR REMOVE LIBREOFFICE
#=================================================
ynh_script_progression --message="$action2 LibreOffice..." --weight=3
dependencies=""
if [ $libreoffice -eq 1 ]
then
# Add LibreOffice dependencies if LibreOffice has to be installed
dependencies="$dependencies $libreoffice_app_dependencies"
fi
if [ $abiword -eq 1 ]
then
# Add Abiword dependencies if abiword is already installed to keep it as a dependence.
dependencies="$dependencies $abiword_app_depencencies"
fi
# Rebuild the meta package and install the new dependencies
( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it.
ynh_exec_warn_less ynh_install_app_dependencies $dependencies)
# Remove all unused dependencies
ynh_package_autopurge
#=================================================
# SET THE DEFAULT EXPORT APP
#=================================================
if [ $libreoffice -eq 1 ]
then
# Set LibreOffice as default export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice"
elif [ $abiword -eq 1 ]
then
# Set Abiword as default export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword"
else
# Remove any export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=none"
fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

View file

@ -1,57 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
#=================================================
# SPECIFIC ACTION
#=================================================
# LIST ALL PADS FROM THE DATABASE
#=================================================
ynh_script_progression --message="Listing all pads..." --weight=3
# Get the list of pads from the database
pad_list="$(ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< \
"select distinct substring(store.key,5,locate(\":\",store.key,5)-5) as \"pads\" from store where store.key like \"pad:%\"")"
# Remove empty lines
# Name the first line "> List of pads"
# Then for the second lines and following, add >> before the name of the pad.
ynh_print_info --message="$(echo "$pad_list" | sed '/^$/d' | sed '1 s/^/> List of /' | sed '2,$s/^/>> /g')"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

View file

@ -1,96 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
export=$(ynh_app_setting_get --app=$app --key=export)
language=$(ynh_app_setting_get --app=$app --key=language)
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
useldap=$(ynh_app_setting_get --app=$app --key=useldap)
#=================================================
# SORT OUT THE CONFIG FILE TO HANDLE
#=================================================
file="$1"
if [ "$file" = "settings.json" ]; then
config_file="$final_path/settings.json"
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# RESET THE CONFIG FILE
#=================================================
ynh_script_progression --message="Resetting the config file $config_file..." --weight=3
# Verify the checksum and backup the file if it's different
ynh_backup_if_checksum_is_different --file="$config_file"
if [ "$file" = "settings.json" ]
then
# Get the default file and overwrite the current config
cp /etc/yunohost/apps/$app/conf/settings.json "$config_file"
# Recreate the default config
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
if [ "$export" = "abiword" ]
then
# Get abiword binary path
abiword_path=`which abiword`
# Set the path of abiword into etherpad config
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
elif [ "$export" = "libreoffice" ]
then
# Get soffice binary path
soffice_path=`which soffice`
# Set the path of soffice into etherpad config
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
fi
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
# Use ldap for mypads
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
then
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$final_path/settings.json"
fi
fi
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config_file"
#=================================================
# CHECK ETHERPAD STARTING
#=================================================
ynh_script_progression --message="Restarting Etherpad..." --weight=9
# Wait for etherpad to be fully started
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last

View file

@ -10,27 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@ -40,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -13,72 +13,12 @@ fi
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=5
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=40
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# 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"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Activating maintenance mode..." --weight=2
path_url=$old_path
domain=$old_domain
ynh_maintenance_mode_ON
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -86,29 +26,7 @@ fi
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
ynh_change_url_nginx_config
#=================================================
# GENERIC FINALISATION
@ -120,20 +38,10 @@ ynh_script_progression --message="Starting a systemd service..." --weight=10
# Start a systemd service
ynh_systemd_action --service_name=$app --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Disabling the maintenance mode..." --weight=5
path_url=$old_path
domain=$old_domain
ynh_maintenance_mode_OFF
#=================================================

View file

@ -10,16 +10,6 @@
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# SPECIFIC CODE
#=================================================

View file

@ -13,108 +13,29 @@ fi
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
password="$YNH_APP_ARG_PASSWORD"
export=$YNH_APP_ARG_EXPORT
mypads=$YNH_APP_ARG_MYPADS
useldap=$YNH_APP_ARG_USELDAP
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
if [ "${#password}" -lt 8 ] || [ "${#password}" -gt 30 ]
then
ynh_die --message="The password must be between 8 and 30 characters."
fi
final_path=/var/www/$app
test ! -e "$final_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
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=3
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=password --value="$password"
ynh_app_setting_set --app=$app --key=export --value=$export
ynh_app_setting_set --app=$app --key=mypads --value=$mypads
ynh_app_setting_set --app=$app --key=useldap --value=$useldap
ynh_app_setting_set --app=$app --key=overwrite_settings --value="1"
ynh_app_setting_set --app=$app --key=overwrite_credentials --value="1"
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1"
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="1"
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=2
# Find an available port
port=$(ynh_find_port --port=9001)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=120
if [ "$export" = "abiword" ]; then
ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
elif [ "$export" = "libreoffice" ]; then
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
fi
ynh_script_progression --message="Installing nodejs..." --weight=50
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..." --weight=1
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
ynh_script_progression --message="Initializing MySQL database..." --weight=1
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
@ -123,13 +44,11 @@ echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# NGINX CONFIGURATION
@ -156,40 +75,40 @@ chown $app -R /var/log/$app
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=6
cp ../conf/settings.json "$final_path/settings.json"
cp ../conf/settings.json "$install_dir/settings.json"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$install_dir/settings.json"
if [ "$export" = "abiword" ]
then
# Get Abiword binary path
abiword_path=`which abiword`
# Set the path of abiword into Etherpad config
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$install_dir/settings.json"
elif [ "$export" = "libreoffice" ]
then
# Get soffice binary path
soffice_path=`which soffice`
# Set the path of soffice into Etherpad config
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$install_dir/settings.json"
fi
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$install_dir/settings.json"
# Use ldap for mypads
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
then
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$install_dir/settings.json"
fi
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/settings.json"
ynh_store_file_checksum --file="$install_dir/settings.json"
ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json"
ynh_add_config --template="../conf/credentials.json" --destination="$install_dir/credentials.json"
chmod 600 "$final_path/settings.json"
chown $app:$app "$final_path/settings.json"
chmod 600 "$install_dir/settings.json"
chown $app:$app "$install_dir/settings.json"
chmod 600 "$final_path/credentials.json"
chown $app:$app "$final_path/credentials.json"
chmod 600 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json"
#=================================================
# SETUP SYSTEMD
@ -204,7 +123,7 @@ ynh_add_systemd_config
#=================================================
ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
pushd "$final_path"
pushd "$install_dir"
# Add Left/Center/Right/Justify to lines of text in a pad
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_align@${ep_align_version}
# Framapad - Adds author names to span titles
@ -240,7 +159,7 @@ popd
#=================================================
ynh_script_progression --message="Installing Etherpad..." --weight=90
pushd $final_path
pushd $install_dir
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH bin/installDeps.sh
popd
@ -250,17 +169,17 @@ popd
if [ $mypads -eq 1 ]
then
ynh_script_progression --message="Some hacks..." --weight=1
ynh_script_progression --message="Tweaking mypad configuration..." --weight=1
# Add a link to Etherpad to allow anonymous pads creation from MyPads.
ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*</ul>" --replace_string="&<a href=../>Pads anonymes</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json
ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*</ul>" --replace_string="&<a href=../>Anonymous pads</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json
ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*</ul>" --replace_string="&<a href=../>Pads anonymes</a>" --target_file=$install_dir/node_modules/ep_mypads/static/l10n/fr.json
ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*</ul>" --replace_string="&<a href=../>Anonymous pads</a>" --target_file=$install_dir/node_modules/ep_mypads/static/l10n/en.json
# And a link to etherpad admin from Mypads.
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --target_file=$install_dir/node_modules/ep_mypads/static/l10n/en.json
ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | <a href='../admin'>Etherpad admin</a>" --target_file=$install_dir/node_modules/ep_mypads/static/l10n/fr.json
# Find the /div just after the field to open a pad in order to add a link to MyPads plugin.
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $final_path/src/templates/index.html
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $install_dir/src/templates/index.html
fi
#=================================================
@ -305,50 +224,6 @@ ynh_script_progression --message="Configuring Fail2Ban..." --weight=13
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=2
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
# Only the admin can access the admin panel of the app (if the app has an admin panel)
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin --auth_header=false
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the URL of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
if [ $mypads -eq 1 ]
then
Informations="You can access two different admin panels, for Etherpad by accessing https://$domain${path_url%/}/admin and for MyPads by accessing https://$domain${path_url%/}/mypads/?/admin."
else
Informations="You can access the admin panel by accessing https://$domain${path_url%/}/admin."
fi
echo "$Informations
You can also find a config file for Etherpad at this path /var/www/etherpad_mypads/settings.json.
If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=install
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -14,20 +14,14 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=3
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
export=$(ynh_app_setting_get --app=$app --key=export)
#=================================================
# STANDARD REMOVE
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
@ -36,87 +30,23 @@ then
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..." --weight=2
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
if [ "$export" != "none" ]
then
# Remove metapackage and its dependencies
ynh_exec_warn_less ynh_remove_app_dependencies
fi
ynh_remove_nodejs
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=7
# Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=2
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,173 +10,75 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=3
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)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
export=$(ynh_app_setting_get --app=$app --key=export)
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
admin=$(ynh_app_setting_get --app=$app --key=admin)
password=$(ynh_app_setting_get --app=$app --key=password)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
chmod 600 "$final_path/settings.json"
chown $app:$app "$final_path/settings.json"
chmod 600 "$install_dir/settings.json"
chown $app:$app "$install_dir/settings.json"
chmod 600 "$final_path/credentials.json"
chown $app:$app "$final_path/credentials.json"
chmod 600 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json"
#=================================================
# RESTORE FAIL2BAN CONFIGURATION
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=6
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --action=restart --service_name=fail2ban
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=60
if [ "$export" = "abiword" ]; then
ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
elif [ "$export" = "libreoffice" ]; then
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
fi
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
mkdir -p /var/log/$app
touch /var/log/$app/etherpad.log
chown $app -R /var/log/$app
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=2
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# HANDLE LOG FILES AND LOGROTATE
# GENERIC FINALIZATION
#=================================================
mkdir -p /var/log/$app
touch /var/log/$app/etherpad.log
chown $app -R /var/log/$app
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# 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
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=8
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --action=reload --service_name=nginx
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
if [ $mypads -eq 1 ]
then
Informations="You can access 2 different admin panels, for Etherpad by accessing https://$domain${path_url%/}/admin and for MyPads by accessing https://$domain${path_url%/}/mypads/?/admin."
else
Informations="You can access to the admin panel, by accessing https://$domain${path_url%/}/admin."
fi
echo "$Informations
You can also find a config file for Etherpad at this path /var/www/etherpad_mypads/settings.json.
If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=restore
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -14,18 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=20
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
export=$(ynh_app_setting_get --app=$app --key=export)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
password=$(ynh_app_setting_get --app=$app --key=password)
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
useldap=$(ynh_app_setting_get --app=$app --key=useldap)
@ -52,20 +41,6 @@ ynh_systemd_action --action=restart --line_match="You can access your Etherpad i
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=35
# 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
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
@ -87,12 +62,6 @@ ynh_systemd_action --service_name=$app --action="stop"
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If abiword setting doesn't exist
if [ -z "$abiword" ]; then
abiword=0
@ -126,10 +95,10 @@ if [ -z "$useldap" ]; then
ynh_app_setting_set --app=$app --key=useldap --value=$useldap
fi
# If path_url setting doesn't exist
if [ -z "$path_url" ]; then
path_url="/"
ynh_app_setting_set --app=$app --key=path --value=$path_url
# If path setting doesn't exist
if [ -z "$path" ]; then
path="/"
ynh_app_setting_set --app=$app --key=path --value=$path
fi
# If overwrite_settings doesn't exist, create it
@ -156,34 +125,10 @@ if [ -z "$overwrite_systemd" ]; then
ynh_app_setting_set --app=$app --key=overwrite_systemd --value=$overwrite_systemd
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
else
# Make sure the admin panel is not exposed to the SSO's authentication headers
# AFAIK there is no helper to check if that flag is up or not, so let's force it.
ynh_permission_url --permission="admin" --auth_header=false
fi
# Support full Unicode in MySQL databases
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
#=================================================
# 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
#=================================================
@ -193,24 +138,17 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=4
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --keep="settings.json credentials.json"
ynh_setup_source --dest_dir="$install_dir" --keep="settings.json credentials.json"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=5
if [ "$export" = "abiword" ]; then
ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
elif [ "$export" = "libreoffice" ]; then
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
fi
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
@ -247,22 +185,22 @@ then
if [ $overwrite_settings -eq 1 ]
then
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different --file="$final_path/settings.json"
cp ../conf/settings.json "$final_path/settings.json"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
ynh_backup_if_checksum_is_different --file="$install_dir/settings.json"
cp ../conf/settings.json "$install_dir/settings.json"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$install_dir/settings.json"
if [ "$export" = "abiword" ]
then
# Get abiword binary path
abiword_path=`which abiword`
# Set the path of Abiword into Etherpad config
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$install_dir/settings.json"
elif [ "$export" = "libreoffice" ]
then
# Get soffice binary path
soffice_path=`which soffice`
# Set the path of soffice into Etherpad config
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$install_dir/settings.json"
fi
if test -z "$language"; then
@ -270,47 +208,47 @@ then
language=en
ynh_app_setting_set --app=$app --key=language --value=$language
fi
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$install_dir/settings.json"
# Use LDAP for MyPads
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
then
ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$install_dir/settings.json"
fi
# Optional parameters from config-panel feature
if [ -n "$pad_config_nocolors" ]; then
ynh_replace_string --match_string="\(\"noColors\" *: \).*," --replace_string="\1$pad_config_nocolors," --target_file="$final_path/settings.json"
ynh_replace_string --match_string="\(\"noColors\" *: \).*," --replace_string="\1$pad_config_nocolors," --target_file="$install_dir/settings.json"
fi
if [ -n "$pad_config_showlinenumbers" ]; then
ynh_replace_string --match_string="\(\"showLineNumbers\" *: \).*," --replace_string="\1$pad_config_showlinenumbers," --target_file="$final_path/settings.json"
ynh_replace_string --match_string="\(\"showLineNumbers\" *: \).*," --replace_string="\1$pad_config_showlinenumbers," --target_file="$install_dir/settings.json"
fi
if [ -n "$pad_config_chatandusers" ]; then
ynh_replace_string --match_string="\(\"chatAndUsers\" *: \).*," --replace_string="\1$pad_config_chatandusers," --target_file="$final_path/settings.json"
ynh_replace_string --match_string="\(\"chatAndUsers\" *: \).*," --replace_string="\1$pad_config_chatandusers," --target_file="$install_dir/settings.json"
fi
if [ -n "$pad_config_alwaysshowchat" ]; then
ynh_replace_string --match_string="\(\"alwaysShowChat\" *: \).*," --replace_string="\1$pad_config_alwaysshowchat," --target_file="$final_path/settings.json"
ynh_replace_string --match_string="\(\"alwaysShowChat\" *: \).*," --replace_string="\1$pad_config_alwaysshowchat," --target_file="$install_dir/settings.json"
fi
if [ -n "$pad_config_show_markdown" ]; then
ynh_replace_string --match_string="\(\"ep_markdown_default\" *: \).*," --replace_string="\1$pad_config_show_markdown," --target_file="$final_path/settings.json"
ynh_replace_string --match_string="\(\"ep_markdown_default\" *: \).*," --replace_string="\1$pad_config_show_markdown," --target_file="$install_dir/settings.json"
fi
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/settings.json"
ynh_store_file_checksum --file="$install_dir/settings.json"
fi
# Overwrite the credentials config file only if it's allowed
if [ $overwrite_credentials -eq 1 ]
then
ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json"
ynh_add_config --template="../conf/credentials.json" --destination="$install_dir/credentials.json"
fi
fi
chmod 600 "$final_path/settings.json"
chown $app:$app "$final_path/settings.json"
chmod 600 "$install_dir/settings.json"
chown $app:$app "$install_dir/settings.json"
chmod 600 "$final_path/credentials.json"
chown $app:$app "$final_path/credentials.json"
chmod 600 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json"
#=================================================
# SETUP SYSTEMD
@ -328,7 +266,7 @@ fi
#=================================================
ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
pushd "$final_path"
pushd "$install_dir"
# Add Left/Center/Right/Justify to lines of text in a pad
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_align@${ep_align_version}
# Framapad - Adds author names to span titles
@ -364,7 +302,7 @@ popd
#=================================================
ynh_script_progression --message="Upgrading Etherpad..." --weight=60
pushd $final_path
pushd $install_dir
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH bin/installDeps.sh
popd
@ -375,7 +313,7 @@ popd
if [ "$upgrade_type" == "UPGRADE_APP" ] && [ $mypads -eq 1 ]
then
# Find the /div just after the field to open a pad in order to add a link to MyPads plugin.
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $final_path/src/templates/index.html
sed -i '157i<center><br><font size="4"><a href="./mypads/" style="text-decoration: none; color: #555">MyPads</a></font></center>' $install_dir/src/templates/index.html
fi
#=================================================
@ -410,13 +348,6 @@ ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
@ -424,44 +355,6 @@ ynh_script_progression --message="Disabling maintenance mode..." --weight=5
ynh_maintenance_mode_OFF
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the URL of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
# Build the changelog
# Get the value of admin_mail_html
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
admin_mail_html="${admin_mail_html:-0}"
# If a html email is required. Apply html to the changelog.
if [ "$admin_mail_html" -eq 1 ]; then
format=html
else
format=plain
fi
ynh_app_changelog --format=$format
if [ $mypads -eq 1 ]
then
Informations="You can access 2 different admin panels, for Etherpad by accessing https://$domain${path_url%/}/admin and for MyPads by accessing https://$domain${path_url%/}/mypads/?/admin."
else
Informations="You can access the admin panel by accessing https://$domain${path_url%/}/admin."
fi
echo "$Informations
You can also find a config file for Etherpad at this path /var/www/etherpad_mypads/settings.json.
If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh
---
Changelog since your last upgrade:
$(cat changelog)" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=upgrade
#=================================================
# END OF SCRIPT
#=================================================

37
tests.toml Normal file
View file

@ -0,0 +1,37 @@
test_format = 1.0
[default]
# -------------------------------
# Default args to use for install
# -------------------------------
args.export = "libreoffice"
args.mypads = 1
args.useldap = 1
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.4d613658.name = "Upgrade from 1.8.17"
# This is an additional test suite
[without_mypads]
args.export = "libreoffice"
args.mypads = 0
args.useldap = 0
only = ["install.root"]
[with_abiword]
args.export = "abiword"
args.mypads = 1
args.useldap = 1
only = ["install.root"]
[without_export]
args.export = "none"
args.mypads = 1
args.useldap = 0
only = ["install.root"]