From 9b94017a62c33085fc1179791f2f5ab8859267cb Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 25 Mar 2020 10:02:49 +0100 Subject: [PATCH] Manage swap for package_check --- scripts/install | 5 ++++- scripts/remove | 5 ++++- scripts/restore | 5 ++++- scripts/upgrade | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 32704ba..0929f8c 100644 --- a/scripts/install +++ b/scripts/install @@ -125,7 +125,10 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= ynh_print_info --message="Adding swap..." -ynh_add_swap --size=512 +# Don't create swap during package_check +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then + ynh_add_swap --size=512 +fi #================================================= # CREATE DRUSH ALIAS diff --git a/scripts/remove b/scripts/remove index b63c2b9..1bd5870 100644 --- a/scripts/remove +++ b/scripts/remove @@ -73,7 +73,10 @@ ynh_remove_nginx_config #================================================= ynh_print_info --message="Removing swap..." -ynh_del_swap +# Don't delete not existing swap during package_check +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then + ynh_del_swap +fi #================================================= # SPECIFIC REMOVE diff --git a/scripts/restore b/scripts/restore index ef098fa..5b915bd 100644 --- a/scripts/restore +++ b/scripts/restore @@ -127,7 +127,10 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= ynh_print_info --message="Adding swap..." -ynh_add_swap --size=512 +# Don't create swap during package_check +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then + ynh_add_swap --size=512 +fi #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 6abbdea..8b4c73f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -131,7 +131,10 @@ ynh_add_fpm_config --phpversion="7.3" #================================================= ynh_print_info --message="Adding swap..." -ynh_add_swap --size=512 +# Don't create swap during package_check +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then + ynh_add_swap --size=512 +fi #================================================= # UPGRADE COMPOSER