aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/_common.sh2
-rw-r--r--scripts/install4
-rw-r--r--scripts/restore4
-rw-r--r--scripts/upgrade4
4 files changed, 8 insertions, 6 deletions
diff --git a/scripts/_common.sh b/scripts/_common.sh
index e0686b2..dc466ba 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -13,6 +13,8 @@ BUNDLER_VERSION="1.17.3"
NODEJS_VERSION="12"
+MEMORY_NEEDED="2560"
+
#=================================================
# PERSONAL HELPERS
#=================================================
diff --git a/scripts/install b/scripts/install
index 97dee20..8c63cde 100644
--- a/scripts/install
+++ b/scripts/install
@@ -136,9 +136,9 @@ ynh_script_progression --message="Adding swap is needed..." --weight=4
total_memory=$(ynh_get_ram --total)
swap_needed=0
-if [ $total_memory -lt 2560 ]; then
+if [ $total_memory -lt $MEMORY_NEEDED ]; then
# Need a minimum of 2.5Go of memory
- swap_needed=$((2560 - $total_memory))
+ swap_needed=$(($MEMORY_NEEDED - $total_memory))
fi
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1
diff --git a/scripts/restore b/scripts/restore
index ed0b27d..ae64eaf 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -89,9 +89,9 @@ ynh_script_progression --message="Adding swap if needed..." --weight=4
total_memory=$(ynh_get_ram --total)
swap_needed=0
-if [ $total_memory -lt 2560 ]; then
+if [ $total_memory -lt $MEMORY_NEEDED ]; then
# Need a minimum of 8Go of memory
- swap_needed=$((2560 - $total_memory))
+ swap_needed=$(($MEMORY_NEEDED - $total_memory))
fi
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1
diff --git a/scripts/upgrade b/scripts/upgrade
index 9e02c01..fd58f16 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -233,9 +233,9 @@ ynh_script_progression --message="Adding swap if needed..." --weight=7
total_memory=$(ynh_get_ram --total)
swap_needed=0
-if [ $total_memory -lt 2560 ]; then
+if [ $total_memory -lt $MEMORY_NEEDED ]; then
# Need a minimum of 8Go of memory
- swap_needed=$((2560 - $total_memory))
+ swap_needed=$(($MEMORY_NEEDED - $total_memory))
fi
ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1