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 #187 from YunoHost-Apps/testing

Testing
This commit is contained in:
Alexandre Aubin 2023-12-11 15:19:29 +01:00 committed by GitHub
commit 06ffab5952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 149 additions and 686 deletions

View file

@ -21,7 +21,6 @@ Etherpad is a real-time collaborative editor scalable to thousands of simultaneo
This version of Etherpad is preconfigured with a collection of plugins: This version of Etherpad is preconfigured with a collection of plugins:
- [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groups and private pads for etherpad* - [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_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_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_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Add comments on sidebar and link it to the text.*
@ -35,7 +34,7 @@ This version of Etherpad is preconfigured with a collection of plugins:
- [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Support for subscript and superscript* - [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Support for subscript and superscript*
**Shipped version:** 1.9.1~ynh1 **Shipped version:** 1.9.1~ynh2
**Demo:** https://video.etherpad.com **Demo:** https://video.etherpad.com

View file

@ -21,7 +21,6 @@ Etherpad est un éditeur collaboratif en temps réel évolutif pour des milliers
Cette version d'Etherpad est préconfigurée avec une collection de plugins: 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_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_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_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_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Ajout de commentaire dans la barre latéral + lien avec le texte du pad*
@ -35,7 +34,7 @@ Cette version d'Etherpad est préconfigurée avec une collection de plugins:
- [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Support des exposants et indices* - [ep_subscript_and_superscript](https://www.npmjs.com/package/ep_subscript_and_superscript) - *Support des exposants et indices*
**Version incluse :** 1.9.1~ynh1 **Version incluse :** 1.9.1~ynh2
**Démo :** https://video.etherpad.com **Démo :** https://video.etherpad.com

View file

@ -194,8 +194,8 @@
"showChat": true, "showChat": true,
"showLineNumbers": true, "showLineNumbers": true,
"useMonospaceFont": false, "useMonospaceFont": false,
"userName": false, "userName": null,
"userColor": false, "userColor": null,
"rtl": false, "rtl": false,
"alwaysShowChat": false, "alwaysShowChat": false,
"chatAndUsers": false, "chatAndUsers": false,
@ -246,29 +246,29 @@
"highlightSelectedText": false "highlightSelectedText": false
}, },
// ep_mypads // ep_mypads
//noldap "ep_mypads": { __COMMENT_IF_LDAP_DISABLED__ "ep_mypads": {
//noldap "ldap": { __COMMENT_IF_LDAP_DISABLED__ "ldap": {
//noldap // Your LDAP URL __COMMENT_IF_LDAP_DISABLED__ // Your LDAP URL
//noldap "url": "ldap://127.0.0.1", __COMMENT_IF_LDAP_DISABLED__ "url": "ldap://127.0.0.1",
//noldap // Where to search your users __COMMENT_IF_LDAP_DISABLED__ // Where to search your users
//noldap "searchBase": "ou=users,dc=yunohost,dc=org", __COMMENT_IF_LDAP_DISABLED__ "searchBase": "ou=users,dc=yunohost,dc=org",
//noldap // A LDAP filter ({{username}} is replaced by user's login) __COMMENT_IF_LDAP_DISABLED__ // A LDAP filter ({{username}} is replaced by user's login)
//noldap "searchFilter": "(&(|(objectclass=posixAccount))(uid={{username}}))", __COMMENT_IF_LDAP_DISABLED__ "searchFilter": "(&(|(objectclass=posixAccount))(uid={{username}}))",
//noldap // LDAP properties mapping for MyPads __COMMENT_IF_LDAP_DISABLED__ // LDAP properties mapping for MyPads
//noldap "properties": { __COMMENT_IF_LDAP_DISABLED__ "properties": {
//noldap // Which LDAP property will be used as user's login? __COMMENT_IF_LDAP_DISABLED__ // Which LDAP property will be used as user's login?
//noldap "login": "uid", __COMMENT_IF_LDAP_DISABLED__ "login": "uid",
//noldap // as user's email __COMMENT_IF_LDAP_DISABLED__ // as user's email
//noldap "email": "mail", __COMMENT_IF_LDAP_DISABLED__ "email": "mail",
//noldap // as user's firstname __COMMENT_IF_LDAP_DISABLED__ // as user's firstname
//noldap "firstname": "givenName", __COMMENT_IF_LDAP_DISABLED__ "firstname": "givenName",
//noldap // as users's lastname __COMMENT_IF_LDAP_DISABLED__ // as users's lastname
//noldap "lastname": "sn" __COMMENT_IF_LDAP_DISABLED__ "lastname": "sn"
//noldap }, __COMMENT_IF_LDAP_DISABLED__ },
//noldap // Default langage for LDAP created users __COMMENT_IF_LDAP_DISABLED__ // Default langage for LDAP created users
//noldap "defaultLang": "__LANGUAGE__" __COMMENT_IF_LDAP_DISABLED__ "defaultLang": "__LANGUAGE__"
//noldap } __COMMENT_IF_LDAP_DISABLED__ }
//noldap }, __COMMENT_IF_LDAP_DISABLED__ },
/* /*
* Should we suppress errors from being visible in the default Pad Text? * Should we suppress errors from being visible in the default Pad Text?
@ -312,7 +312,7 @@
* it to null disables Abiword and will only allow plain text and HTML * it to null disables Abiword and will only allow plain text and HTML
* import/exports. * import/exports.
*/ */
"abiword" : null, "abiword" : __ABIWORD_PATH__,
/* /*
* This is the absolute path to the soffice executable. * This is the absolute path to the soffice executable.
@ -320,7 +320,7 @@
* LibreOffice can be used in lieu of Abiword to export pads. * LibreOffice can be used in lieu of Abiword to export pads.
* Setting it to null disables LibreOffice exporting. * Setting it to null disables LibreOffice exporting.
*/ */
"soffice" : null, "soffice" : __SOFFICE_PATH__,
/* /*
* Path to the Tidy executable. * Path to the Tidy executable.

View file

@ -7,7 +7,7 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/
Environment=NODE_ENV=production Environment=ETHERPAD_PRODUCTION=true
Environment="__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=__YNH_NODE__ __INSTALL_DIR__/src/node/server.js ExecStart=__YNH_NODE__ __INSTALL_DIR__/src/node/server.js
StandardOutput=append:/var/log/__APP__/etherpad.log StandardOutput=append:/var/log/__APP__/etherpad.log

View file

@ -1,84 +0,0 @@
version = "1.0"
[main]
name = "Etherpad configuration"
[main.export]
name = "Export"
[main.export.export]
ask = "Use AbiWord (~260 Mo) or LibreOffice (~400 Mo) (more stable) to expand export possibilities (PDF, doc)?"
choices = ["none", "abiword", "libreoffice"]
default = "none"
[main.pad_configuration]
name = "Default pad configuration"
[main.pad_configuration.pad_config_nocolors]
ask = "Hide authorship colors?"
type = "boolean"
default = false
[main.pad_configuration.pad_config_showlinenumbers]
ask = "Show line numbers?"
type = "boolean"
default = true
[main.pad_configuration.pad_config_chatandusers]
ask = "Show chat and users?"
type = "boolean"
default = false
[main.pad_configuration.pad_config_alwaysshowchat]
ask = "Always show chat?"
type = "boolean"
default = false
[main.pad_configuration.pad_config_show_markdown]
ask = "Show markdown syntax?"
type = "boolean"
default = false
[main.mypads_configuration]
name = "MyPads configuration"
[main.mypads_configuration.mypads]
ask = "Enable MyPads plugin?"
type = "boolean"
default = true
[main.mypads_configuration.useldap]
ask = "Use LDAP with MyPads?"
type = "boolean"
default = true
[main.overwrite_files]
name = "Overwriting config files during an upgrade"
[main.overwrite_files.overwrite_settings]
ask = "Overwrite the config file settings.json?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_credentials]
ask = "Overwrite the config file credentials.json?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_nginx]
ask = "Overwrite the NGINX config file?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_systemd]
ask = "Overwrite the systemd config file?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."

View file

@ -3,7 +3,6 @@ Etherpad is a real-time collaborative editor scalable to thousands of simultaneo
This version of Etherpad is preconfigured with a collection of plugins: This version of Etherpad is preconfigured with a collection of plugins:
- [ep_mypads](https://www.npmjs.com/package/ep_mypads) - *Groups and private pads for etherpad* - [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_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_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_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Add comments on sidebar and link it to the text.*

View file

@ -3,7 +3,6 @@ Etherpad est un éditeur collaboratif en temps réel évolutif pour des milliers
Cette version d'Etherpad est préconfigurée avec une collection de plugins: 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_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_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_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_comments_page](https://www.npmjs.com/package/ep_comments_page) - *Ajout de commentaire dans la barre latéral + lien avec le texte du pad*

View file

@ -5,7 +5,7 @@ name = "Etherpad MyPads"
description.en = "Online editor providing collaborative editing in real-time" description.en = "Online editor providing collaborative editing in real-time"
description.fr = "Éditeur en ligne fournissant l'édition collaborative en temps réel" description.fr = "Éditeur en ligne fournissant l'édition collaborative en temps réel"
version = "1.9.1~ynh1" version = "1.9.1~ynh2"
maintainers = [] maintainers = []
@ -17,7 +17,7 @@ admindoc = "http://etherpad.org/doc/v1.9.0"
code = "https://github.com/ether/etherpad-lite" code = "https://github.com/ether/etherpad-lite"
[integration] [integration]
yunohost = ">= 11.1.21" yunohost = ">= 11.2"
architectures = ["arm64", "amd64"] architectures = ["arm64", "amd64"]
multi_instance = true multi_instance = true
ldap = false ldap = false
@ -43,7 +43,7 @@ ram.runtime = "50M"
[install.language] [install.language]
ask.en = "Choose your language" ask.en = "Choose your language"
ask.fr = "Choisissez la langue" ask.fr = "Choisissez la langue"
type = "string" type = "select"
choices = ["ca", "de", "en", "es", "fr", "gl", "hu", "it", "nl", "pt"] choices = ["ca", "de", "en", "es", "fr", "gl", "hu", "it", "nl", "pt"]
default = "fr" default = "fr"
@ -56,7 +56,7 @@ ram.runtime = "50M"
[install.export] [install.export]
ask.en = "Use AbiWord (~260 Mo) or LibreOffice (~400 Mo) (more stable) to expand export possibilities (PDF, doc)?" 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) ?" ask.fr = "Utiliser AbiWord (~260 Mo) ou LibreOffice (~400 Mo) (plus stable) pour étendre les possibilités d'export (PDF, doc) ?"
type = "string" type = "select"
choices = ["none", "abiword", "libreoffice"] choices = ["none", "abiword", "libreoffice"]
default = "none" default = "none"
@ -112,4 +112,4 @@ ram.runtime = "50M"
[resources.database] [resources.database]
type = "mysql" type = "mysql"

View file

@ -22,7 +22,6 @@ ep_headings2_version=0.2.44
ep_markdown_version=0.1.50 ep_markdown_version=0.1.50
ep_spellcheck_version=0.0.43 ep_spellcheck_version=0.0.43
ep_subscript_and_superscript_version=0.2.47 ep_subscript_and_superscript_version=0.2.47
ep_table_of_contents_version=0.3.42
ep_font_size_version=0.4.44 ep_font_size_version=0.4.44
#================================================= #=================================================
@ -34,14 +33,6 @@ ep_font_size_version=0.4.44
#================================================= #=================================================
ynh_maintenance_mode_ON () { ynh_maintenance_mode_ON () {
# 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
mkdir -p /var/www/html/ mkdir -p /var/www/html/
# Create an html to serve as maintenance notice # Create an html to serve as maintenance notice
@ -90,14 +81,6 @@ include conf.d/yunohost_panel.conf.inc;
} }
ynh_maintenance_mode_OFF () { ynh_maintenance_mode_OFF () {
# 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}_maintenance to the real url of the app. # 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" echo "rewrite ^${path}_maintenance/(.*)$ ${path}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
systemctl reload nginx systemctl reload nginx

View file

@ -1,264 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Load common variables for all scripts.
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# SPECIFIC CODE
#=================================================
# DECLARE GENERIC FUNCTION
#=================================================
config_file="$final_path/settings.json"
get_config_value() {
option_name="$1"
# Get the value of this option in the config file
grep "^ *\"$option_name\" *:" "$config_file" | cut -d':' -f2 | sed s'/[ \"]//g' | cut -d',' -f1
}
#=================================================
# LOAD VALUES
#=================================================
# Load the real value from the app config or elsewhere.
# Then get the value from the form.
# If the form has a value for a variable, take the value from the form,
# Otherwise, keep the value from the app config.
# Export
old_export="$(ynh_app_setting_get $app export)"
export="${YNH_CONFIG_MAIN_EXPORT_EXPORT:-$old_export}"
# padOptions noColors
old_pad_config_nocolors="$(get_config_value noColors)"
pad_config_nocolors="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_NOCOLORS:-$old_pad_config_nocolors}"
# padOptions showLineNumbers
old_pad_config_showlinenumbers="$(get_config_value showLineNumbers)"
pad_config_showlinenumbers="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOWLINENUMBERS:-$old_pad_config_showlinenumbers}"
# padOptions chatAndUsers
old_pad_config_chatandusers="$(get_config_value chatAndUsers)"
pad_config_chatandusers="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_CHATANDUSERS:-$old_pad_config_chatandusers}"
# padOptions alwaysShowChat
old_pad_config_alwaysshowchat="$(get_config_value alwaysShowChat)"
pad_config_alwaysshowchat="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_ALWAYSSHOWCHAT:-$old_pad_config_alwaysshowchat}"
# Plugin option ep_markdown_default
old_pad_config_show_markdown="$(get_config_value ep_markdown_default)"
pad_config_show_markdown="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOW_MARKDOWN:-$old_pad_config_show_markdown}"
# MyPads
if [ -d $final_path/node_modules/ep_mypads ]
then
# Enable
old_mypads=1
else
# Disable
old_mypads=0
fi
mypads="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS:-$old_mypads}"
# LDAP for MyPads
if grep -q "//noldap" $config_file
then
# Disable
old_useldap=0
else
# Enable
old_useldap=1
fi
useldap="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP:-$old_useldap}"
# Overwrite settings.json file
old_overwrite_settings="$(ynh_app_setting_get --app=$app --key=overwrite_settings)"
overwrite_settings="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS:-$old_overwrite_settings}"
# Overwrite credentials.json file
old_overwrite_credentials="$(ynh_app_setting_get --app=$app --key=overwrite_credentials)"
overwrite_credentials="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_CREDENTIALS:-$old_overwrite_credentials}"
# Overwrite nginx configuration
old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
# Overwrite systemd configuration
old_overwrite_systemd="$(ynh_app_setting_get --app=$app --key=overwrite_systemd)"
overwrite_systemd="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SYSTEMD:-$old_overwrite_systemd}"
#=================================================
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
#=================================================
show_config() {
# here you are supposed to read some config file/database/other then print the values
# ynh_return "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value"
ynh_return "YNH_CONFIG_MAIN_EXPORT_EXPORT=$export"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_NOCOLORS=$pad_config_nocolors"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOWLINENUMBERS=$pad_config_showlinenumbers"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_CHATANDUSERS=$pad_config_chatandusers"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_ALWAYSSHOWCHAT=$pad_config_alwaysshowchat"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOW_MARKDOWN=$pad_config_show_markdown"
ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS=$mypads"
ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP=$useldap"
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS=$overwrite_settings"
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_CREDENTIALS=$overwrite_credentials"
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX=$overwrite_nginx"
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SYSTEMD=$overwrite_systemd"
}
#=================================================
# MODIFY THE CONFIGURATION
#=================================================
apply_config() {
#=================================================
# MODIFY ETHERPAD CONFIG
#=================================================
restart_etherpad=0
# Change configuration if needed
# padOptions noColors
if [ "$pad_config_nocolors" != "$old_pad_config_nocolors" ]
then
ynh_replace_string --match_string="\(\"noColors\" *: \).*," --replace_string="\1$pad_config_nocolors," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_nocolors --value="$pad_config_nocolors"
restart_etherpad=1
fi
# padOptions showLineNumbers
if [ "$pad_config_showlinenumbers" != "$old_pad_config_showlinenumbers" ]
then
ynh_replace_string --match_string="\(\"showLineNumbers\" *: \).*," --replace_string="\1$pad_config_showlinenumbers," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_showlinenumbers --value="$pad_config_showlinenumbers"
restart_etherpad=1
fi
# padOptions chatAndUsers
if [ "$pad_config_chatandusers" != "$old_pad_config_chatandusers" ]
then
ynh_replace_string --match_string="\(\"chatAndUsers\" *: \).*," --replace_string="\1$pad_config_chatandusers," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_chatandusers --value="$pad_config_chatandusers"
restart_etherpad=1
fi
# padOptions alwaysShowChat
if [ "$pad_config_alwaysshowchat" != "$old_pad_config_alwaysshowchat" ]
then
ynh_replace_string --match_string="\(\"alwaysShowChat\" *: \).*," --replace_string="\1$pad_config_alwaysshowchat," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_alwaysshowchat --value="$pad_config_alwaysshowchat"
restart_etherpad=1
fi
# Plugin option ep_markdown_default
if [ "$pad_config_show_markdown" != "$old_pad_config_show_markdown" ]
then
ynh_replace_string --match_string="\(\"ep_markdown_default\" *: \).*," --replace_string="\1$pad_config_show_markdown," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_show_markdown --value="$pad_config_show_markdown"
restart_etherpad=1
fi
# Export
if [ "$export" != "$old_export" ]
then
if [ "$export" = "abiword" ]
then
# if Abiword isn't installed, call the action add_remove_abiword.
if ! which abiword > /dev/null
then
yunohost app action run $app add_remove_abiword
fi
ynh_replace_string --match_string="\(\"abiword\" *: \).*," --replace_string="\1\"$(which abiword)\"," --target_file="$config_file"
ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1null," --target_file="$config_file"
elif [ "$export" = "libreoffice" ]
then
# if LibreOffice isn't installed, call the action add_remove_libreoffice.
if ! which soffice > /dev/null
then
yunohost app action run $app add_remove_libreoffice
fi
ynh_replace_string --match_string="\(\"abiword\" *: \).*," --replace_string="\1null," --target_file="$config_file"
ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1\"$(which soffice)\"," --target_file="$config_file"
else
ynh_replace_string --match_string="\(\"abiword\" *: \).*," --replace_string="\1null," --target_file="$config_file"
ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1null," --target_file="$config_file"
fi
ynh_app_setting_set --app=$app --key=export --value="$export"
restart_etherpad=1
fi
# MyPads
if [ "$mypads" != "$old_mypads" ]
then
ynh_use_nodejs
#pushd "$final_path/src"
#ynh_secure_remove --file="$final_path/src/package-lock.json" #added to fix saveError ENOENT: no such file or directory
if [ "$mypads" = "1" ]
then
ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_mypads@${mypads_version}
else
ynh_exec_as $app env "$ynh_node_load_PATH" npm uninstall ep_mypads
fi
popd
chown -R $app: $final_path/node_modules
ynh_app_setting_set --app=$app --key=mypads --value="$mypads"
restart_etherpad=1
fi
# LDAP for MyPads
if [ "$useldap" != "$old_useldap" ]
then
if [ "$useldap" = "1" ]
then
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$final_path/settings.json"
else
ynh_replace_string --match_string="\(.*\) //useldap" --replace_string="//noldap\1" --target_file="$final_path/settings.json"
fi
ynh_app_setting_set --app=$app --key=useldap --value="$useldap"
restart_etherpad=1
fi
if [ $restart_etherpad -eq 1 ]
then
# 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"
fi
#=================================================
# MODIFY OVERWRITTING SETTINGS
#=================================================
# Set overwrite_settings
ynh_app_setting_set --app=$app --key=overwrite_settings --value="$overwrite_settings"
# Set overwrite_credentials
ynh_app_setting_set --app=$app --key=overwrite_credentials --value="$overwrite_credentials"
# Set overwrite_nginx
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
# Set overwrite_systemd
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="$overwrite_systemd"
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_run $1

View file

@ -1,28 +1,14 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
sleep 60 sleep 10
fi fi
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= # Save the passord (not saved automatically by the core)
# RETRIEVE ARGUMENTS FROM THE MANIFEST ynh_app_setting_set --app=$app --key=password --value="$password"
#=================================================
password="$YNH_APP_ARG_PASSWORD"
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"
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
@ -73,36 +59,30 @@ chown $app -R /var/log/$app
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=6 ynh_script_progression --message="Configure etherpad..."
cp ../conf/settings.json "$install_dir/settings.json" abiword_path="null"
soffice_path="null"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$install_dir/settings.json" if [[ "$export" == "abiword" ]]
if [ "$export" = "abiword" ]
then then
# Get Abiword binary path abiword_path="\"$(which abiword)\""
abiword_path=`which abiword` elif [[ "$export" == "libreoffice" ]]
# Set the path of abiword into Etherpad config
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$install_dir/settings.json"
elif [ "$export" = "libreoffice" ]
then then
# Get soffice binary path soffice_path="\"$(which soffice)\""
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="$install_dir/settings.json"
fi fi
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$install_dir/settings.json"
# Use ldap for mypads # Use ldap for mypads
comment_if_ldap_disabled="//ldap_disabled"
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ] if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
then then
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$install_dir/settings.json" comment_if_ldap_disabled=""
fi 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 --file="$install_dir/settings.json"
ynh_add_config --template="../conf/credentials.json" --destination="$install_dir/credentials.json" ynh_add_config --template="settings.json" --destination="$install_dir/settings.json"
ynh_add_config --template="credentials.json" --destination="$install_dir/credentials.json"
chmod 600 "$install_dir/settings.json" chmod 600 "$install_dir/settings.json"
chown $app:$app "$install_dir/settings.json" chown $app:$app "$install_dir/settings.json"
@ -110,14 +90,6 @@ chown $app:$app "$install_dir/settings.json"
chmod 600 "$install_dir/credentials.json" chmod 600 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json" chown $app:$app "$install_dir/credentials.json"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=4
# Create a dedicated systemd config
ynh_add_systemd_config
#================================================= #=================================================
# INSTALL ETHERPAD'S PLUGINS # INSTALL ETHERPAD'S PLUGINS
#================================================= #=================================================
@ -148,8 +120,6 @@ pushd "$install_dir"
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_spellcheck@${ep_spellcheck_version} ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_spellcheck@${ep_spellcheck_version}
# Framapad - Add support for Subscript and Superscript # Framapad - Add support for Subscript and Superscript
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_subscript_and_superscript@${ep_subscript_and_superscript_version} ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_subscript_and_superscript@${ep_subscript_and_superscript_version}
# Framapad - View a table of contents for your pad
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_table_of_contents@${ep_table_of_contents_version}
# Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views # Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_font_size@${ep_font_size_version} ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_font_size@${ep_font_size_version}
popd popd
@ -160,7 +130,7 @@ popd
ynh_script_progression --message="Installing Etherpad..." --weight=90 ynh_script_progression --message="Installing Etherpad..." --weight=90
pushd $install_dir pushd $install_dir
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH bin/installDeps.sh ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ETHERPAD_PRODUCTION=true src/bin/installDeps.sh
popd popd
#================================================= #=================================================
@ -183,26 +153,23 @@ then
fi fi
#================================================= #=================================================
# GENERIC FINALIZATION # SETUP SYSTEMD
#================================================= #=================================================
# SETUP LOGROTATE ynh_script_progression --message="Configuring systemd service..." --weight=4
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1 # Create a dedicated systemd config
ynh_add_systemd_config
# Intgrate in YunoHost
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log"
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate --specific_user=$app/$app ynh_use_logrotate --specific_user=$app/$app
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=20 ynh_script_progression --message="Starting systemd service..." --weight=20
# Start a systemd service # 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" 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"

View file

@ -9,13 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=3
export=$(ynh_app_setting_get --app=$app --key=export)
#================================================= #=================================================
# REMOVE SYSTEM CONFIGURATIONS # REMOVE SYSTEM CONFIGURATIONS
#================================================= #=================================================

View file

@ -1,26 +1,13 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=3
password=$(ynh_app_setting_get --app=$app --key=password)
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2 #
ynh_script_progression --message="Restoring the app main directory..." --weight=5
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
@ -38,11 +25,7 @@ chown $app:$app "$install_dir/credentials.json"
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_script_progression --message="Restoring system configurations related to $app..."
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
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs ynh_use_nodejs
@ -60,10 +43,14 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log" yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log"
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
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=2 ynh_script_progression --message="Restoring the MySQL database..." --weight=5
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 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 ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
@ -73,7 +60,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and $app's 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" 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"

View file

@ -1,44 +1,8 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=20
export=$(ynh_app_setting_get --app=$app --key=export)
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)
abiword=$(ynh_app_setting_get --app=$app --key=abiword)
overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
overwrite_credentials=$(ynh_app_setting_get --app=$app --key=overwrite_credentials)
overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
# Optional parameters from config-panel feature
pad_config_nocolors=$(ynh_app_setting_get --app=$app --key=pad_config_nocolors)
pad_config_showlinenumbers=$(ynh_app_setting_get --app=$app --key=pad_config_showlinenumbers)
pad_config_chatandusers=$(ynh_app_setting_get --app=$app --key=pad_config_chatandusers)
pad_config_alwaysshowchat=$(ynh_app_setting_get --app=$app --key=pad_config_alwaysshowchat)
pad_config_show_markdown=$(ynh_app_setting_get --app=$app --key=pad_config_show_markdown)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..." --weight=1
# 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"
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
@ -46,6 +10,9 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message="Activating maintenance mode..." --weight=2 ynh_script_progression --message="Activating maintenance mode..." --weight=2
# Wait for etherpad to be fully started # (... but why ???)
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
ynh_maintenance_mode_ON ynh_maintenance_mode_ON
#================================================= #=================================================
@ -62,67 +29,35 @@ ynh_systemd_action --service_name=$app --action="stop"
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
# If abiword setting doesn't exist if [ -z "${language:-}" ]; then
if [ -z "$abiword" ]; then # If upgrading from a version which doesn't support translations, set language to English by default
abiword=0 language=en
ynh_app_setting_set --app=$app --key=abiword --value=$abiword ynh_app_setting_set --app=$app --key=language --value=$language
fi fi
# If abiword setting exists if [ -z "${export:-}" ]; then
if [ -n "$abiword" ]; then
if [ $abiword -eq 1 ]; then
export=abiword
fi
ynh_app_setting_set --app=$app --key=export --value=$export
ynh_app_setting_delete --app=$app --key=abiword
fi
# If export setting doesn't exist
if [ -z "$export" ]; then
export=none export=none
ynh_app_setting_set --app=$app --key=export --value=$export ynh_app_setting_set --app=$app --key=export --value=$export
fi fi
# If mypads setting doesn't exist if [ -z "${mypads:-}" ]; then
if [ -z "$mypads" ]; then
mypads=1 mypads=1
ynh_app_setting_set --app=$app --key=mypads --value=$mypads ynh_app_setting_set --app=$app --key=mypads --value=$mypads
fi fi
# If useldap setting doesn't exist if [ -z "${useldap:-}" ]; then
if [ -z "$useldap" ]; then
useldap=0 useldap=0
ynh_app_setting_set --app=$app --key=useldap --value=$useldap ynh_app_setting_set --app=$app --key=useldap --value=$useldap
fi fi
# If path setting doesn't exist if [ -z "${path:-}" ]; then
if [ -z "$path" ]; then
path="/" path="/"
ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=path --value=$path
fi fi
# If overwrite_settings doesn't exist, create it if [ -z "${password:-}" ]; then
if [ -z "$overwrite_settings" ]; then password=$(ynh_string_random --length=32)
overwrite_settings=1 ynh_app_setting_set --app=$app --key=password --value="$password"
ynh_app_setting_set --app=$app --key=overwrite_settings --value=$overwrite_settings
fi
# If overwrite_credentials doesn't exist, create it
if [ -z "$overwrite_credentials" ]; then
overwrite_credentials=1
ynh_app_setting_set --app=$app --key=overwrite_credentials --value=$overwrite_credentials
fi
# If overwrite_nginx doesn't exist, create it
if [ -z "$overwrite_nginx" ]; then
overwrite_nginx=1
ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx
fi
# If overwrite_systemd doesn't exist, create it
if [ -z "$overwrite_systemd" ]; then
overwrite_systemd=1
ynh_app_setting_set --app=$app --key=overwrite_systemd --value=$overwrite_systemd
fi fi
# Support full Unicode in MySQL databases # Support full Unicode in MySQL databases
@ -157,11 +92,7 @@ ynh_use_nodejs
#================================================= #=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Overwrite the NGINX configuration only if it's allowed ynh_add_nginx_config
if [ $overwrite_nginx -eq 1 ]
then
ynh_add_nginx_config
fi
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -177,93 +108,51 @@ chown $app -R /var/log/$app
# CONFIGURE ETHERPAD # CONFIGURE ETHERPAD
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] ynh_script_progression --message="Configure etherpad..."
abiword_path="null"
soffice_path="null"
if [[ "$export" == "abiword" ]]
then then
ynh_script_progression --message="Reconfiguring Etherpad..." --weight=3 abiword_path="\"$(which abiword)\""
elif [[ "$export" == "libreoffice" ]]
# Overwrite the settings config file only if it's allowed then
if [ $overwrite_settings -eq 1 ] soffice_path="\"$(which soffice)\""
then
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
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="$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="$install_dir/settings.json"
fi
if test -z "$language"; then
# If upgrading from a version which doesn't support translations, set language to English by default
language=en
ynh_app_setting_set --app=$app --key=language --value=$language
fi
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="$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="$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="$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="$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="$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="$install_dir/settings.json"
fi
# Recalculate and store the checksum of the file for the next upgrade.
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="$install_dir/credentials.json"
fi
fi fi
# Use ldap for mypads
comment_if_ldap_disabled="//ldap_disabled"
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
then
comment_if_ldap_disabled=""
fi
# Calculate and store the config file checksum into the app settings
ynh_add_config --template="settings.json" --destination="$install_dir/settings.json"
ynh_add_config --template="credentials.json" --destination="$install_dir/credentials.json"
chmod 600 "$install_dir/settings.json" chmod 600 "$install_dir/settings.json"
chown $app:$app "$install_dir/settings.json" chown $app:$app "$install_dir/settings.json"
chmod 600 "$install_dir/credentials.json" chmod 600 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json" chown $app:$app "$install_dir/credentials.json"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
# Create a dedicated systemd config
if [ $overwrite_systemd -eq 1 ]
then
ynh_add_systemd_config
fi
#================================================= #=================================================
# INSTALL ETHERPAD'S PLUGINS # INSTALL ETHERPAD'S PLUGINS
#================================================= #=================================================
# If upgrading from an old version and table of content is there, remove it
if ynh_compare_current_package_version --comparison lt --version 1.9.1~ynh2
then
if ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ls 2>/dev/null | grep -q ep_table_of_contents
then
ynh_script_progression --message="Uninstalling ep_table_of_contents..." --weight=90
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm uninstall ep_table_of_contents
fi
fi
ynh_script_progression --message="Installing Etherpad plugins..." --weight=90 ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
pushd "$install_dir" pushd "$install_dir"
@ -291,8 +180,6 @@ pushd "$install_dir"
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_spellcheck@${ep_spellcheck_version} ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_spellcheck@${ep_spellcheck_version}
# Framapad - Add support for Subscript and Superscript # Framapad - Add support for Subscript and Superscript
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_subscript_and_superscript@${ep_subscript_and_superscript_version} ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_subscript_and_superscript@${ep_subscript_and_superscript_version}
# Framapad - View a table of contents for your pad
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_table_of_contents@${ep_table_of_contents_version}
# Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views # Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_font_size@${ep_font_size_version} ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --no-save ep_font_size@${ep_font_size_version}
popd popd
@ -300,10 +187,10 @@ popd
#================================================= #=================================================
# UPGRADE NPM MODULES # UPGRADE NPM MODULES
#================================================= #=================================================
ynh_script_progression --message="Upgrading Etherpad..." --weight=60 ynh_script_progression --message="Upgrading Etherpad..." --weight=10
pushd $install_dir pushd $install_dir
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH bin/installDeps.sh ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ETHERPAD_PRODUCTION=true src/bin/installDeps.sh
popd popd
#================================================= #=================================================
@ -317,26 +204,22 @@ then
fi fi
#================================================= #=================================================
# GENERIC FINALIZATION # SETUP SYSTEMD
#================================================= #=================================================
# SETUP LOGROTATE ynh_script_progression --message="Configuring systemd service..." --weight=2
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=2 ynh_add_systemd_config
# Integrate in YunoHost
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log"
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append --specific_user=$app/$app ynh_use_logrotate --non-append --specific_user=$app/$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 # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=9 ynh_script_progression --message="Starting systemd service..." --weight=9
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" 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"

View file

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