mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
English translation and typo
This commit is contained in:
parent
b154cf912d
commit
a588724425
7 changed files with 154 additions and 87 deletions
|
@ -6,9 +6,9 @@ abiword_app_depencencies="abiword"
|
|||
# Dependencies for libre office
|
||||
libreoffice_app_dependencies="unoconv libreoffice-writer"
|
||||
|
||||
# Version of nodejs
|
||||
# NodeJS version
|
||||
nodejs_version=6
|
||||
|
||||
# Version of mypads
|
||||
# Mypads version
|
||||
# This variable is mostly used to force an upgrade of the package in case of new versions of mypads.
|
||||
mypads_version=1.6.8
|
||||
|
|
|
@ -29,20 +29,20 @@ db_name=$(ynh_app_setting_get $app db_name)
|
|||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
#=================================================
|
||||
# BACKUP OF THE MAIN DIR OF THE APP
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
CHECK_SIZE "$final_path"
|
||||
ynh_backup "$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE NGINX CONFIGURATION
|
||||
# BACKUP NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE SQL BDD
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
||||
ynh_mysql_dump_db "$db_name" > db.sql
|
||||
|
|
|
@ -67,7 +67,7 @@ fi
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||
# Clean installation remaining that are not handle by the remove script.
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -119,7 +119,7 @@ ynh_systemd_action --action=reload --service_name=nginx
|
|||
# CHECK ETHERPAD STARTING
|
||||
#=================================================
|
||||
|
||||
# Wait for etherpad fully started
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
|
|
101
scripts/install
101
scripts/install
|
@ -16,10 +16,11 @@ source _variables
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||
# Clean installation remaining that are not handle by the remove script.
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
|
@ -44,7 +45,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
ynh_print_OFF
|
||||
if [ "${#password}" -lt 8 ] || [ "${#password}" -gt 30 ]
|
||||
then
|
||||
ynh_die "The password must have between 8 and 30 characters."
|
||||
ynh_die "The password must be between 8 and 30 characters."
|
||||
fi
|
||||
ynh_print_ON
|
||||
|
||||
|
@ -77,7 +78,8 @@ ynh_app_setting_set $app useldap $useldap
|
|||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
|
||||
port=$(ynh_find_port 9001) # Look for an available port
|
||||
# Find a free port
|
||||
port=$(ynh_find_port 9001)
|
||||
ynh_app_setting_set $app port $port
|
||||
|
||||
#=================================================
|
||||
|
@ -97,7 +99,7 @@ fi
|
|||
ynh_install_nodejs $nodejs_version
|
||||
|
||||
#=================================================
|
||||
# CREATE A SQL DB
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
|
||||
db_name=$(ynh_sanitize_dbid $app)
|
||||
|
@ -109,19 +111,22 @@ ynh_mysql_setup_db $db_name $db_name
|
|||
#=================================================
|
||||
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
ynh_setup_source "$final_path" # Download, check integrity and uncompress the source from app.src
|
||||
# Download, check integrity and uncompress the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app $final_path # Create a dedicated system user
|
||||
# Create a dedicated system user
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -143,7 +148,7 @@ ynh_use_logrotate
|
|||
# INSTALL ETHERPAD
|
||||
#=================================================
|
||||
|
||||
# Install dependencies and proceed with the installation
|
||||
# Install dependencies and proceed to the installation
|
||||
ynh_use_nodejs
|
||||
"$final_path/bin/installDeps.sh" > $install_log 2>&1
|
||||
npm install forever -g >> $install_log 2>&1
|
||||
|
@ -161,12 +166,16 @@ ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json"
|
|||
ynh_print_OFF; ynh_replace_special_string "__PASSWD__" "$password" "$final_path/credentials.json"; ynh_print_ON
|
||||
if [ "$export" = "abiword" ]
|
||||
then
|
||||
abiword_path=`which abiword` # Get abiword binary path
|
||||
ynh_replace_string "\"abiword\" : null" "\"abiword\" : \"$abiword_path\"" "$final_path/settings.json" # Renseigne l'emplacement de abiword dans la config de etherpad
|
||||
# Get abiword binary path
|
||||
abiword_path=`which abiword`
|
||||
# Set the path of abiword into etherpad config
|
||||
ynh_replace_string "\"abiword\" : null" "\"abiword\" : \"$abiword_path\"" "$final_path/settings.json"
|
||||
elif [ "$export" = "libreoffice" ]
|
||||
then
|
||||
soffice_path=`which soffice` # Get soffice binary path
|
||||
ynh_replace_string "\"soffice\" : null" "\"soffice\" : \"$soffice_path\"" "$final_path/settings.json" # Renseigne l'emplacement de abiword dans la config de etherpad
|
||||
# Get soffice binary path
|
||||
soffice_path=`which soffice`
|
||||
# Set the path of soffice into etherpad config
|
||||
ynh_replace_string "\"soffice\" : null" "\"soffice\" : \"$soffice_path\"" "$final_path/settings.json"
|
||||
fi
|
||||
ynh_replace_string "__LANGUAGE__" "$language" "$final_path/settings.json"
|
||||
|
||||
|
@ -176,8 +185,10 @@ then
|
|||
ynh_replace_string "//noldap" "" "$final_path/settings.json"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum "$final_path/settings.json" # Store config file checksum
|
||||
ynh_store_file_checksum "$final_path/credentials.json" # Store config file checksum
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$final_path/settings.json"
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$final_path/credentials.json"
|
||||
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
|
@ -185,20 +196,21 @@ ynh_store_file_checksum "$final_path/credentials.json" # Store config file check
|
|||
|
||||
# Set files ownership to etherpad
|
||||
chown -R $app: $final_path
|
||||
chmod 600 $final_path/credentials.json # Restrict access to credentials.json
|
||||
# Restrict access to credentials.json
|
||||
chmod 600 $final_path/credentials.json
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# ENABLE SERVICE IN ADMIN PANEL
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
# Add service to YunoHost monitoring panel
|
||||
yunohost service add $app --log "/var/log/$app/etherpad.log"
|
||||
|
||||
#=================================================
|
||||
|
@ -206,23 +218,38 @@ yunohost service add $app --log "/var/log/$app/etherpad.log"
|
|||
#=================================================
|
||||
|
||||
pushd "$final_path"
|
||||
npm install ep_align # Add Left/Center/Right/Justify to lines of text in a pad
|
||||
npm install ep_author_hover >> $install_log 2>&1 # Framapad - Adds author names to span titles
|
||||
npm install ep_automatic_logut >> $install_log 2>&1 # Automatically disconnects user after some period of time (Prevent server overload)
|
||||
npm install ep_comments_page >> $install_log 2>&1 # Framapad - Adds comments on sidebar and link it to the text.
|
||||
npm install ep_countable >> $install_log 2>&1 # Framapad - Displays paragraphs, sentences, words and characters counts.
|
||||
npm install ep_delete_empty_pads >> $install_log 2>&1 # Framapad - Delete pads which were never edited
|
||||
npm install ep_font_color >> $install_log 2>&1 # Framapad - Apply colors to fonts
|
||||
npm install ep_headings2 >> $install_log 2>&1 # Framapad - Adds heading support to Etherpad Lite.
|
||||
npm install ep_markdown >> $install_log 2>&1 # Framapad - Edit and Export as Markdown in Etherpad
|
||||
# Add Left/Center/Right/Justify to lines of text in a pad
|
||||
npm install ep_align >> $install_log 2>&1
|
||||
# Framapad - Adds author names to span titles
|
||||
npm install ep_author_hover >> $install_log 2>&1
|
||||
# Automatically disconnects user after some period of time (Prevent server overload)
|
||||
npm install ep_automatic_logut >> $install_log 2>&1
|
||||
# Framapad - Adds comments on sidebar and link it to the text.
|
||||
npm install ep_comments_page >> $install_log 2>&1
|
||||
# Framapad - Displays paragraphs, sentences, words and characters counts.
|
||||
npm install ep_countable >> $install_log 2>&1
|
||||
# Framapad - Delete pads which were never edited
|
||||
npm install ep_delete_empty_pads >> $install_log 2>&1
|
||||
# Framapad - Apply colors to fonts
|
||||
npm install ep_font_color >> $install_log 2>&1
|
||||
# Framapad - Adds heading support to Etherpad Lite.
|
||||
npm install ep_headings2 >> $install_log 2>&1
|
||||
# Framapad - Edit and Export as Markdown in Etherpad
|
||||
npm install ep_markdown >> $install_log 2>&1
|
||||
if [ $mypads -eq 1 ]; then
|
||||
npm install ep_mypads@${mypads_version} >> $install_log 2>&1 # Framapad - Groups and private pads for etherpad
|
||||
# Framapad - Groups and private pads for etherpad
|
||||
npm install ep_mypads@${mypads_version} >> $install_log 2>&1
|
||||
fi
|
||||
npm install ep_page_view >> $install_log 2>&1 # Framapad - Add support to do 'page view', with a toggle on/off option in Settings, also Page Breaks with Control Enter
|
||||
npm install ep_spellcheck >> $install_log 2>&1 # Framapad - Add support to do 'Spell checking'
|
||||
npm install ep_subscript_and_superscript >> $install_log 2>&1 # Framapad - Add support for Subscript and Superscript
|
||||
npm install ep_table_of_contents >> $install_log 2>&1 # Framapad - View a table of contents for your pad
|
||||
npm install ep_user_font_size >> $install_log 2>&1 # Framapad - User Pad Contents font size can be set in settings, this does not effect other peoples views
|
||||
# Framapad - Add support to do 'page view', with a toggle on/off option in Settings, also Page Breaks with Control Enter
|
||||
npm install ep_page_view >> $install_log 2>&1
|
||||
# Framapad - Add support to do 'Spell checking'
|
||||
npm install ep_spellcheck >> $install_log 2>&1
|
||||
# Framapad - Add support for Subscript and Superscript
|
||||
npm install ep_subscript_and_superscript >> $install_log 2>&1
|
||||
# Framapad - View a table of contents for your pad
|
||||
npm install ep_table_of_contents >> $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_user_font_size >> $install_log 2>&1
|
||||
popd
|
||||
chown -R $app: $final_path/node_modules
|
||||
|
||||
|
@ -239,14 +266,17 @@ then
|
|||
ynh_replace_string "^ *\"FOOTER\": .*2.0" "& | <a href='../admin'>Etherpad admin</a>" $final_path/node_modules/ep_mypads/static/l10n/en.json
|
||||
ynh_replace_string "^ *\"FOOTER\": .*2.0" "& | <a href='../admin'>Etherpad admin</a>" $final_path/node_modules/ep_mypads/static/l10n/fr.json
|
||||
|
||||
mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "</div>" | cut -d '-' -f 1) # Recherche le /div situé sous le champs d'ouverture de pad.
|
||||
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 # Pour ajouter un lien vers le plugin mypads depuis la page d'Etherpad.
|
||||
# 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
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
|
@ -256,7 +286,8 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege
|
|||
if [ $is_public -eq 1 ]; then
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
else
|
||||
ynh_app_setting_set $app skipped_uris "/admin" # etherpad admin page doesn't support SSO...
|
||||
# etherpad admin page doesn't support SSO...
|
||||
ynh_app_setting_set $app skipped_uris "/admin"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -26,13 +26,15 @@ export=$(ynh_app_setting_get $app export)
|
|||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# DISABLE SERVICE IN ADMIN PANEL
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
if yunohost service status | grep -q $app # Check if service is declared in YunoHost
|
||||
# Check if the service is declared in YunoHost
|
||||
if yunohost service status | grep -q $app
|
||||
then
|
||||
ynh_print_info "Remove $app service" >&2
|
||||
yunohost service remove $app
|
||||
|
@ -44,6 +46,7 @@ fi
|
|||
|
||||
if [ "$export" != "none" ]
|
||||
then
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
fi
|
||||
|
||||
|
@ -54,33 +57,38 @@ fi
|
|||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE SQL DB
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
||||
ynh_mysql_remove_db $db_name $db_name # Remove the database along with the associated user
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db $db_name $db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MAIN DIR OF THE APP
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_secure_remove "/var/www/$app" # Remove the app directory securely
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove "/var/www/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE NGINX CONFIGURATION
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_remove_nginx_config # Remove the dedicated nginx config
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE LOGROTATE CONFIG
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_remove_logrotate # Remove the app-specific logrotate config
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Remove the dedicated fail2ban config
|
||||
ynh_remove_fail2ban_config
|
||||
|
||||
#=================================================
|
||||
|
@ -89,4 +97,5 @@ ynh_remove_fail2ban_config
|
|||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
# Delete dedicated system user
|
||||
ynh_system_user_delete $app
|
||||
|
|
|
@ -16,7 +16,7 @@ source ../settings/scripts/_variables
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
# Nettoyage des résidus d'installation non pris en charge par le script remove.
|
||||
# Clean installation remaining that are not handle by the remove script.
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -55,19 +55,19 @@ ynh_maintenance_mode_ON
|
|||
#=================================================
|
||||
# STANDARD RESTORE STEPS
|
||||
#=================================================
|
||||
# RESTORE OF THE NGINX CONFIGURATION
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF THE MAIN DIR OF THE APP
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE SQL DB
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
|
@ -78,7 +78,8 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
|||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app $final_path # Recreate the dedicated user, if it doesn't exist
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORE
|
||||
|
@ -121,14 +122,14 @@ npm cache clean
|
|||
npm install forever -g >> $install_log 2>&1
|
||||
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Set files ownership to etherpad
|
||||
# Restore permissions on app files
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# ENABLE SERVICE IN ADMIN PANEL
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --log "/var/log/$app/etherpad.log"
|
||||
|
@ -138,7 +139,6 @@ yunohost service add $app --log "/var/log/$app/etherpad.log"
|
|||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/systemd/system/$app.service"
|
||||
## Démarrage auto du service
|
||||
systemctl enable $app.service
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -39,28 +39,32 @@ ynh_systemd_action --action=restart --line_match="You can access your Etherpad i
|
|||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# FIX OLD THINGS
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
||||
# Convert is_public as a boolean
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
ynh_app_setting_set $app is_public 1 # Convert is_public to boolean
|
||||
ynh_app_setting_set $app is_public 1
|
||||
is_public=1
|
||||
elif [ "$is_public" = "No" ]; then
|
||||
ynh_app_setting_set $app is_public 0
|
||||
is_public=0
|
||||
fi
|
||||
|
||||
if [ -z $db_name ]; then # If db_name setting doesn't exist
|
||||
# If db_name setting doesn't exist
|
||||
if [ -z $db_name ]; then
|
||||
db_name=$(ynh_sanitize_dbid $app)
|
||||
ynh_app_setting_set $app db_name $db_name
|
||||
fi
|
||||
|
||||
if [ -z $abiword ]; then # If abiword setting doesn't exist
|
||||
# If abiword setting doesn't exist
|
||||
if [ -z $abiword ]; then
|
||||
abiword=0
|
||||
ynh_app_setting_set $app abiword $abiword
|
||||
fi
|
||||
|
||||
if [ -n $abiword ]; then # If abiword setting exists
|
||||
# If abiword setting exists
|
||||
if [ -n $abiword ]; then
|
||||
if [ $abiword -eq 1 ]; then
|
||||
export=abiword
|
||||
fi
|
||||
|
@ -68,22 +72,26 @@ if [ -n $abiword ]; then # If abiword setting exists
|
|||
ynh_app_setting_delete $app abiword
|
||||
fi
|
||||
|
||||
if [ -z $export ]; then # If export setting doesn't exist
|
||||
# If export setting doesn't exist
|
||||
if [ -z $export ]; then
|
||||
export=none
|
||||
ynh_app_setting_set $app export $export
|
||||
fi
|
||||
|
||||
if [ -z $mypads ]; then # If mypads setting doesn't exist
|
||||
# If mypads setting doesn't exist
|
||||
if [ -z $mypads ]; then
|
||||
mypads=1
|
||||
ynh_app_setting_set $app mypads $mypads
|
||||
fi
|
||||
|
||||
if [ -z $useldap ]; then # If useldap setting doesn't exist
|
||||
# If useldap setting doesn't exist
|
||||
if [ -z $useldap ]; then
|
||||
useldap=0
|
||||
ynh_app_setting_set $app useldap $useldap
|
||||
fi
|
||||
|
||||
if [ -z $path_url ]; then # If path_url setting doesn't exist
|
||||
# If path_url setting doesn't exist
|
||||
if [ -z $path_url ]; then
|
||||
path_url="/"
|
||||
ynh_app_setting_set $app path $path_url
|
||||
fi
|
||||
|
@ -95,10 +103,10 @@ fi
|
|||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Cleanup installatioNettoyage des résidus d'installation non pris en charge par le script remove.
|
||||
# Clean installation remaining that are not handle by the remove script.
|
||||
ynh_clean_check_starting
|
||||
|
||||
# restore it if the upgrade fails
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -124,7 +132,8 @@ ynh_systemd_action --action=stop
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_setup_source "$final_path" # Download, check integrity and uncompress the source from app.src
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -141,6 +150,7 @@ fi
|
|||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
|
@ -182,8 +192,10 @@ done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")")
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_backup_if_checksum_is_different "$final_path/settings.json" # Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different "$final_path/credentials.json" # Verify the checksum and backup the file if it's different
|
||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
ynh_backup_if_checksum_is_different "$final_path/settings.json"
|
||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
ynh_backup_if_checksum_is_different "$final_path/credentials.json"
|
||||
cp ../conf/settings.json "$final_path/settings.json"
|
||||
cp ../conf/credentials.json "$final_path/credentials.json"
|
||||
ynh_replace_string "__PORT__" "$port" "$final_path/settings.json"
|
||||
|
@ -195,15 +207,20 @@ then
|
|||
ynh_print_OFF; ynh_replace_special_string "__PASSWD__" "$password" "$final_path/credentials.json"; ynh_print_ON
|
||||
if [ "$export" = "abiword" ]
|
||||
then
|
||||
abiword_path=`which abiword` # Get abiword binary path
|
||||
ynh_replace_string "\"abiword\" : null" "\"abiword\" : \"$abiword_path\"" "$final_path/settings.json" # Renseigne l'emplacement de abiword dans la config de etherpad
|
||||
# Get abiword binary path
|
||||
abiword_path=`which abiword`
|
||||
# Set the path of abiword into etherpad config
|
||||
ynh_replace_string "\"abiword\" : null" "\"abiword\" : \"$abiword_path\"" "$final_path/settings.json"
|
||||
elif [ "$export" = "libreoffice" ]
|
||||
then
|
||||
soffice_path=`which soffice` # Get soffice binary path
|
||||
ynh_replace_string "\"soffice\" : null" "\"soffice\" : \"$soffice_path\"" "$final_path/settings.json" # Renseigne l'emplacement de abiword dans la config de etherpad
|
||||
# Get soffice binary path
|
||||
soffice_path=`which soffice`
|
||||
# Set the path of soffice into etherpad config
|
||||
ynh_replace_string "\"soffice\" : null" "\"soffice\" : \"$soffice_path\"" "$final_path/settings.json"
|
||||
fi
|
||||
if test -z $language; then
|
||||
language=en # If upgrading from a version which doesn't support translations, set language to English by default
|
||||
# If upgrading from a version which doesn't support translations, set language to English by default
|
||||
language=en
|
||||
ynh_app_setting_set $app language $language
|
||||
fi
|
||||
ynh_replace_string "__LANGUAGE__" "$language" "$final_path/settings.json"
|
||||
|
@ -214,15 +231,18 @@ then
|
|||
ynh_replace_string "//noldap" "" "$final_path/settings.json"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum "$final_path/settings.json" # Recalculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$final_path/credentials.json" # Recalculate and store the config file checksum into the app settings
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "$final_path/settings.json"
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "$final_path/credentials.json"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_create $app $final_path # Create the dedicated user, if it doesn't exist
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# SECURING FILES AND DIRECTORIES
|
||||
|
@ -230,19 +250,22 @@ ynh_system_user_create $app $final_path # Create the dedicated user, if it doesn
|
|||
|
||||
# Set files ownership to etherpad
|
||||
chown -R $app: $final_path
|
||||
chmod 600 "$final_path/credentials.json" # Restrict access to credentials.json
|
||||
chmod 600 "$final_path/credentials.json"
|
||||
# Restrict access to credentials.json
|
||||
chown $app -R /var/log/$app/etherpad.log
|
||||
|
||||
#=================================================
|
||||
# UPGRADE FAIL2BAN
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
|
@ -250,6 +273,7 @@ ynh_use_logrotate --non-append
|
|||
#=================================================
|
||||
|
||||
ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
|
@ -258,8 +282,10 @@ ynh_add_systemd_config
|
|||
|
||||
if [ $mypads -eq 1 ]
|
||||
then
|
||||
mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "</div>" | cut -d '-' -f 1) # Recherche le /div situé sous le champs d'ouverture de pad.
|
||||
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 # Pour ajouter un lien vers le plugin mypads depuis la page d'Etherpad.
|
||||
# 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
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -270,7 +296,8 @@ fi
|
|||
if [ $is_public -eq 1 ]; then
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
else
|
||||
ynh_app_setting_set $app skipped_uris "/admin" # etherpad admin page doesn't support SSO...
|
||||
# etherpad admin page doesn't support SSO...
|
||||
ynh_app_setting_set $app skipped_uris "/admin"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue