1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/leed_ynh.git synced 2024-09-03 19:26:32 +02:00

Merge pull request #18 from YunoHost-Apps/testing

Normalization from example_ynh
This commit is contained in:
Maniack Crudelis 2019-03-12 20:51:53 +01:00 committed by GitHub
commit 9daea0a849
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 97 additions and 80 deletions

View file

@ -22,17 +22,7 @@
port_already_use=0 port_already_use=0
change_url=1 change_url=1
;;; Levels ;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4: https://github.com/LeedRSS/Leed/commit/841719a25e3753b0c50275bed62c29a55aa21bb9
Level 4=1
Level 5=auto Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email= Email=
Notification=down Notification=down

View file

@ -1,10 +1,16 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
# Path to source
alias __FINALPATH__/ ; alias __FINALPATH__/ ;
# Force usage of https
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
index index.php; index index.php;
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;

View file

@ -6,7 +6,7 @@
"en": "Leed is a minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds.", "en": "Leed is a minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds.",
"fr": "Leed est un agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive." "fr": "Leed est un agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive."
}, },
"version": "1.8.3~ynh6", "version": "1.8.3~ynh7",
"url": "http://leed.idleman.fr/", "url": "http://leed.idleman.fr/",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"maintainer": { "maintainer": {
@ -63,6 +63,7 @@
}, },
{ {
"name": "language", "name": "language",
"type": "string",
"ask": { "ask": {
"en": "Choose your agregator's language", "en": "Choose your agregator's language",
"fr": "Choisissez la langue de votre agrégateur" "fr": "Choisissez la langue de votre agrégateur"

23
pull_request_template.md Normal file
View file

@ -0,0 +1,23 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Validation
---
- [ ] **Code review**
- [ ] **Approval (LGTM)**
*Code review and approval have to be from a member of @YunoHost/apps group*
- **CI succeeded** :
[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/leed_ynh%20-BRANCH-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/leed_ynh%20-BRANCH-/)
*Please replace '-BRANCH-' in this link by the name of the branch used.*
*If the PR is from a forked repository. Please provide public results from package_check.*
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
#================================================= #=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
# Get is_public # Get is_public
is_public=${YNH_ACTION_IS_PUBLIC} is_public=${YNH_ACTION_IS_PUBLIC}
@ -44,7 +43,7 @@ if [ $is_public -eq 0 ]; then
else else
public_private="public" public_private="public"
fi fi
ynh_script_progression --message="Move the application to $public_private" --weight=3 ynh_script_progression --message="Moving the application to $public_private..." --weight=3
if [ $is_public -eq 0 ] if [ $is_public -eq 0 ]
then then
@ -56,7 +55,7 @@ else
ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set $app unprotected_uris "/"
fi fi
ynh_script_progression --message="Reconfigure SSOwat" ynh_script_progression --message="Reconfiguring SSOwat..."
# Regen ssowat configuration # Regen ssowat configuration
yunohost app ssowatconf yunohost app ssowatconf
@ -66,7 +65,7 @@ ynh_app_setting_set $app is_public $is_public
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reload nginx" ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --action=reload --service_name=nginx ynh_systemd_action --action=reload --service_name=nginx

View file

@ -19,21 +19,20 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=2 ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get $app db_name)
db_pwd=$(ynh_app_setting_get "$app" mysqlpwd)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backup the app main dir" ynh_script_progression --message="Backing up the main app directory..."
CHECK_SIZE "$final_path" CHECK_SIZE "$final_path"
ynh_backup "$final_path" ynh_backup "$final_path"
@ -41,21 +40,21 @@ ynh_backup "$final_path"
#================================================= #=================================================
# BACKUP NGINX CONFIGURATION # BACKUP NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backup nginx configuration" ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP PHP-FPM CONFIGURATION # BACKUP PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backup php-fpm configuration" ynh_script_progression --message="Backing up php-fpm configuration..."
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Backup the mysql database" --weight=2 ynh_script_progression --message="Backing up the MySQL database..." --weight=2
ynh_mysql_dump_db "$db_name" > db.sql ynh_mysql_dump_db "$db_name" > db.sql
CHECK_SIZE "db.sql" CHECK_SIZE "db.sql"
@ -63,7 +62,7 @@ CHECK_SIZE "db.sql"
#================================================= #=================================================
# BACKUP FAIL2BAN CONFIGURATION # BACKUP FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backup fail2ban configuration" ynh_script_progression --message="Backing up fail2ban configuration"
ynh_backup "/etc/fail2ban/jail.d/$app.conf" ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup "/etc/fail2ban/filter.d/$app.conf" ynh_backup "/etc/fail2ban/filter.d/$app.conf"
@ -73,7 +72,7 @@ ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#================================================= #=================================================
# BACKUP THE CRON FILE # BACKUP THE CRON FILE
#================================================= #=================================================
ynh_script_progression --message="Backup cron file" ynh_script_progression --message="Backing up cron file"
ynh_backup "/etc/cron.d/$app" ynh_backup "/etc/cron.d/$app"
@ -81,4 +80,4 @@ ynh_backup "/etc/cron.d/$app"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup completed" --last ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
#================================================= #=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
old_domain=$YNH_APP_OLD_DOMAIN old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH old_path=$YNH_APP_OLD_PATH
@ -25,14 +24,13 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=2 ynh_script_progression --message="Loading installation settings..." --weight=2
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
#================================================= #=================================================
# CHECK THE SYNTAX OF THE PATHS # CHECK THE SYNTAX OF THE PATHS
#================================================= #=================================================
ynh_script_progression --message="Check the syntax of the paths"
test -n "$old_path" || old_path="/" test -n "$old_path" || old_path="/"
test -n "$new_path" || new_path="/" test -n "$new_path" || new_path="/"
@ -42,7 +40,7 @@ old_path=$(ynh_normalize_url_path $old_path)
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Activate maintenance mode" ynh_script_progression --message="Activating maintenance mode..."
path_url=$old_path path_url=$old_path
domain=$old_domain domain=$old_domain
@ -76,7 +74,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Modify url in nginx configuration" --weight=2 ynh_script_progression --message="Updating nginx web server configuration..." --weight=2
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -126,7 +124,7 @@ ynh_replace_string "https://$old_domain${old_path}" "https://$domain_path" "/et
#================================================= #=================================================
# UPDATE THE DATABASE # UPDATE THE DATABASE
#================================================= #=================================================
ynh_script_progression --message="Update the database" ynh_script_progression --message="Updating the database..."
ynh_mysql_execute_as_root "UPDATE leed_configuration SET value='$domain_path/' WHERE value LIKE '%${old_domain}%'" $app ynh_mysql_execute_as_root "UPDATE leed_configuration SET value='$domain_path/' WHERE value LIKE '%${old_domain}%'" $app
@ -135,14 +133,14 @@ ynh_mysql_execute_as_root "UPDATE leed_configuration SET value='$domain_path/' W
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reload nginx" ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --action=reload --service_name=nginx ynh_systemd_action --action=reload --service_name=nginx
#================================================= #=================================================
# DEACTIVE MAINTENANCE MODE # DEACTIVE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Disable maintenance mode" ynh_script_progression --message="Disabling maintenance mode..."
path_url=$old_path path_url=$old_path
domain=$old_domain domain=$old_domain
@ -152,4 +150,4 @@ ynh_maintenance_mode_OFF
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of url completed" --last ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -19,7 +19,6 @@ ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
@ -33,7 +32,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#================================================= #=================================================
ynh_script_progression --message="Check if the app can be installed" --weight=2 ynh_script_progression --message="Validating installation parameters..." --weight=2
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die "This path already contains a folder"
@ -47,7 +46,7 @@ ynh_webpath_register $app $domain $path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Store settings from manifest" --weight=2 ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set $app admin $admin ynh_app_setting_set $app admin $admin
ynh_app_setting_set $app language $language ynh_app_setting_set $app language $language
@ -62,7 +61,7 @@ ynh_app_setting_set $app admin_mail_html "1"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Create a mysql database" ynh_script_progression --message="Creating a MySQL database..."
db_name=$(ynh_sanitize_dbid $app) db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name ynh_app_setting_set $app db_name $db_name
@ -71,7 +70,7 @@ ynh_mysql_setup_db $db_name $db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Download, check and unpack source" --weight=3 ynh_script_progression --message="Setting up source files..." --weight=3
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app final_path $final_path
# Download, check integrity and uncompress the source from app.src # Download, check integrity and uncompress the source from app.src
@ -80,7 +79,7 @@ ynh_setup_source "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configure nginx" --weight=2 ynh_script_progression --message="Configuring nginx web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -88,7 +87,7 @@ ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Create a dedicated user" --weight=2 ynh_script_progression --message="Configuring system user..." --weight=2
# Create a dedicated system user # Create a dedicated system user
ynh_system_user_create $app ynh_system_user_create $app
@ -96,7 +95,7 @@ ynh_system_user_create $app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configure php-fpm" --weight=2 ynh_script_progression --message="Configuring php-fpm..." --weight=2
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config ynh_add_fpm_config
@ -106,7 +105,7 @@ ynh_add_fpm_config
#================================================= #=================================================
# SETTING UP WITH CURL # SETTING UP WITH CURL
#================================================= #=================================================
ynh_script_progression --message="Install Leed with Curl" --weight=5 ynh_script_progression --message="Installing Leed with Curl..." --weight=5
# Set right permissions for curl install # Set right permissions for curl install
chown -R $app: $final_path chown -R $app: $final_path
@ -133,7 +132,7 @@ code_sync=$(mysql -h localhost -u $db_name -p$db_pwd -s $db_name -e 'SELECT valu
#================================================= #=================================================
# SETUP CRON FILE FOR SYNCHRONISATION # SETUP CRON FILE FOR SYNCHRONISATION
#================================================= #=================================================
ynh_script_progression --message="Setup a cron file" ynh_script_progression --message="Setting up a cron file..."
ynh_replace_string "__ADMIN__" "$admin" ../conf/cron_leed ynh_replace_string "__ADMIN__" "$admin" ../conf/cron_leed
ynh_replace_string "__DOMAIN__" "$domain" ../conf/cron_leed ynh_replace_string "__DOMAIN__" "$domain" ../conf/cron_leed
@ -156,7 +155,7 @@ chown -R $app $final_path/cache $final_path/plugins $final_path/updates
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN
#================================================= #=================================================
ynh_script_progression --message="Configure fail2ban" --weight=9 ynh_script_progression --message="Configuring fail2ban..." --weight=9
# Create a dedicated fail2ban config # Create a dedicated fail2ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: <HOST>" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: <HOST>" --max_retry=5
@ -164,7 +163,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Setup SSOwat" --weight=2 ynh_script_progression --message="Configuring SSOwat..." --weight=2
# Make app private if necessary # Make app private if necessary
ynh_app_setting_set $app is_public "$is_public" ynh_app_setting_set $app is_public "$is_public"
@ -179,7 +178,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reload nginx" --weight=3 ynh_script_progression --message="Reloading nginx web server..." --weight=3
ynh_systemd_action --action=reload --service_name=nginx ynh_systemd_action --action=reload --service_name=nginx
@ -205,4 +204,4 @@ ynh_print_ON
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation completed" --last ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,19 +12,20 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=2 ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get $app db_name)
final_path=$(ynh_app_setting_get $app final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # REMOVE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Remove the mysql database" ynh_script_progression --message="Removing the MySQL database..."
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_name $db_name ynh_mysql_remove_db $db_name $db_name
@ -32,15 +33,15 @@ ynh_mysql_remove_db $db_name $db_name
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Remove app main directory" ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "/var/www/$app" ynh_secure_remove "$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Remove nginx configuration" --weight=2 ynh_script_progression --message="Removing nginx web server configuration..." --weight=2
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
@ -48,7 +49,7 @@ ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Remove php-fpm configuration" ynh_script_progression --message="Removing php-fpm configuration..."
# Remove the dedicated php-fpm config # Remove the dedicated php-fpm config
ynh_remove_fpm_config ynh_remove_fpm_config
@ -56,7 +57,7 @@ ynh_remove_fpm_config
#================================================= #=================================================
# REMOVE FAIL2BAN CONFIGURATION # REMOVE FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Remove fail2ban configuration" --weight=5 ynh_script_progression --message="Removing fail2ban configuration..." --weight=5
# Remove the dedicated fail2ban config # Remove the dedicated fail2ban config
ynh_remove_fail2ban_config ynh_remove_fail2ban_config
@ -74,7 +75,7 @@ ynh_secure_remove "/etc/cron.d/$app"
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Remove the dedicated user" --weight=2 ynh_script_progression --message="Removing the dedicated system user..." --weight=2
# Delete dedicated system user # Delete dedicated system user
ynh_system_user_delete $app ynh_system_user_delete $app
@ -83,4 +84,4 @@ ynh_system_user_delete $app
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Deletion completed" --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -19,7 +19,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=2 ynh_script_progression --message="Loading settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -32,6 +32,7 @@ admin=$(ynh_app_setting_get $app admin)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available $domain $path_url \ ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die "Path not available: ${domain}${path_url}"
@ -41,7 +42,7 @@ test ! -d $final_path \
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Activate maintenance mode" --weight=2 ynh_script_progression --message="Activating maintenance mode..." --weight=2
ynh_maintenance_mode_ON ynh_maintenance_mode_ON
@ -56,14 +57,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restore the app main directory" ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file "$final_path" ynh_restore_file "$final_path"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restore the mysql database" --weight=3 ynh_script_progression --message="Restoring the MySQL database..." --weight=3
db_pwd=$(ynh_app_setting_get $app mysqlpwd) db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd ynh_mysql_setup_db $db_name $db_name $db_pwd
@ -72,7 +73,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreate the dedicated user" --weight=2 ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create $app ynh_system_user_create $app
@ -86,7 +87,7 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
#================================================= #=================================================
# RESTORE FAIL2BAN CONFIGURATION # RESTORE FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restore the fail2ban configuration" --weight=7 ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=7
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
@ -111,7 +112,7 @@ chown -R $app $final_path/cache $final_path/plugins $final_path/updates
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reload nginx and php-fpm" ynh_script_progression --message="Reloading nginx web server and php-fpm..."
ynh_systemd_action --action=reload --service_name=php7.0-fpm ynh_systemd_action --action=reload --service_name=php7.0-fpm
ynh_systemd_action --action=reload --service_name=nginx ynh_systemd_action --action=reload --service_name=nginx
@ -119,7 +120,7 @@ ynh_systemd_action --action=reload --service_name=nginx
#================================================= #=================================================
# DEACTIVE MAINTENANCE MODE # DEACTIVE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Disable maintenance mode" --weight=2 ynh_script_progression --message="Disabling maintenance mode..." --weight=2
ynh_maintenance_mode_OFF ynh_maintenance_mode_OFF
@ -141,4 +142,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --ty
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed" --last ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=3 ynh_script_progression --message="Loading installation settings..." --weight=3
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -36,7 +36,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensure downward compatibility" ynh_script_progression --message="Ensuring downward compatibility..."
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z "$final_path" ]; then if [ -z "$final_path" ]; then
@ -92,7 +92,7 @@ fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backup the app before upgrading" --weight=4 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -113,7 +113,7 @@ path_url=$(ynh_normalize_url_path $path_url)
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Activate maintenance mode" ynh_script_progression --message="Activating maintenance mode..."
ynh_maintenance_mode_ON ynh_maintenance_mode_ON
@ -125,7 +125,7 @@ ynh_maintenance_mode_ON
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Download, check and unpack source" --weight=3 ynh_script_progression --message="Upgrading source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_setup_source "$final_path"
fi fi
@ -137,7 +137,7 @@ fi
# Overwrite the nginx configuration only if it's allowed # Overwrite the nginx configuration only if it's allowed
if [ $overwrite_nginx -eq 1 ] if [ $overwrite_nginx -eq 1 ]
then then
ynh_script_progression --message="Reconfigure nginx" --weight=2 ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
@ -145,7 +145,7 @@ fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Create a dedicated user" ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create $app ynh_system_user_create $app
@ -157,7 +157,7 @@ ynh_system_user_create $app
# Overwrite the php-fpm configuration only if it's allowed # Overwrite the php-fpm configuration only if it's allowed
if [ $overwrite_phpfpm -eq 1 ] if [ $overwrite_phpfpm -eq 1 ]
then then
ynh_script_progression --message="Reconfigure php-fpm" --weight=2 ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config ynh_add_fpm_config
fi fi
@ -196,7 +196,7 @@ chown -R $app $final_path/cache $final_path/plugins $final_path/updates
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrade Leed with curl" --weight=4 ynh_script_progression --message="Upgrading Leed with curl..." --weight=4
# Clear leed cache # Clear leed cache
ynh_secure_remove $final_path/cache/* ynh_secure_remove $final_path/cache/*
# Set the app as temporarily public for curl call # Set the app as temporarily public for curl call
@ -212,7 +212,7 @@ fi
#================================================= #=================================================
# UPGRADE FAIL2BAN # UPGRADE FAIL2BAN
#================================================= #=================================================
ynh_script_progression --message="Reconfigure fail2ban" --weight=8 ynh_script_progression --message="Reconfiguring fail2ban..." --weight=8
# Create a dedicated fail2ban config # Create a dedicated fail2ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: <HOST>" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: <HOST>" --max_retry=5
@ -220,7 +220,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Reconfigure SSOwat" ynh_script_progression --message="Upgrading SSOwat configuration..."
# Make app private if necessary # Make app private if necessary
if [ $is_public -eq 0 ]; if [ $is_public -eq 0 ];
@ -234,14 +234,14 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reload nginx" --weight=2 ynh_script_progression --message="Reloading nginx web server..." --weight=2
ynh_systemd_action --action=reload --service_name=nginx ynh_systemd_action --action=reload --service_name=nginx
#================================================= #=================================================
# DEACTIVE MAINTENANCE MODE # DEACTIVE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Disable maintenance mode" ynh_script_progression --message="Disabling maintenance mode..."
ynh_maintenance_mode_OFF ynh_maintenance_mode_OFF
@ -271,4 +271,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --ty
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade completed" --last ynh_script_progression --message="Upgrade of $app completed" --last