new script / wrapper around virt-install

This commit is contained in:
Lukas Greve
2025-05-21 17:35:57 +02:00
parent 1dfc10b5c9
commit 3fafb78838
4 changed files with 113 additions and 0 deletions

14
scripts/system-memory.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# Read the total memory from /proc/meminfo in MiB
total_memory=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
# Convert to MiB by dividing by 1024 (since MemTotal is in KiB)
total_memory_mb=$(( total_memory / 1024 ))
if [[ "$total_memory_mb" -lt "2048" ]]; then
echo "Not enough RAM: The system has only ${total_memory_mb}MiB of RAM, but at least 2048 MiB is required."
exit 1
else
echo "Sufficient memory available. System has ${total_memory_mb}MiB of RAM."
fi