From 011fc2a6c1254bcf7af122f9d0c01659317d691d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 28 Oct 2022 10:59:40 +0200 Subject: [PATCH] Fix typos and follow example_ynh template --- scripts/backup | 14 +++++--------- scripts/change_url | 6 +++--- scripts/install | 12 ++++++------ scripts/remove | 4 ++-- scripts/restore | 8 ++++---- scripts/upgrade | 10 +++++----- 6 files changed, 25 insertions(+), 29 deletions(-) diff --git a/scripts/backup b/scripts/backup index ae7c557..775dbab 100644 --- a/scripts/backup +++ b/scripts/backup @@ -45,12 +45,16 @@ upstream_version=$(ynh_app_upstream_version) final_www_path="/var/www/$app" data_path="/home/yunohost.app/matrix-$app" +#================================================= +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # STANDARD BACKUP STEPS #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_www_path" @@ -58,7 +62,6 @@ ynh_backup --src_path="$final_www_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Backing up nginx web server configuration..." # BACKUP THE PHP-FPM CONFIGURATION ynh_backup --src_path "/etc/php/$phpversion/fpm/pool.d/$app.conf" @@ -72,14 +75,12 @@ fi #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Backing up the PostgreSQL database..." ynh_psql_dump_db --database="$synapse_db_name" > ${YNH_CWD}/dump.sql #================================================= # BACKUP FAIL2BAN CONFIGURATION #================================================= -ynh_print_info --message="Backing up fail2ban configuration" ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" @@ -89,14 +90,12 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" #================================================= # BACKUP SYNAPSE CONFIG #================================================= -ynh_print_info --message="Backing up synapse configuration..." ynh_backup --src_path="/etc/matrix-$app" #================================================= # BACKUP SYSTEMD #================================================= -ynh_print_info --message="Backing up systemd configuration..." ynh_backup --src_path="/etc/default/matrix-$app" ynh_backup --src_path="/etc/systemd/system/matrix-$app.service" @@ -106,21 +105,18 @@ ynh_backup --src_path="/etc/systemd/system/coturn-$app.service" #================================================= # BACKUP SYNAPSE DATA #================================================= -ynh_print_info --message="Backing up synapse data..." ynh_backup --src_path="$data_path" --is_big=1 #================================================= # BACKUP SYNAPSE LOG #================================================= -ynh_print_info --message="Backing up synapse log..." ynh_backup --src_path="/var/log/matrix-$app" --is_big=1 #================================================= # BACKUP HOOKS #================================================= -ynh_print_info --message="Backing up synapse hook..." # Copy hook ynh_backup --src_path "/etc/yunohost/hooks.d/post_cert_update/50-$app" diff --git a/scripts/change_url b/scripts/change_url index ad84c40..8759e1e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -67,7 +67,7 @@ ynh_systemd_action --service_name=matrix-$app.service --action=stop # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Updating nginx configuration..." +ynh_script_progression --message="Updating NGINX configuration..." # MODIFY URL IN NGINX CONF nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -89,7 +89,7 @@ fi # UPDATE SYNAPSE CONFIG #================================================= -ynh_script_progression --message="Updating synapse config..." --weight=2 +ynh_script_progression --message="Updating Synapse config..." --weight=2 # WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times) # For any update do it in all files @@ -127,7 +127,7 @@ chmod u=rwX,g=rX,o= -R /etc/matrix-$app #================================================= # RELOAD SERVICES #================================================= -ynh_script_progression --message="Restarting synapse services..." --weight=5 +ynh_script_progression --message="Restarting Synapse services..." --weight=5 ynh_systemd_action --service_name=coturn-$app.service --action=restart ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 diff --git a/scripts/install b/scripts/install index d31d760..f620003 100644 --- a/scripts/install +++ b/scripts/install @@ -197,7 +197,7 @@ chown $synapse_user:root -R $final_www_path # CREATE SYNAPSE CONFIG #================================================= -ynh_script_progression --message="Creating synapse config..." --weight=3 +ynh_script_progression --message="Creating Synapse config..." --weight=3 # Go in virtualenvironnement set +u; @@ -237,7 +237,7 @@ ynh_add_systemd_config --service=coturn-$app --template=coturn-synapse.service #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=2 +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated php-fpm config ynh_script_progression --message="Configuring application..." @@ -255,7 +255,7 @@ ynh_add_nginx_config app #================================================= # SET SYNAPSE CONFIG #================================================= -ynh_script_progression --message="Configuring synapse..." --weight=2 +ynh_script_progression --message="Configuring Synapse..." --weight=2 # Find password for turnserver and database turnserver_pwd=$(ynh_string_random --length=30) @@ -283,7 +283,7 @@ ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml" #================================================= # SET COTURN CONFIG #================================================= -ynh_script_progression --message="Configuring coturn..." --weight=1 +ynh_script_progression --message="Configuring Coturn..." --weight=1 # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files @@ -381,7 +381,7 @@ yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port #================================================= # RELOAD SERVICES #================================================= -ynh_script_progression --message="Restarting synapse services..." --weight=11 +ynh_script_progression --message="Restarting Synapse services..." --weight=11 ynh_systemd_action --service_name=coturn-$app.service --action=restart ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 @@ -389,7 +389,7 @@ ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Syn #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Configuring fail2ban..." --weight=10 +ynh_script_progression --message="Configuring Fail2Ban..." --weight=10 # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files diff --git a/scripts/remove b/scripts/remove index 7452c0c..fa86c1a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -93,7 +93,7 @@ ynh_secure_remove --file=/etc/nginx/conf.d/${server_name}.d/${app}_server_name.c #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration" --weight=2 +ynh_script_progression --message="Removing NGINX web server configuration" --weight=2 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -129,7 +129,7 @@ closeport $turnserver_alt_tls_port #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing fail2ban configuration..." --weight=8 +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8 # Remove the dedicated fail2ban config ynh_remove_fail2ban_config diff --git a/scripts/restore b/scripts/restore index 481c0bf..a393098 100644 --- a/scripts/restore +++ b/scripts/restore @@ -101,7 +101,7 @@ install_sources # RESTORE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Reload fail2ban..." --weight=6 +ynh_script_progression --message="Reload Fail2Ban..." --weight=6 ynh_systemd_action --action=restart --service_name=fail2ban #================================================= @@ -155,7 +155,7 @@ fi #================================================= # RECONFIGURE THE TURNSERVER #================================================= -ynh_script_progression --message="Reconfiguring coturn..." --weight=23 +ynh_script_progression --message="Reconfiguring Coturn..." --weight=23 # To be sure that at the restoration the IP address in coturn config is the same as the real address we remake the coturn config @@ -227,7 +227,7 @@ chown $synapse_user:root -R $final_www_path #================================================= # RELOAD NGINX, SYNAPSE AND COTURN #================================================= -ynh_script_progression --message="Restarting synapse services..." --weight=7 +ynh_script_progression --message="Restarting Synapse services..." --weight=7 ynh_systemd_action --service_name=coturn-$app.service --action=restart ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300 @@ -256,7 +256,7 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --type="restore" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index ac2f4d6..e108011 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -318,7 +318,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 # Create a dedicated php-fpm config ynh_script_progression --message="Configuring application..." @@ -330,7 +330,7 @@ then ynh_add_config --template="server_name.conf" --destination="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf" fi -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config app #================================================= @@ -338,7 +338,7 @@ ynh_add_nginx_config app #================================================= # UPDATE COTURN CONFIG #================================================= -ynh_script_progression --message="Updating coturn config..." --weight=1 +ynh_script_progression --message="Updating Coturn config..." --weight=1 # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files @@ -397,7 +397,7 @@ ynh_add_systemd_config --service=coturn-$app --template=coturn-synapse.service #================================================= # UPGRADE FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring fail2ban..." --weight=8 +ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8 # WARNING : theses command are used in INSTALL, UPGRADE # For any update do it in all files @@ -480,7 +480,7 @@ ynh_app_setting_set --app=$app --key=synapse_version --value=$upstream_version #================================================= # RELOAD SERVICES #================================================= -ynh_script_progression --message="Restarting synapse services..." --weight=5 +ynh_script_progression --message="Restarting Synapse services..." --weight=5 ynh_systemd_action --service_name=coturn-$app.service --action=restart ynh_systemd_action --service_name=matrix-$app --action=restart --line_match="Synapse now listening on TCP port $synapse_tls_port" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300