1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00

fix swap on restore script

This commit is contained in:
Kay0u 2021-02-25 13:25:08 +01:00
parent 61b9ada2c0
commit 273fae501f
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D

View file

@ -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