mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
More madness cleanup ... the whole thing about config panel is unmainained, trash it, simplify everything
This commit is contained in:
parent
f1c517ef34
commit
3e5cd682e4
7 changed files with 15 additions and 500 deletions
|
@ -1,84 +0,0 @@
|
|||
version = "1.0"
|
||||
|
||||
[main]
|
||||
name = "Etherpad configuration"
|
||||
|
||||
|
||||
[main.export]
|
||||
name = "Export"
|
||||
|
||||
[main.export.export]
|
||||
ask = "Use AbiWord (~260 Mo) or LibreOffice (~400 Mo) (more stable) to expand export possibilities (PDF, doc)?"
|
||||
choices = ["none", "abiword", "libreoffice"]
|
||||
default = "none"
|
||||
|
||||
|
||||
[main.pad_configuration]
|
||||
name = "Default pad configuration"
|
||||
|
||||
[main.pad_configuration.pad_config_nocolors]
|
||||
ask = "Hide authorship colors?"
|
||||
type = "boolean"
|
||||
default = false
|
||||
|
||||
[main.pad_configuration.pad_config_showlinenumbers]
|
||||
ask = "Show line numbers?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
|
||||
[main.pad_configuration.pad_config_chatandusers]
|
||||
ask = "Show chat and users?"
|
||||
type = "boolean"
|
||||
default = false
|
||||
|
||||
[main.pad_configuration.pad_config_alwaysshowchat]
|
||||
ask = "Always show chat?"
|
||||
type = "boolean"
|
||||
default = false
|
||||
|
||||
[main.pad_configuration.pad_config_show_markdown]
|
||||
ask = "Show markdown syntax?"
|
||||
type = "boolean"
|
||||
default = false
|
||||
|
||||
|
||||
[main.mypads_configuration]
|
||||
name = "MyPads configuration"
|
||||
|
||||
[main.mypads_configuration.mypads]
|
||||
ask = "Enable MyPads plugin?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
|
||||
[main.mypads_configuration.useldap]
|
||||
ask = "Use LDAP with MyPads?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
|
||||
|
||||
[main.overwrite_files]
|
||||
name = "Overwriting config files during an upgrade"
|
||||
|
||||
[main.overwrite_files.overwrite_settings]
|
||||
ask = "Overwrite the config file settings.json?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "If the file is overwritten, a backup will be created."
|
||||
|
||||
[main.overwrite_files.overwrite_credentials]
|
||||
ask = "Overwrite the config file credentials.json?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "If the file is overwritten, a backup will be created."
|
||||
|
||||
[main.overwrite_files.overwrite_nginx]
|
||||
ask = "Overwrite the NGINX config file?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "If the file is overwritten, a backup will be created."
|
||||
|
||||
[main.overwrite_files.overwrite_systemd]
|
||||
ask = "Overwrite the systemd config file?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "If the file is overwritten, a backup will be created."
|
|
@ -33,14 +33,6 @@ ep_font_size_version=0.4.44
|
|||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_ON () {
|
||||
# Load value of $path and $domain from the config if their not set
|
||||
if [ -z $path ]; then
|
||||
path=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
|
||||
mkdir -p /var/www/html/
|
||||
|
||||
# Create an html to serve as maintenance notice
|
||||
|
@ -89,14 +81,6 @@ include conf.d/yunohost_panel.conf.inc;
|
|||
}
|
||||
|
||||
ynh_maintenance_mode_OFF () {
|
||||
# Load value of $path and $domain from the config if their not set
|
||||
if [ -z $path ]; then
|
||||
path=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
|
||||
# Rewrite the nginx config file to redirect from ${path}_maintenance to the real url of the app.
|
||||
echo "rewrite ^${path}_maintenance/(.*)$ ${path}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
systemctl reload nginx
|
||||
|
|
264
scripts/config
264
scripts/config
|
@ -1,264 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Load common variables for all scripts.
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC CODE
|
||||
#=================================================
|
||||
# DECLARE GENERIC FUNCTION
|
||||
#=================================================
|
||||
|
||||
config_file="$final_path/settings.json"
|
||||
|
||||
get_config_value() {
|
||||
option_name="$1"
|
||||
# Get the value of this option in the config file
|
||||
grep "^ *\"$option_name\" *:" "$config_file" | cut -d':' -f2 | sed s'/[ \"]//g' | cut -d',' -f1
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# LOAD VALUES
|
||||
#=================================================
|
||||
|
||||
# Load the real value from the app config or elsewhere.
|
||||
# Then get the value from the form.
|
||||
# If the form has a value for a variable, take the value from the form,
|
||||
# Otherwise, keep the value from the app config.
|
||||
|
||||
# Export
|
||||
old_export="$(ynh_app_setting_get $app export)"
|
||||
export="${YNH_CONFIG_MAIN_EXPORT_EXPORT:-$old_export}"
|
||||
|
||||
# padOptions noColors
|
||||
old_pad_config_nocolors="$(get_config_value noColors)"
|
||||
pad_config_nocolors="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_NOCOLORS:-$old_pad_config_nocolors}"
|
||||
|
||||
# padOptions showLineNumbers
|
||||
old_pad_config_showlinenumbers="$(get_config_value showLineNumbers)"
|
||||
pad_config_showlinenumbers="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOWLINENUMBERS:-$old_pad_config_showlinenumbers}"
|
||||
|
||||
# padOptions chatAndUsers
|
||||
old_pad_config_chatandusers="$(get_config_value chatAndUsers)"
|
||||
pad_config_chatandusers="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_CHATANDUSERS:-$old_pad_config_chatandusers}"
|
||||
|
||||
# padOptions alwaysShowChat
|
||||
old_pad_config_alwaysshowchat="$(get_config_value alwaysShowChat)"
|
||||
pad_config_alwaysshowchat="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_ALWAYSSHOWCHAT:-$old_pad_config_alwaysshowchat}"
|
||||
|
||||
# Plugin option ep_markdown_default
|
||||
old_pad_config_show_markdown="$(get_config_value ep_markdown_default)"
|
||||
pad_config_show_markdown="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOW_MARKDOWN:-$old_pad_config_show_markdown}"
|
||||
|
||||
# MyPads
|
||||
if [ -d $final_path/node_modules/ep_mypads ]
|
||||
then
|
||||
# Enable
|
||||
old_mypads=1
|
||||
else
|
||||
# Disable
|
||||
old_mypads=0
|
||||
fi
|
||||
mypads="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS:-$old_mypads}"
|
||||
|
||||
# LDAP for MyPads
|
||||
if grep -q "//noldap" $config_file
|
||||
then
|
||||
# Disable
|
||||
old_useldap=0
|
||||
else
|
||||
# Enable
|
||||
old_useldap=1
|
||||
fi
|
||||
useldap="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP:-$old_useldap}"
|
||||
|
||||
# Overwrite settings.json file
|
||||
old_overwrite_settings="$(ynh_app_setting_get --app=$app --key=overwrite_settings)"
|
||||
overwrite_settings="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS:-$old_overwrite_settings}"
|
||||
|
||||
# Overwrite credentials.json file
|
||||
old_overwrite_credentials="$(ynh_app_setting_get --app=$app --key=overwrite_credentials)"
|
||||
overwrite_credentials="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_CREDENTIALS:-$old_overwrite_credentials}"
|
||||
|
||||
# Overwrite nginx configuration
|
||||
old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
|
||||
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
|
||||
|
||||
# Overwrite systemd configuration
|
||||
old_overwrite_systemd="$(ynh_app_setting_get --app=$app --key=overwrite_systemd)"
|
||||
overwrite_systemd="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SYSTEMD:-$old_overwrite_systemd}"
|
||||
|
||||
#=================================================
|
||||
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
|
||||
#=================================================
|
||||
|
||||
show_config() {
|
||||
# here you are supposed to read some config file/database/other then print the values
|
||||
# ynh_return "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value"
|
||||
|
||||
ynh_return "YNH_CONFIG_MAIN_EXPORT_EXPORT=$export"
|
||||
|
||||
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_NOCOLORS=$pad_config_nocolors"
|
||||
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOWLINENUMBERS=$pad_config_showlinenumbers"
|
||||
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_CHATANDUSERS=$pad_config_chatandusers"
|
||||
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_ALWAYSSHOWCHAT=$pad_config_alwaysshowchat"
|
||||
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOW_MARKDOWN=$pad_config_show_markdown"
|
||||
ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS=$mypads"
|
||||
ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP=$useldap"
|
||||
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS=$overwrite_settings"
|
||||
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_CREDENTIALS=$overwrite_credentials"
|
||||
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX=$overwrite_nginx"
|
||||
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SYSTEMD=$overwrite_systemd"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# MODIFY THE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
apply_config() {
|
||||
|
||||
#=================================================
|
||||
# MODIFY ETHERPAD CONFIG
|
||||
#=================================================
|
||||
|
||||
restart_etherpad=0
|
||||
|
||||
# Change configuration if needed
|
||||
# padOptions noColors
|
||||
if [ "$pad_config_nocolors" != "$old_pad_config_nocolors" ]
|
||||
then
|
||||
ynh_replace_string --match_string="\(\"noColors\" *: \).*," --replace_string="\1$pad_config_nocolors," --target_file="$config_file"
|
||||
ynh_app_setting_set --app=$app --key=pad_config_nocolors --value="$pad_config_nocolors"
|
||||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# padOptions showLineNumbers
|
||||
if [ "$pad_config_showlinenumbers" != "$old_pad_config_showlinenumbers" ]
|
||||
then
|
||||
ynh_replace_string --match_string="\(\"showLineNumbers\" *: \).*," --replace_string="\1$pad_config_showlinenumbers," --target_file="$config_file"
|
||||
ynh_app_setting_set --app=$app --key=pad_config_showlinenumbers --value="$pad_config_showlinenumbers"
|
||||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# padOptions chatAndUsers
|
||||
if [ "$pad_config_chatandusers" != "$old_pad_config_chatandusers" ]
|
||||
then
|
||||
ynh_replace_string --match_string="\(\"chatAndUsers\" *: \).*," --replace_string="\1$pad_config_chatandusers," --target_file="$config_file"
|
||||
ynh_app_setting_set --app=$app --key=pad_config_chatandusers --value="$pad_config_chatandusers"
|
||||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# padOptions alwaysShowChat
|
||||
if [ "$pad_config_alwaysshowchat" != "$old_pad_config_alwaysshowchat" ]
|
||||
then
|
||||
ynh_replace_string --match_string="\(\"alwaysShowChat\" *: \).*," --replace_string="\1$pad_config_alwaysshowchat," --target_file="$config_file"
|
||||
ynh_app_setting_set --app=$app --key=pad_config_alwaysshowchat --value="$pad_config_alwaysshowchat"
|
||||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# Plugin option ep_markdown_default
|
||||
if [ "$pad_config_show_markdown" != "$old_pad_config_show_markdown" ]
|
||||
then
|
||||
ynh_replace_string --match_string="\(\"ep_markdown_default\" *: \).*," --replace_string="\1$pad_config_show_markdown," --target_file="$config_file"
|
||||
ynh_app_setting_set --app=$app --key=pad_config_show_markdown --value="$pad_config_show_markdown"
|
||||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# Export
|
||||
if [ "$export" != "$old_export" ]
|
||||
then
|
||||
if [ "$export" = "abiword" ]
|
||||
then
|
||||
# if Abiword isn't installed, call the action add_remove_abiword.
|
||||
if ! which abiword > /dev/null
|
||||
then
|
||||
yunohost app action run $app add_remove_abiword
|
||||
fi
|
||||
ynh_replace_string --match_string="\(\"abiword\" *: \).*," --replace_string="\1\"$(which abiword)\"," --target_file="$config_file"
|
||||
ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1null," --target_file="$config_file"
|
||||
elif [ "$export" = "libreoffice" ]
|
||||
then
|
||||
# if LibreOffice isn't installed, call the action add_remove_libreoffice.
|
||||
if ! which soffice > /dev/null
|
||||
then
|
||||
yunohost app action run $app add_remove_libreoffice
|
||||
fi
|
||||
ynh_replace_string --match_string="\(\"abiword\" *: \).*," --replace_string="\1null," --target_file="$config_file"
|
||||
ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1\"$(which soffice)\"," --target_file="$config_file"
|
||||
else
|
||||
ynh_replace_string --match_string="\(\"abiword\" *: \).*," --replace_string="\1null," --target_file="$config_file"
|
||||
ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1null," --target_file="$config_file"
|
||||
fi
|
||||
|
||||
ynh_app_setting_set --app=$app --key=export --value="$export"
|
||||
|
||||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# MyPads
|
||||
if [ "$mypads" != "$old_mypads" ]
|
||||
then
|
||||
ynh_use_nodejs
|
||||
#pushd "$final_path/src"
|
||||
#ynh_secure_remove --file="$final_path/src/package-lock.json" #added to fix saveError ENOENT: no such file or directory
|
||||
if [ "$mypads" = "1" ]
|
||||
then
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" npm install ep_mypads@${mypads_version}
|
||||
else
|
||||
ynh_exec_as $app env "$ynh_node_load_PATH" npm uninstall ep_mypads
|
||||
fi
|
||||
popd
|
||||
chown -R $app: $final_path/node_modules
|
||||
|
||||
ynh_app_setting_set --app=$app --key=mypads --value="$mypads"
|
||||
|
||||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
# LDAP for MyPads
|
||||
if [ "$useldap" != "$old_useldap" ]
|
||||
then
|
||||
if [ "$useldap" = "1" ]
|
||||
then
|
||||
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$final_path/settings.json"
|
||||
else
|
||||
ynh_replace_string --match_string="\(.*\) //useldap" --replace_string="//noldap\1" --target_file="$final_path/settings.json"
|
||||
fi
|
||||
|
||||
ynh_app_setting_set --app=$app --key=useldap --value="$useldap"
|
||||
|
||||
restart_etherpad=1
|
||||
fi
|
||||
|
||||
|
||||
if [ $restart_etherpad -eq 1 ]
|
||||
then
|
||||
# Wait for etherpad to be fully started
|
||||
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# MODIFY OVERWRITTING SETTINGS
|
||||
#=================================================
|
||||
|
||||
# Set overwrite_settings
|
||||
ynh_app_setting_set --app=$app --key=overwrite_settings --value="$overwrite_settings"
|
||||
# Set overwrite_credentials
|
||||
ynh_app_setting_set --app=$app --key=overwrite_credentials --value="$overwrite_credentials"
|
||||
# Set overwrite_nginx
|
||||
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
|
||||
# Set overwrite_systemd
|
||||
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="$overwrite_systemd"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
ynh_app_config_run $1
|
|
@ -1,29 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||
sleep 60
|
||||
sleep 10
|
||||
fi
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
password="$YNH_APP_ARG_PASSWORD"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=overwrite_settings --value="1"
|
||||
ynh_app_setting_set --app=$app --key=overwrite_credentials --value="1"
|
||||
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1"
|
||||
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="1"
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
|
|
@ -9,13 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=3
|
||||
|
||||
export=$(ynh_app_setting_get --app=$app --key=export)
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
|
|
|
@ -1,26 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=3
|
||||
|
||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=2
|
||||
#
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=5
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
|
@ -38,11 +25,7 @@ chown $app:$app "$install_dir/credentials.json"
|
|||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..."
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_use_nodejs
|
||||
|
@ -60,10 +43,14 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|||
|
||||
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/etherpad.log"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=2
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=5
|
||||
|
||||
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
@ -73,7 +60,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
|
|||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
|
||||
|
||||
|
|
|
@ -1,44 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=20
|
||||
|
||||
export=$(ynh_app_setting_get --app=$app --key=export)
|
||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
|
||||
useldap=$(ynh_app_setting_get --app=$app --key=useldap)
|
||||
abiword=$(ynh_app_setting_get --app=$app --key=abiword)
|
||||
overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
|
||||
overwrite_credentials=$(ynh_app_setting_get --app=$app --key=overwrite_credentials)
|
||||
overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
|
||||
overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
|
||||
|
||||
# Optional parameters from config-panel feature
|
||||
pad_config_nocolors=$(ynh_app_setting_get --app=$app --key=pad_config_nocolors)
|
||||
pad_config_showlinenumbers=$(ynh_app_setting_get --app=$app --key=pad_config_showlinenumbers)
|
||||
pad_config_chatandusers=$(ynh_app_setting_get --app=$app --key=pad_config_chatandusers)
|
||||
pad_config_alwaysshowchat=$(ynh_app_setting_get --app=$app --key=pad_config_alwaysshowchat)
|
||||
pad_config_show_markdown=$(ynh_app_setting_get --app=$app --key=pad_config_show_markdown)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..." --weight=1
|
||||
|
||||
# Wait for etherpad to be fully started
|
||||
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
|
@ -46,6 +10,9 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Activating maintenance mode..." --weight=2
|
||||
|
||||
# Wait for etherpad to be fully started # (... but why ???)
|
||||
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
|
||||
|
||||
ynh_maintenance_mode_ON
|
||||
|
||||
#=================================================
|
||||
|
@ -62,75 +29,32 @@ ynh_systemd_action --service_name=$app --action="stop"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
|
||||
|
||||
# If abiword setting doesn't exist
|
||||
if [ -z "${abiword:-}" ]; then
|
||||
abiword=0
|
||||
ynh_app_setting_set --app=$app --key=abiword --value=$abiword
|
||||
fi
|
||||
|
||||
# If abiword setting exists
|
||||
if [ -n "${abiword:-}" ]; then
|
||||
if [ $abiword -eq 1 ]; then
|
||||
export=abiword
|
||||
fi
|
||||
ynh_app_setting_set --app=$app --key=export --value=$export
|
||||
ynh_app_setting_delete --app=$app --key=abiword
|
||||
fi
|
||||
|
||||
if [ -z "${language:-}" ]; then
|
||||
# If upgrading from a version which doesn't support translations, set language to English by default
|
||||
language=en
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
fi
|
||||
|
||||
# If export setting doesn't exist
|
||||
if [ -z "${export:-}" ]; then
|
||||
export=none
|
||||
ynh_app_setting_set --app=$app --key=export --value=$export
|
||||
fi
|
||||
|
||||
# If mypads setting doesn't exist
|
||||
if [ -z "${mypads:-}" ]; then
|
||||
mypads=1
|
||||
ynh_app_setting_set --app=$app --key=mypads --value=$mypads
|
||||
fi
|
||||
|
||||
# If useldap setting doesn't exist
|
||||
if [ -z "${useldap:-}" ]; then
|
||||
useldap=0
|
||||
ynh_app_setting_set --app=$app --key=useldap --value=$useldap
|
||||
fi
|
||||
|
||||
# If path setting doesn't exist
|
||||
if [ -z "${path:-}" ]; then
|
||||
path="/"
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path
|
||||
fi
|
||||
|
||||
# If overwrite_settings doesn't exist, create it
|
||||
if [ -z "${overwrite_settings:-}" ]; then
|
||||
overwrite_settings=1
|
||||
ynh_app_setting_set --app=$app --key=overwrite_settings --value=$overwrite_settings
|
||||
fi
|
||||
|
||||
# If overwrite_credentials doesn't exist, create it
|
||||
if [ -z "${overwrite_credentials:-}" ]; then
|
||||
overwrite_credentials=1
|
||||
ynh_app_setting_set --app=$app --key=overwrite_credentials --value=$overwrite_credentials
|
||||
fi
|
||||
|
||||
# If overwrite_nginx doesn't exist, create it
|
||||
if [ -z "${overwrite_nginx:-}" ]; then
|
||||
overwrite_nginx=1
|
||||
ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx
|
||||
fi
|
||||
|
||||
# If overwrite_systemd doesn't exist, create it
|
||||
if [ -z "${overwrite_systemd:-}" ]; then
|
||||
overwrite_systemd=1
|
||||
ynh_app_setting_set --app=$app --key=overwrite_systemd --value=$overwrite_systemd
|
||||
fi
|
||||
|
||||
# Support full Unicode in MySQL databases
|
||||
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
|
||||
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
|
@ -163,11 +87,7 @@ ynh_use_nodejs
|
|||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||
|
||||
# Overwrite the NGINX configuration only if it's allowed
|
||||
if [ $overwrite_nginx -eq 1 ]
|
||||
then
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -219,11 +139,7 @@ chown $app:$app "$install_dir/credentials.json"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
|
||||
|
||||
# Create a dedicated systemd config
|
||||
if [ $overwrite_systemd -eq 1 ]
|
||||
then
|
||||
ynh_add_systemd_config
|
||||
fi
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# INSTALL ETHERPAD'S PLUGINS
|
||||
|
|
Loading…
Add table
Reference in a new issue