[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot
2024-08-30 22:57:28 +02:00
committed by Josué Tille
parent 9e748220af
commit a9647ffbf1
8 changed files with 116 additions and 144 deletions

View File

@ -11,21 +11,21 @@ source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app files..." --weight=1
ynh_restore
ynh_script_progression "Restoring the app files..."
ynh_restore_everything
_set_permissions
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_script_progression "Restoring the MySQL database..."
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
ynh_mysql_db_shell < ./db.sql
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_script_progression "Restoring system configurations related to $app..."
systemctl daemon-reload
systemctl enable "$app".service --quiet
@ -33,23 +33,21 @@ systemctl enable "$app".service --quiet
yunohost service add "$app" --log="/var/log/$app/gitea.log"
# SETUP FAIL2BAN
ynh_script_progression --message="Configuring fail2ban..."
ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from <HOST>" --max_retry=5
ynh_script_progression "Configuring fail2ban..."
ynh_config_add_fail2ban --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from <HOST>"
#=================================================
# GENERIC FINALIZATION
#=================================================
# 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 "Reloading NGINX web server and $app's service..."
# Typically you only have either $app or php-fpm but not both at the same time...
ynh_systemd_action --service_name="$app" --action=start --log_path="/var/log/$app/gitea.log" --line_match="$systemd_match_start_line"
ynh_systemctl --service="$app" --action=start --log_path="/var/log/$app/gitea.log" --wait_until="$systemd_match_start_line"
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression "Restoration completed for $app"