1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git synced 2024-09-03 18:36:09 +02:00
This commit is contained in:
ericgaspar 2021-03-22 21:40:50 +01:00
parent 93988920bc
commit 7336d8edd3
No known key found for this signature in database
GPG key ID: 574F281483054D44
7 changed files with 34 additions and 72 deletions

View file

@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
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.12
**Shipped version:** 1.8.13
## Screenshots

View file

@ -11,13 +11,6 @@
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Validation
## Package_check results
---
*Minor decision*
- [ ] **Code review** :
- [ ] **Approval (LGTM)** :
*Code review and approval have to be from a member of @YunoHost-Apps/apps-group*
- **CI succeeded** :
[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/etherpad_mypads_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/etherpad_mypads_ynh%20PR-NUM-/)
*Please replace '-NUM-' in this link by the PR number.*
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -67,18 +67,18 @@ 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
@ -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

View file

@ -78,7 +78,7 @@ else
fi
pad_config_automatic_logout="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_AUTOMATIC_LOGOUT:-$old_pad_config_automatic_logout}"
# Mypads
# MyPads
if [ -d $final_path/node_modules/ep_mypads ]
then
# Enable
@ -89,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
@ -224,7 +224,7 @@ apply_config() {
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
@ -233,7 +233,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
@ -250,7 +250,7 @@ apply_config() {
restart_etherpad=1
fi
# Mypads
# MyPads
if [ "$mypads" != "$old_mypads" ]
then
ynh_use_nodejs

View file

@ -114,6 +114,14 @@ 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
#=================================================
@ -131,14 +139,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
#=================================================
@ -161,18 +161,6 @@ 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

View file

@ -154,7 +154,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"

View file

@ -170,6 +170,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
#=================================================
@ -218,22 +226,6 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
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)
# pushd $final_path
# ynh_use_nodejs
# ynh_exec_as $app env "$ynh_node_load_PATH" src/bin/installDeps.sh
# popd
# Then update the additionnal modules
pushd $final_path
ynh_use_nodejs
@ -261,9 +253,6 @@ do
done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")"
popd
# 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_")")
#=================================================
# SPECIFIC UPGRADE
#=================================================
@ -286,13 +275,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
@ -303,7 +292,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"
@ -337,14 +326,6 @@ then
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
#=================================================
@ -364,7 +345,7 @@ 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
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