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

Merge pull request #12 from YunoHost-Apps/patch

Add templates + set rights
This commit is contained in:
Alexandre Aubin 2021-11-12 02:03:21 +01:00 committed by GitHub
commit 344aa45931
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 177 additions and 144 deletions

View file

@ -1,60 +1,42 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Libreto for YunoHost # Libreto for YunoHost
[![Integration level](https://dash.yunohost.org/integration/libreto.svg)](https://dash.yunohost.org/appci/app/libreto) ![](https://ci-apps.yunohost.org/ci/badges/libreto.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/libreto.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/libreto.svg)](https://dash.yunohost.org/appci/app/libreto) ![](https://ci-apps.yunohost.org/ci/badges/libreto.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/libreto.maintain.svg)
[![Install Libreto with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=libreto) [![Install Libreto with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=libreto)
> *This package allow you to install Libreto quickly and simply on a YunoHost server. *[Lire ce readme en français.](./README_fr.md)*
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
> *This package allows you to install Libreto quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
Libreto let you aggregate your pad (Etherpad lite) to create a kind of wiki easily.
**Shipped version:** 0.0.20180605 Aggregate your pads to create a wiki.
**Shipped version:** 0.0.20180605~ynh2
**Demo:** https://libreto.net
## Screenshots ## Screenshots
![Home page of Libreto](img/home.png) ![](./doc/screenshots/home.png)
![Usage of Libreto](img/menu.png) ![](./doc/screenshots/menu.png)
## Demo ## Documentation and resources
* [Official demo](https://libreto.net) * Official app website: https://libreto.net
* Official admin documentation: https://github.com/Ventricule/libreto
* Upstream app code repository: https://github.com/Ventricule/libreto
* YunoHost documentation for this app: https://yunohost.org/app_libreto
* Report a bug: https://github.com/YunoHost-Apps/libreto_ynh/issues
## Configuration ## Developer info
No configuration needed. Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/libreto_ynh/tree/testing).
## Documentation
* Official documentation: https://github.com/Ventricule/libreto
## YunoHost specific features
#### Multi-users support
Libreto has no user management, but YunoHost allow you to decide if this app is public or not.
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/libreto.svg)](https://ci-apps.yunohost.org/ci/apps/libreto/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/libreto.svg)](https://ci-apps-arm.yunohost.org/ci/apps/libreto/)
## Limitations
Only app instances with a valid certificate and allowing to be included in Frame could be used.
## Links
* Report a bug: https://github.com/YunoHost-Apps/libreto_ynh/issues
* App website: http://libreto.net/
* Upstream app repository: https://github.com/Ventricule/libreto
* YunoHost website: https://yunohost.org/
---
## Developers info
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/libreto_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
``` ```
@ -62,3 +44,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/libreto_ynh/tree/test
or or
sudo yunohost app upgrade libreto -u https://github.com/YunoHost-Apps/libreto_ynh/tree/testing --debug sudo yunohost app upgrade libreto -u https://github.com/YunoHost-Apps/libreto_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

44
README_fr.md Normal file
View file

@ -0,0 +1,44 @@
# Libreto pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/libreto.svg)](https://dash.yunohost.org/appci/app/libreto) ![](https://ci-apps.yunohost.org/ci/badges/libreto.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/libreto.maintain.svg)
[![Installer Libreto avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=libreto)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Libreto rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Agrégez vos pads pour créer un wiki.
**Version incluse :** 0.0.20180605~ynh2
**Démo :** https://libreto.net
## Captures d'écran
![](./doc/screenshots/home.png)
![](./doc/screenshots/menu.png)
## Documentations et ressources
* Site officiel de l'app : https://libreto.net
* Documentation officielle de l'admin : https://github.com/Ventricule/libreto
* Dépôt de code officiel de l'app : https://github.com/Ventricule/libreto
* Documentation YunoHost pour cette app : https://yunohost.org/app_libreto
* Signaler un bug : https://github.com/YunoHost-Apps/libreto_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/libreto_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/libreto_ynh/tree/testing --debug
ou
sudo yunohost app upgrade libreto -u https://github.com/YunoHost-Apps/libreto_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,8 +1,8 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
etherpad_instance="https://annuel2.framapad.org" etherpad_instance="https://annuel2.framapad.org"
is_public=1 (PUBLIC|public=1|private=0) is_public=1
creation_open=1 creation_open=1
; Checks ; Checks
pkg_linter=1 pkg_linter=1
@ -12,10 +12,14 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=f6fcb8686cec30da2a7b9e5ba12d6c5b295528d8
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email=ljf+libreto_ynh@reflexlibre.net Email=ljf+libreto_ynh@reflexlibre.net
Notification=down Notification=down
;;; Upgrade options
; commit=f6fcb8686cec30da2a7b9e5ba12d6c5b295528d8
name=Merge pull request #7 from YunoHost-Apps/testing
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -28,13 +28,6 @@ $providers = array(
'markdown' => false, 'markdown' => false,
'html' => true, 'html' => true,
), ),
'factor' => array(
'name' => "Factor",
'url' => "https://factor.cc/pad",
'default_text' => "Welcome to factor.cc Pad!",
'markdown' => false,
'html' => true,
),
'etherpad' => array( 'etherpad' => array(
'name' => "Etherpad.net", 'name' => "Etherpad.net",
'url' => "https://etherpad.net", 'url' => "https://etherpad.net",
@ -61,7 +54,9 @@ $providers = array(
// CUSTOM_PROVIDER); // CUSTOM_PROVIDER);
$options = array( $options = array(
'name' => "Libreto", 'name' => "Libreto",
'root' => '__PATH__',
'use_subdomain' => false,
'default_provider' => "__PROVIDER__", 'default_provider' => "__PROVIDER__",
'providers' => $providers, 'providers' => $providers,
); );

0
doc/DISCLAIMER.md Normal file
View file

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View file

@ -8,6 +8,13 @@
}, },
"version": "0.0.20180605~ynh2", "version": "0.0.20180605~ynh2",
"url": "https://libreto.net", "url": "https://libreto.net",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://libreto.net",
"demo": "https://libreto.net",
"admindoc": "https://github.com/Ventricule/libreto",
"code": "https://github.com/Ventricule/libreto"
},
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {
"name": "ljf", "name": "ljf",
@ -15,7 +22,7 @@
"url": "https://reflexlibre.net" "url": "https://reflexlibre.net"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.7" "yunohost": ">= 4.2.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -29,6 +36,12 @@
"type": "domain", "type": "domain",
"example": "example.com" "example": "example.com"
}, },
{
"name": "path",
"type": "path",
"example": "/libreto",
"default": "/libreto"
},
{ {
"name": "etherpad_instance", "name": "etherpad_instance",
"type": "string", "type": "string",

View file

@ -27,7 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP

View file

@ -25,7 +25,7 @@ ynh_abort_if_errors
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url=$YNH_APP_ARG_PATH
etherpad_instance=$YNH_APP_ARG_ETHERPAD_INSTANCE etherpad_instance=$YNH_APP_ARG_ETHERPAD_INSTANCE
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
creation_open=$YNH_APP_ARG_CREATION_OPEN creation_open=$YNH_APP_ARG_CREATION_OPEN
@ -50,9 +50,16 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
ynh_app_setting_set --app=$app --key=domain --value=$domain 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=path --value=$path_url
ynh_app_setting_set --app=$app --key=etherpad_instance --value=$etherpad_instance ynh_app_setting_set --app=$app --key=etherpad_instance --value=$etherpad_instance
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=creation_open --value=$creation_open ynh_app_setting_set --app=$app --key=creation_open --value=$creation_open
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -69,6 +76,10 @@ pushd "$final_path"
git submodule update --init --recursive --quiet git submodule update --init --recursive --quiet
popd popd
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -77,14 +88,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -118,29 +121,15 @@ fi
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/config.php" ynh_store_file_checksum "$final_path/config.php"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R root: $final_path
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
if [ $creation_open -eq 1 ] ynh_permission_update --permission="main" --add="visitors"
then
ynh_app_setting_set $app skipped_uris "/"
else
ynh_app_setting_set $app skipped_regex "/[^/]+"
fi
fi fi
#================================================= #=================================================

View file

@ -16,8 +16,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -45,14 +45,6 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -45,10 +45,11 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
# RESTORE FILES # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
@ -56,14 +57,25 @@ ynh_restore
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
# Restore permissions on app files ynh_restore_file --origin_path="$final_path"
chown -R root: $final_path
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -15,12 +15,17 @@ source /usr/share/yunohost/helpers
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
final_path=$(ynh_app_setting_get $app final_path) etherpad_instance=$(ynh_app_setting_get --app=$app --key=etherpad_instance)
etherpad_instance=$(ynh_app_setting_get $app etherpad_instance) creation_open=$(ynh_app_setting_get --app=$app --key=creation_open)
creation_open=$(ynh_app_setting_get $app creation_open)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -35,20 +40,48 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# 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"
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src if [ "$upgrade_type" == "UPGRADE_APP" ]
pushd "$final_path" then
git checkout master ynh_script_progression --message="Upgrading source files..." --weight=5
git pull --quiet
git checkout $COMMIT --quiet # Download, check integrity, uncompress and patch the source from app.src
git submodule update --init --recursive --quiet pushd "$final_path"
popd git checkout master
git pull --quiet
git checkout $COMMIT --quiet
git submodule update --init --recursive --quiet
popd
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -58,14 +91,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -81,31 +106,6 @@ ynh_backup_if_checksum_is_different "$final_path/config.php"
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum "$final_path/config.php" ynh_store_file_checksum "$final_path/config.php"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R root: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
if [ $creation_open -eq 1 ]
then
ynh_app_setting_set $app skipped_uris "/"
else
ynh_app_setting_set $app skipped_regex "/[^/]+"
fi
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================