mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
commit
81c1e49e2d
20 changed files with 242 additions and 350 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -1,6 +1,17 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
## [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
|
||||
|
|
|
@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/install) to k
|
|||
Etherpad is a highly customizable Open Source online editor providing collaborative editing in really real-time.
|
||||
This package will install the same plugins than [Framapad](https://framapad.org/).
|
||||
|
||||
**Shipped version:** 1.8.4
|
||||
**Shipped version:** 1.8.13
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
@ -31,7 +31,7 @@ You can also find a configuration file for Etherpad at this path `/var/www/ether
|
|||
|
||||
## Documentation
|
||||
|
||||
* Official documentation: http://etherpad.org/doc/v1.8.4
|
||||
* Official documentation: http://etherpad.org/doc/v1.8.13
|
||||
* YunoHost documentation: https://yunohost.org/en/app_etherpad_mypads
|
||||
|
||||
## YunoHost specific features
|
||||
|
|
|
@ -12,7 +12,7 @@ Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/instal
|
|||
Etherpad est un éditeur en ligne Open Source hautement personnalisable qui permet l'édition collaborative en temps réel.
|
||||
Ce paquet installera les mêmes plugins que [Framapad](https://framapad.org/).
|
||||
|
||||
**Version embarquée :** 1.8.4
|
||||
**Version embarquée :** 1.8.13
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
|
@ -30,7 +30,7 @@ Vous pouvez accéder à deux panneaux d'administration différents, pour Etherpa
|
|||
|
||||
## Documentation
|
||||
|
||||
* Documentation officielle : http://etherpad.org/doc/v1.8.4
|
||||
* Documentation officielle : http://etherpad.org/doc/v1.8.13
|
||||
* Documentation YunoHost : https://yunohost.org/fr/app_etherpad_mypads
|
||||
|
||||
## Fonctionnalités spécifiques à YunoHost
|
||||
|
|
15
actions.toml
15
actions.toml
|
@ -33,18 +33,3 @@ command = "/bin/bash scripts/actions/reset_default_config \"settings.json\""
|
|||
# accepted_return_codes = [0, 1, 2, 3] # optional
|
||||
accepted_return_codes = [0]
|
||||
description = "Reset the config file settings.json."
|
||||
|
||||
[public_private]
|
||||
name = "Move to public or private"
|
||||
command = "/bin/bash scripts/actions/public_private"
|
||||
# user = "root" # optional
|
||||
# cwd = "/" # optional
|
||||
# accepted_return_codes = [0, 1, 2, 3] # optional
|
||||
accepted_return_codes = [0]
|
||||
description = "Change the public access of the app."
|
||||
|
||||
[public_private.arguments]
|
||||
[public_private.arguments.is_public]
|
||||
type = "boolean"
|
||||
ask = "Is it a public app?"
|
||||
default = true
|
||||
|
|
|
@ -19,10 +19,8 @@
|
|||
main.pad_configuration.pad_config_alwaysshowchat=1|0
|
||||
main.pad_configuration.pad_config_show_markdown=1|0
|
||||
main.pad_configuration.pad_config_automatic_logout=0|1
|
||||
main.pad_configuration.pad_config_skinname=noskin|colibris|noskin
|
||||
main.mypads_configuration.mypads=0|1
|
||||
main.mypads_configuration.useldap=0|1
|
||||
main.is_public.is_public=1|0
|
||||
main.overwrite_files.overwrite_settings=0|1
|
||||
main.overwrite_files.overwrite_credentials=0|1
|
||||
main.overwrite_files.overwrite_nginx=0|1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.8.4.tar.gz
|
||||
SOURCE_SUM=b6ad9734a058d3b471cf15c060e609e978797e32559818e9f0a80e0a253c7ba8
|
||||
SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.8.13.tar.gz
|
||||
SOURCE_SUM=c83052daf3b0af8aa3c19a8308e21fcbcfecca99aeb3e8047383875f855443f1
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
ARCH_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
"__ADMIN__": {
|
||||
// 1) "password" can be replaced with "hash" if you install ep_hash_auth
|
||||
// 2) please note that if password is null, the user will not be created
|
||||
"password": "__PASSWD__",
|
||||
"password": "__PASSWORD__",
|
||||
"is_admin": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
* "full-width-editor" variant (by default editor is rendered as a page, with
|
||||
* a max-width of 900px).
|
||||
*/
|
||||
"skinVariants": "super-light-toolbar super-light-editor light-background",
|
||||
"skinVariants": "light-toolbar super-light-editor dark-background",
|
||||
|
||||
/*
|
||||
* IP and port which Etherpad should bind at.
|
||||
|
|
|
@ -6,10 +6,19 @@ After=syslog.target network.target
|
|||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
Environment="PATH=__ENV_PATH__"
|
||||
WorkingDirectory=__FINALPATH__
|
||||
Environment=NODE_ENV=production
|
||||
ExecStart=__FINALPATH__/bin/safeRun.sh /var/log/__APP__/etherpad.log
|
||||
Environment="__YNH_NODE_LOAD_PATH__"
|
||||
ExecStart=__FINALPATH__/src/bin/run.sh
|
||||
StandardOutput=append:/var/log/__APP__/etherpad.log
|
||||
StandardError=inherit
|
||||
Restart=always
|
||||
|
||||
#PrivateDevices=true
|
||||
#ProtectControlGroups=true
|
||||
#ProtectHome=true
|
||||
#ProtectKernelTunables=true
|
||||
#ProtectSystem=full
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -46,16 +46,10 @@ name = "Etherpad configuration"
|
|||
ask = "Automatic logout"
|
||||
type = "boolean"
|
||||
default = true
|
||||
|
||||
[main.pad_configuration.pad_config_skinname]
|
||||
ask = "Theme Name"
|
||||
choices = ["noskin", "colibris"]
|
||||
default = "noskin"
|
||||
help = "noskin is the traditional Etherpad theme. colibris is the new theme."
|
||||
|
||||
|
||||
|
||||
[main.mypads_configuration]
|
||||
name = "Mypads configuration"
|
||||
name = "MyPads configuration"
|
||||
|
||||
[main.mypads_configuration.mypads]
|
||||
ask = "Enable MyPads plugin?"
|
||||
|
@ -68,16 +62,6 @@ name = "Etherpad configuration"
|
|||
default = true
|
||||
|
||||
|
||||
[main.is_public]
|
||||
name = "Public access"
|
||||
|
||||
[main.is_public.is_public]
|
||||
ask = "Is it a public website?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "If your Etherpad instance is public, everyone will be able to create a pad or see an existing one."
|
||||
|
||||
|
||||
[main.overwrite_files]
|
||||
name = "Overwriting config files during an upgrade"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Online editor providing collaborative editing in real-time.",
|
||||
"fr": "Éditeur en ligne fournissant l'édition collaborative en temps réel."
|
||||
},
|
||||
"version": "1.8.4~ynh3",
|
||||
"version": "1.8.13~ynh1",
|
||||
"url": "https://framapad.org",
|
||||
"license": "Apache-2.0",
|
||||
"maintainer": {
|
||||
|
|
|
@ -7,24 +7,24 @@ abiword_app_depencencies="abiword"
|
|||
libreoffice_app_dependencies="unoconv libreoffice-writer"
|
||||
|
||||
# NodeJS version
|
||||
nodejs_version=12
|
||||
nodejs_version=14
|
||||
|
||||
# MyPads version
|
||||
# This variable is mostly used to force an upgrade of the package in case of new versions of MyPads.
|
||||
mypads_version=1.7.17
|
||||
mypads_version=1.7.20
|
||||
|
||||
# Plugin versions
|
||||
ep_align_version=0.2.5
|
||||
ep_author_hover_version=0.3.0
|
||||
ep_align_version=0.3.34
|
||||
ep_author_hover_version=0.3.19
|
||||
ep_automatic_logut_version=1.0.8
|
||||
ep_comments_page_version=0.1.5
|
||||
ep_comments_page_version=0.1.60
|
||||
ep_countable_version=0.0.11
|
||||
ep_delete_empty_pads_version=0.0.6
|
||||
ep_font_color_version=0.0.15
|
||||
ep_headings2_version=0.1.3
|
||||
ep_markdown_version=0.1.7
|
||||
ep_delete_empty_pads_version=0.0.7
|
||||
ep_font_color_version=0.0.42
|
||||
ep_headings2_version=0.2.28
|
||||
ep_markdown_version=0.1.32
|
||||
ep_page_view_version=0.5.24
|
||||
ep_spellcheck_version=0.0.7
|
||||
ep_subscript_and_superscript_version=0.1.2
|
||||
ep_table_of_contents_version=0.2.3
|
||||
ep_font_size_version=0.3.8
|
||||
ep_spellcheck_version=0.0.27
|
||||
ep_subscript_and_superscript_version=0.2.26
|
||||
ep_table_of_contents_version=0.3.20
|
||||
ep_font_size_version=0.4.22
|
||||
|
|
|
@ -84,7 +84,7 @@ 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_install_app_dependencies $dependencies)
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $dependencies)
|
||||
|
||||
# Remove all unused dependencies
|
||||
ynh_package_autopurge
|
||||
|
|
|
@ -67,24 +67,24 @@ fi
|
|||
|
||||
ynh_script_progression --message="$action2 LibreOffice..." --weight=3
|
||||
|
||||
# Load common variables, and especially libreoffice dependencies.
|
||||
# Load common variables, and especially LibreOffice dependencies.
|
||||
source scripts/_variables
|
||||
|
||||
dependencies=""
|
||||
if [ $libreoffice -eq 1 ]
|
||||
then
|
||||
# Add libreoffice dependencies if libreoffice has to be installed
|
||||
# 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.
|
||||
# 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_install_app_dependencies $dependencies)
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $dependencies)
|
||||
|
||||
# Remove all unused dependencies
|
||||
ynh_package_autopurge
|
||||
|
@ -95,11 +95,11 @@ ynh_package_autopurge
|
|||
|
||||
if [ $libreoffice -eq 1 ]
|
||||
then
|
||||
# Set libreoffice as default export app
|
||||
# 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
|
||||
# Set Abiword as default export app
|
||||
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword"
|
||||
else
|
||||
# Remove any export app
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
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
|
||||
#=================================================
|
||||
|
||||
# Get is_public
|
||||
is_public=${YNH_ACTION_IS_PUBLIC}
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF ARGUMENTS ARE CORRECT
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# CHECK IF AN ACTION HAS TO BE DONE
|
||||
#=================================================
|
||||
|
||||
is_public_old=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
|
||||
if [ $is_public -eq $is_public_old ]
|
||||
then
|
||||
ynh_die --message="is_public is already set as $is_public." --ret_code=0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC ACTION
|
||||
#=================================================
|
||||
# MOVE TO PUBLIC OR PRIVATE
|
||||
#=================================================
|
||||
|
||||
if [ $is_public -eq 0 ]; then
|
||||
public_private="private"
|
||||
else
|
||||
public_private="public"
|
||||
fi
|
||||
ynh_script_progression --message="Moving the application to $public_private..." --weight=3
|
||||
|
||||
if [ $is_public -eq 0 ]
|
||||
then
|
||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/admin" # etherpad admin page doesn't support SSO...
|
||||
else
|
||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||
fi
|
||||
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..."
|
||||
# Regen ssowat configuration
|
||||
yunohost app ssowatconf
|
||||
|
||||
# Update the config of the app
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Execution completed" --last
|
|
@ -78,17 +78,7 @@ else
|
|||
fi
|
||||
pad_config_automatic_logout="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_AUTOMATIC_LOGOUT:-$old_pad_config_automatic_logout}"
|
||||
|
||||
# Etherpad skin
|
||||
old_pad_config_skinname="$(get_config_value skinName)"
|
||||
if [ "$old_pad_config_skinname" = "no-skin" ]; then
|
||||
old_pad_config_skinname=noskin
|
||||
fi
|
||||
pad_config_skinname="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SKINNAME:-$old_pad_config_skinname}"
|
||||
if [ "$pad_config_skinname" = "no-skin" ]; then
|
||||
pad_config_skinname=noskin
|
||||
fi
|
||||
|
||||
# Mypads
|
||||
# MyPads
|
||||
if [ -d $final_path/node_modules/ep_mypads ]
|
||||
then
|
||||
# Enable
|
||||
|
@ -99,7 +89,7 @@ else
|
|||
fi
|
||||
mypads="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS:-$old_mypads}"
|
||||
|
||||
# Ldap for Mypads
|
||||
# LDAP for MyPads
|
||||
if grep -q "//noldap" $config_file
|
||||
then
|
||||
# Disable
|
||||
|
@ -110,10 +100,6 @@ else
|
|||
fi
|
||||
useldap="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP:-$old_useldap}"
|
||||
|
||||
# is_public
|
||||
old_is_public="$(ynh_app_setting_get --app=$app --key=is_public)"
|
||||
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
|
||||
|
||||
# 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}"
|
||||
|
@ -146,13 +132,8 @@ show_config() {
|
|||
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_PAD_CONFIGURATION_PAD_CONFIG_AUTOMATIC_LOGOUT=$pad_config_automatic_logout"
|
||||
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SKINNAME=$pad_config_skinname"
|
||||
|
||||
ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS=$mypads"
|
||||
ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP=$useldap"
|
||||
|
||||
ynh_return "YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC=$is_public"
|
||||
|
||||
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"
|
||||
|
@ -216,37 +197,27 @@ apply_config() {
|
|||
if [ "$pad_config_automatic_logout" != "$old_pad_config_automatic_logout" ]
|
||||
then
|
||||
ynh_use_nodejs
|
||||
pushd "$final_path"
|
||||
#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 [ "$pad_config_automatic_logout" = "0" ]
|
||||
then
|
||||
ynh_replace_string --match_string="^\(.*\"automatic_logut.*$\)" --replace_string="\/\/\1" --target_file="$config_file"
|
||||
npm uninstall ep_automatic_logut
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" npm uninstall ep_automatic_logut
|
||||
else
|
||||
ynh_replace_string --match_string="^\/\/\(.*\"automatic_logut.*$\)" --replace_string="\1" --target_file="$config_file"
|
||||
npm install ep_automatic_logut@${ep_automatic_logut_version}
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_automatic_logut@${ep_automatic_logut_version}
|
||||
fi
|
||||
popd
|
||||
chown -R $app: $final_path/node_modules
|
||||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# Plugin option ep_page_view_default
|
||||
if [ "$pad_config_skinname" != "$old_pad_config_skinname" ]
|
||||
then
|
||||
if [ "$pad_config_skinname" = "noskin" ]; then
|
||||
pad_config_skinname="no-skin"
|
||||
fi
|
||||
ynh_replace_string --match_string="\( *\"skinName\" *: \).*," --replace_string="\1\"$pad_config_skinname\"," --target_file="$config_file"
|
||||
ynh_app_setting_set --app=$app --key=pad_config_skinname --value="$pad_config_skinname"
|
||||
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 Abiword isn't installed, call the action add_remove_abiword.
|
||||
if ! which abiword > /dev/null
|
||||
then
|
||||
yunohost app action run $app add_remove_abiword
|
||||
|
@ -255,7 +226,7 @@ apply_config() {
|
|||
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 LibreOffice isn't installed, call the action add_remove_libreoffice.
|
||||
if ! which soffice > /dev/null
|
||||
then
|
||||
yunohost app action run $app add_remove_libreoffice
|
||||
|
@ -272,16 +243,17 @@ apply_config() {
|
|||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# Mypads
|
||||
# MyPads
|
||||
if [ "$mypads" != "$old_mypads" ]
|
||||
then
|
||||
ynh_use_nodejs
|
||||
pushd "$final_path"
|
||||
#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
|
||||
npm install ep_mypads@${mypads_version}
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_mypads@${mypads_version}
|
||||
else
|
||||
npm uninstall ep_mypads
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" npm uninstall ep_mypads
|
||||
fi
|
||||
popd
|
||||
chown -R $app: $final_path/node_modules
|
||||
|
@ -291,8 +263,8 @@ apply_config() {
|
|||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# Ldap for Mypads
|
||||
if [ "$useldap" != "$old_useldap" ]
|
||||
# LDAP for MyPads
|
||||
if [ "$useldap" != "$old_useldap" ]
|
||||
then
|
||||
if [ "$useldap" = "1" ]
|
||||
then
|
||||
|
@ -313,21 +285,6 @@ apply_config() {
|
|||
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 PUBLIC ACCESSIBILITY
|
||||
#=================================================
|
||||
|
||||
# Change public accessibility
|
||||
if [ "$is_public" != "$old_is_public" ]
|
||||
then
|
||||
if [ "$is_public" = "1" ]
|
||||
then
|
||||
yunohost app action run $app public_private --args is_public=1
|
||||
else
|
||||
yunohost app action run $app public_private --args is_public=0
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# MODIFY OVERWRITTING SETTINGS
|
||||
#=================================================
|
||||
|
|
109
scripts/install
109
scripts/install
|
@ -6,9 +6,12 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||
sleep 60
|
||||
fi
|
||||
|
||||
# Load common variables for all scripts.
|
||||
source _variables
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -92,9 +95,9 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||
ynh_script_progression --message="Installing dependencies..." --weight=120
|
||||
|
||||
if [ "$export" = "abiword" ]; then
|
||||
ynh_install_app_dependencies $abiword_app_depencencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
|
||||
elif [ "$export" = "libreoffice" ]; then
|
||||
ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -110,9 +113,18 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
|
|||
ynh_script_progression --message="Creating a MySQL database..."
|
||||
|
||||
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_name --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a dedicated system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -130,14 +142,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||
|
||||
# Create a dedicated system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -160,17 +164,11 @@ ynh_use_logrotate --specific_user=$app/$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing Etherpad..." --weight=90
|
||||
|
||||
# Install dependencies and proceed to the installation
|
||||
ynh_use_nodejs
|
||||
(
|
||||
cd "$final_path"
|
||||
mkdir -p node_modules
|
||||
cd node_modules
|
||||
[ -e ep_etherpad-lite ] || ln -s ../src ep_etherpad-lite
|
||||
cd ep_etherpad-lite
|
||||
chown -R $app: $final_path
|
||||
ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --save --loglevel warn
|
||||
)
|
||||
chown -R $app: $final_path
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" bin/installDeps.sh
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE ETHERPAD
|
||||
|
@ -178,12 +176,8 @@ ynh_use_nodejs
|
|||
ynh_script_progression --message="Configuring Etherpad..." --weight=6
|
||||
|
||||
cp ../conf/settings.json "$final_path/settings.json"
|
||||
cp ../conf/credentials.json "$final_path/credentials.json"
|
||||
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$final_path/credentials.json"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
|
||||
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
|
||||
ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
|
||||
if [ "$export" = "abiword" ]
|
||||
then
|
||||
# Get abiword binary path
|
||||
|
@ -207,15 +201,16 @@ fi
|
|||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/settings.json"
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/credentials.json"
|
||||
|
||||
ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json"
|
||||
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set files ownership to etherpad
|
||||
chown -R $app: $final_path
|
||||
chown -R $app:$app $final_path
|
||||
chmod o-rwx $final_path
|
||||
# Restrict access to credentials.json
|
||||
chmod 600 $final_path/credentials.json
|
||||
|
||||
|
@ -224,15 +219,14 @@ chmod 600 $final_path/credentials.json
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=4
|
||||
|
||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
ynh_add_systemd_config --others_var="ynh_node_load_PATH"
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# INSTALL FRAMAPAD'S PLUGINS
|
||||
|
@ -241,35 +235,35 @@ ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
|
|||
|
||||
pushd "$final_path"
|
||||
# Add Left/Center/Right/Justify to lines of text in a pad
|
||||
npm install ep_align@${ep_align_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_align@${ep_align_version} >> $install_log 2>&1
|
||||
# Framapad - Adds author names to span titles
|
||||
npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1
|
||||
# Automatically disconnects user after some period of time (Prevent server overload)
|
||||
npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1
|
||||
# Framapad - Adds comments on sidebar and link it to the text.
|
||||
npm install ep_comments_page@${ep_comments_page_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_comments_page@${ep_comments_page_version} >> $install_log 2>&1
|
||||
# Framapad - Displays paragraphs, sentences, words and characters counts.
|
||||
#npm install ep_countable@${ep_countable_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_countable@${ep_countable_version} >> $install_log 2>&1
|
||||
# Framapad - Delete pads which were never edited
|
||||
npm install ep_delete_empty_pads@${ep_delete_empty_pads_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_delete_empty_pads@${ep_delete_empty_pads_version} >> $install_log 2>&1
|
||||
# Framapad - Apply colors to fonts
|
||||
npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1
|
||||
# Framapad - Adds heading support to Etherpad Lite.
|
||||
npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1
|
||||
# Framapad - Edit and Export as Markdown in Etherpad
|
||||
npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1
|
||||
if [ $mypads -eq 1 ]; then
|
||||
# Framapad - Groups and private pads for etherpad
|
||||
npm install ep_mypads@${mypads_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_mypads@${mypads_version} >> $install_log 2>&1
|
||||
fi
|
||||
# Framapad - Add support to do 'Spell checking'
|
||||
npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1
|
||||
# Framapad - Add support for Subscript and Superscript
|
||||
npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1
|
||||
# Framapad - View a table of contents for your pad
|
||||
npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1
|
||||
# Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views
|
||||
npm install ep_font_size@${ep_font_size_version} >> $install_log 2>&1
|
||||
ynh_npm install ep_font_size@${ep_font_size_version} >> $install_log 2>&1
|
||||
popd
|
||||
chown -R $app: $final_path/node_modules
|
||||
|
||||
|
@ -279,25 +273,26 @@ chown -R $app: $final_path/node_modules
|
|||
|
||||
if [ $mypads -eq 1 ]
|
||||
then
|
||||
# Add a link to etherpad to allow anonymous pads creation from Mypads.
|
||||
# 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
|
||||
# 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
|
||||
|
||||
# Find the /div just after the field to open a pad
|
||||
mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "</div>" | cut -d '-' -f 1)
|
||||
# In order to add a link to mypads plugin.
|
||||
sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads/">MyPads</a></font></center>@" $final_path/src/templates/index.html
|
||||
## Find the /div just after the field to open a pad
|
||||
#mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "</div>" | cut -d '-' -f 1)
|
||||
## In order to add a link to MyPads plugin.
|
||||
#sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads/">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>' $final_path/src/templates/index.html
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Fail2ban..." --weight=13
|
||||
ynh_script_progression --message="Configuring Fail2Ban..." --weight=13
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
|
@ -345,7 +340,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)
|
|||
|
||||
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."
|
||||
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
|
||||
|
@ -354,10 +349,6 @@ ynh_print_OFF
|
|||
echo "$Informations
|
||||
You can also find a config file for Etherpad at this path /var/www/etherpad_mypads/settings.json.
|
||||
|
||||
Your credentials for the admin panel are:
|
||||
- login : $admin
|
||||
- password : $password
|
||||
|
||||
You can configure this app easily by using the experimental config-panel feature $admin_panel/config-panel.
|
||||
You can also find some specific actions for this app by using the experimental action feature $admin_panel/actions.
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ if [ "$export" != "none" ]
|
|||
then
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=60
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
ynh_exec_warn_less ynh_remove_app_dependencies
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -97,7 +97,7 @@ ynh_remove_logrotate
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=7
|
||||
|
||||
# Remove the dedicated fail2ban config
|
||||
# Remove the dedicated Fail2Ban config
|
||||
ynh_remove_fail2ban_config
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -110,9 +110,9 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|||
ynh_script_progression --message="Reinstalling dependencies..." --weight=60
|
||||
|
||||
if [ "$export" = "abiword" ]; then
|
||||
ynh_install_app_dependencies $abiword_app_depencencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
|
||||
elif [ "$export" = "libreoffice" ]; then
|
||||
ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -136,6 +136,7 @@ ynh_exec_warn_less npm cache clean --force
|
|||
|
||||
# Restore permissions on app files
|
||||
chown -R $app: $final_path
|
||||
chmod o-rwx $final_path
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
|
@ -154,7 +155,7 @@ systemctl enable $app.service --quiet
|
|||
#=================================================
|
||||
# RESTORE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the Fail2ban configuration..." --weight=6
|
||||
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=6
|
||||
|
||||
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
|
||||
|
@ -197,10 +198,6 @@ ynh_print_OFF
|
|||
echo "$Informations
|
||||
You can also find a config file for Etherpad at this path /var/www/etherpad_mypads/settings.json.
|
||||
|
||||
Your credentials for the admin panel are:
|
||||
- login : $admin
|
||||
- password : $password
|
||||
|
||||
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
|
||||
|
|
196
scripts/upgrade
196
scripts/upgrade
|
@ -8,7 +8,6 @@
|
|||
|
||||
# Load common variables for all scripts.
|
||||
source _variables
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -27,6 +26,9 @@ 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)
|
||||
ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON
|
||||
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
|
||||
useldap=$(ynh_app_setting_get --app=$app --key=useldap)
|
||||
overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
|
||||
|
@ -40,7 +42,6 @@ pad_config_showlinenumbers=$(ynh_app_setting_get --app=$app --key=pad_config_sho
|
|||
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)
|
||||
pad_config_skinname=$(ynh_app_setting_get --app=$app --key=pad_config_skinname)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -168,6 +169,14 @@ ynh_script_progression --message="Stopping Etherpad service..." --weight=3
|
|||
|
||||
ynh_systemd_action --action=stop
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -178,8 +187,22 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=4
|
||||
|
||||
# # Create a temporary directory
|
||||
# tmpdir="$(mktemp -d)"
|
||||
# # Backup the config file in the temp dir
|
||||
# cp -a "$final_path/settings.json" "$tmpdir/settings.json"
|
||||
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
# # Copy the admin saved settings from tmp directory to final config path
|
||||
# cp -a "$tmpdir/settings.json" "$final_path/settings.json"
|
||||
|
||||
# # Remove the tmp directory securely
|
||||
# ynh_secure_remove --file="$tmpdir"
|
||||
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -188,9 +211,9 @@ fi
|
|||
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
||||
|
||||
if [ "$export" = "abiword" ]; then
|
||||
ynh_install_app_dependencies $abiword_app_depencencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
|
||||
elif [ "$export" = "libreoffice" ]; then
|
||||
ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -209,50 +232,90 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NodeJS..." --weight=4
|
||||
|
||||
# Remove the old nvm helper.
|
||||
if [ -d /opt/nvm ]
|
||||
then
|
||||
ynh_secure_remove --file="/opt/nvm"
|
||||
sed --in-place "/NVM_DIR/d" /root/.bashrc
|
||||
fi
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# HANDLE LOG FILES AND LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
|
||||
# Create log directory
|
||||
install_log=/var/log/$app/installation.log
|
||||
touch $install_log
|
||||
chown $app -R /var/log/$app
|
||||
|
||||
#=================================================
|
||||
# UPGRADE NPM MODULES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading Etherpad npm modules..." --weight=60
|
||||
|
||||
# Update the main modules of etherpad
|
||||
chown -R $app: $final_path
|
||||
(cd "$final_path/src"
|
||||
ynh_exec_warn_less npm cache clean --force
|
||||
# Remove package-lock.json to prevent any shit during npm update...
|
||||
ynh_secure_remove --file="$final_path/src/package-lock.json"
|
||||
ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" update)
|
||||
ynh_script_progression --message="Upgrading Etherpad..." --weight=60
|
||||
|
||||
# Then update the additionnal modules
|
||||
(cd "$final_path"
|
||||
ynh_exec_warn_less npm cache clean --force
|
||||
while read node_module
|
||||
do
|
||||
# Ignore ep_etherpad-lite, this part is updated before in this script.
|
||||
if [ "$node_module" = "ep_etherpad-lite" ]; then
|
||||
continue
|
||||
fi
|
||||
echo "Update $node_module"
|
||||
# Build the name of the variable with the version.
|
||||
module_version=${node_module}_version
|
||||
# Get the content of the variable (from the file _variables)
|
||||
module_version=${!module_version:-}
|
||||
# If the module has no version stored in a variable into the file, keep it empty.
|
||||
# That way, the upgrade will not be specific to a version.
|
||||
## Otherwise, add @ before the version number to force the upgrade to this version.
|
||||
if [ -n "${module_version}" ]; then
|
||||
module_version=@${module_version}
|
||||
fi
|
||||
ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --upgrade ${node_module}${module_version} || true
|
||||
done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")")
|
||||
chown -R $app: $final_path
|
||||
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" src/bin/installDeps.sh
|
||||
# ynh_exec_warn_less npm cache clean --force
|
||||
# ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm cache clean --force
|
||||
# while read node_module
|
||||
# do
|
||||
# # Ignore ep_etherpad-lite, this part is updated before in this script.
|
||||
# if [ "$node_module" = "ep_etherpad-lite" ]; then
|
||||
# continue
|
||||
# fi
|
||||
# echo "Update $node_module"
|
||||
# # Build the name of the variable with the version.
|
||||
# module_version=${node_module}_version
|
||||
# # Get the content of the variable (from the file _variables)
|
||||
# module_version=${!module_version:-}
|
||||
# # If the module has no version stored in a variable into the file, keep it empty.
|
||||
# # That way, the upgrade will not be specific to a version.
|
||||
# ## Otherwise, add @ before the version number to force the upgrade to this version.
|
||||
# if [ -n "${module_version}" ]; then
|
||||
# module_version=@${module_version}
|
||||
# fi
|
||||
# ynh_exec_warn_less ynh_exec_as $app env "$ynh_node_load_PATH" npm install --upgrade ${node_module}${module_version} || true
|
||||
# done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")"
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# INSTALL FRAMAPAD'S PLUGINS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
|
||||
|
||||
pushd "$final_path"
|
||||
# Add Left/Center/Right/Justify to lines of text in a pad
|
||||
ynh_npm install ep_align@${ep_align_version} >> $install_log 2>&1
|
||||
# Framapad - Adds author names to span titles
|
||||
ynh_npm install ep_author_hover@${ep_author_hover_version} >> $install_log 2>&1
|
||||
# Automatically disconnects user after some period of time (Prevent server overload)
|
||||
ynh_npm install ep_automatic_logut@${ep_automatic_logut_version} >> $install_log 2>&1
|
||||
# Framapad - Adds comments on sidebar and link it to the text.
|
||||
ynh_npm install ep_comments_page@${ep_comments_page_version} >> $install_log 2>&1
|
||||
# Framapad - Displays paragraphs, sentences, words and characters counts.
|
||||
ynh_npm install ep_countable@${ep_countable_version} >> $install_log 2>&1
|
||||
# Framapad - Delete pads which were never edited
|
||||
ynh_npm install ep_delete_empty_pads@${ep_delete_empty_pads_version} >> $install_log 2>&1
|
||||
# Framapad - Apply colors to fonts
|
||||
ynh_npm install ep_font_color@${ep_font_color_version} >> $install_log 2>&1
|
||||
# Framapad - Adds heading support to Etherpad Lite.
|
||||
ynh_npm install ep_headings2@${ep_headings2_version} >> $install_log 2>&1
|
||||
# Framapad - Edit and Export as Markdown in Etherpad
|
||||
ynh_npm install ep_markdown@${ep_markdown_version} >> $install_log 2>&1
|
||||
if [ $mypads -eq 1 ]; then
|
||||
# Framapad - Groups and private pads for etherpad
|
||||
ynh_npm install ep_mypads@${mypads_version} >> $install_log 2>&1
|
||||
fi
|
||||
# Framapad - Add support to do 'Spell checking'
|
||||
ynh_npm install ep_spellcheck@${ep_spellcheck_version} >> $install_log 2>&1
|
||||
# Framapad - Add support for Subscript and Superscript
|
||||
ynh_npm install ep_subscript_and_superscript@${ep_subscript_and_superscript_version} >> $install_log 2>&1
|
||||
# Framapad - View a table of contents for your pad
|
||||
ynh_npm install ep_table_of_contents@${ep_table_of_contents_version} >> $install_log 2>&1
|
||||
# Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views
|
||||
ynh_npm install ep_font_size@${ep_font_size_version} >> $install_log 2>&1
|
||||
popd
|
||||
chown -R $app: $final_path/node_modules
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -276,13 +339,13 @@ then
|
|||
then
|
||||
# Get abiword binary path
|
||||
abiword_path=`which abiword`
|
||||
# Set the path of abiword into etherpad config
|
||||
# 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
|
||||
# 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
|
||||
|
||||
|
@ -293,7 +356,7 @@ then
|
|||
fi
|
||||
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
|
||||
|
||||
# Use ldap for mypads
|
||||
# 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"
|
||||
|
@ -315,9 +378,6 @@ then
|
|||
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"
|
||||
fi
|
||||
if [ -n "$pad_config_skinname" ]; then
|
||||
ynh_replace_string --match_string="\(\"skinName\" *: \).*," --replace_string="\1\"$pad_config_skinname\"," --target_file="$final_path/settings.json"
|
||||
fi
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/settings.json"
|
||||
|
@ -326,39 +386,19 @@ then
|
|||
# Overwrite the credentials config file only if it's allowed
|
||||
if [ $overwrite_credentials -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/credentials.json"
|
||||
cp ../conf/credentials.json "$final_path/credentials.json"
|
||||
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$app" --target_file="$final_path/credentials.json"
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
|
||||
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
|
||||
ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/credentials.json"
|
||||
ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json"
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set files ownership to etherpad
|
||||
chown -R $app: $final_path
|
||||
|
||||
chmod 600 "$final_path/credentials.json"
|
||||
chmod o-rwx $final_path
|
||||
# Restrict access to credentials.json
|
||||
chmod 600 "$final_path/credentials.json"
|
||||
chown $app -R /var/log/$app/etherpad.log
|
||||
|
||||
#=================================================
|
||||
|
@ -370,9 +410,9 @@ yunohost service add $app --description="Collaborative editor" --log="/var/log/$
|
|||
#=================================================
|
||||
# UPGRADE FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring Fail2ban..." --weight=8
|
||||
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
|
@ -391,8 +431,7 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
|
|||
# Overwrite the systemd configuration only if it's allowed
|
||||
if [ $overwrite_systemd -eq 1 ]
|
||||
then
|
||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||
ynh_add_systemd_config
|
||||
ynh_add_systemd_config --others_var="ynh_node_load_PATH"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -401,10 +440,11 @@ fi
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ] && [ $mypads -eq 1 ]
|
||||
then
|
||||
# Find the /div just after the field to open a pad
|
||||
mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "</div>" | cut -d '-' -f 1)
|
||||
# In order to add a link to mypads plugin.
|
||||
sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads/">MyPads</a></font></center>@" $final_path/src/templates/index.html
|
||||
# # Find the /div just after the field to open a pad
|
||||
# mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "</div>" | cut -d '-' -f 1)
|
||||
# # In order to add a link to mypads plugin.
|
||||
# sed -i "$mod_line s@div>@&\n\t<center><br><font size="5"><a href="./mypads/">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>' $final_path/src/templates/index.html
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue