]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
make.sh: Determine how much memory the build host has
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 7 Nov 2017 14:23:59 +0000 (15:23 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 7 Nov 2017 14:25:56 +0000 (15:25 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
make.sh
tools/make-functions

diff --git a/make.sh b/make.sh
index 11be8465eca284e9a556ac9135d8f77bb3328142..948a24d3907f2d68694bb1c28cefcca3156d2150 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -65,6 +65,9 @@ mkdir $BASEDIR/log/ 2>/dev/null
 # Include funtions
 . tools/make-functions
 
+# Get the amount of memory in this build system
+HOST_MEM=$(system_memory)
+
 if [ -f .config ]; then
        . .config
 fi
index b419253fa8cd9ea577d65c73e08f4cc811bec128..3b878fb000288b5bfb3ab9033c2be4553ae80e42 100644 (file)
@@ -60,6 +60,20 @@ WARN="\\033[1;35m"
 FAIL="\\033[1;31m"
 NORMAL="\\033[0;39m"
 
+system_memory() {
+       local key val unit
+
+       while read -r key val unit; do
+               case "${key}" in
+                       MemTotal:*)
+                               # Convert to MB
+                               echo "$(( ${val} / 1024 ))"
+                               break
+                               ;;
+               esac
+       done < /proc/meminfo
+}
+
 configure_build() {
        local build_arch="${1}"