From 273fae501f96d26b8a37294eb66eb8a3f280c54b Mon Sep 17 00:00:00 2001 From: Kay0u Date: Thu, 25 Feb 2021 13:25:08 +0100 Subject: [PATCH] fix swap on restore script --- scripts/restore | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/restore b/scripts/restore index c3170a1..91a0481 100644 --- a/scripts/restore +++ b/scripts/restore @@ -66,23 +66,19 @@ ynh_install_app_dependencies $pkg_dependencies # ADD SWAP IF NEEDED #================================================= -total_memory=$(ynh_get_ram --total) total_swap=$(ynh_get_ram --total --only_swap) swap_needed=0 # https://docs.gitlab.com/ce/install/requirements.html#memory -if [ $total_memory -lt 8192 ]; then - # Need a minimum of 8Go of memory - swap_needed=$((8192 - $total_memory)) -fi - # Need at least 2Go of swap -if [ $(($total_swap + $swap_needed)) -lt 2048 ]; then - swap_needed=$((2048 - $total_swap)) +if [ $total_swap -lt 2048 ]; then + swap_needed=$((2048 - total_swap)) fi -ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1 -ynh_add_swap --size=$swap_needed +if [ $swap_needed -gt 0 ]; then + ynh_script_progression --message="Adding $swap_needed Mo to swap..." + ynh_add_swap --size=$swap_needed +fi #================================================= # RESTORE CONF FILES