2024-07-17 10:13:30 -04:00
|
|
|
## Copyright (C) 2023 - 2024 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
|
|
|
|
## See the file COPYING for copying conditions.
|
|
|
|
|
2024-07-18 14:02:38 -04:00
|
|
|
## Lower parallel compilation jobs to 1 if less than 2 GB RAM to avoid freezing of virtual machines.
|
|
|
|
## This does not necessarily belong into security-misc.
|
|
|
|
## Example here:
|
2021-04-29 11:14:30 -04:00
|
|
|
## https://forums.whonix.org/t/linux-kernel-runtime-guard-lkrg-linux-kernel-runtime-integrity-checking-and-exploit-detection/8477/26
|
|
|
|
ENOUGH_RAM="1950"
|
|
|
|
total_ram="$(free -m | sed -n -e '/^Mem:/s/^[^0-9]*\([0-9]*\) .*/\1/p')"
|
|
|
|
if [ "$total_ram" -ge "$ENOUGH_RAM" ]; then
|
|
|
|
true "INFO: Enough RAM available. Not lowering compilation cores."
|
|
|
|
else
|
|
|
|
true "INFO: Not enough RAM available. Lowering compilation cores to 1."
|
|
|
|
parallel_jobs=1
|
|
|
|
fi
|