Skip to content

Commit

Permalink
Relax RAM requirement to 3.8 GB
Browse files Browse the repository at this point in the history
  • Loading branch information
matbme committed Feb 3, 2024
1 parent 5ae23bb commit c9d33e8
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions vanilla_installer/core/system.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import subprocess


class Systeminfo:
uefi = None
ram = None
Expand All @@ -13,26 +14,32 @@ def is_uefi() -> bool:
Systeminfo.uefi = proc.returncode == 0

return Systeminfo.uefi

@staticmethod
def is_ram_enough() -> bool:
if not Systeminfo.ram:
proc = subprocess.Popen("free --giga | grep Mem | awk '{print $2}'",
shell=True, stdout=subprocess.PIPE).stdout\
.read().decode()
Systeminfo.ram = int(proc) >= 4

proc = subprocess.Popen(
"free -b | grep Mem | awk '{print $2}'",
shell=True,
stdout=subprocess.PIPE
).stdout.read().decode()
Systeminfo.ram = int(proc) >= 3800000000

return Systeminfo.ram

@staticmethod
def is_cpu_enough() -> bool:
if not Systeminfo.cpu:
proc1 = subprocess.Popen("lscpu | egrep 'Core\(s\)' | awk '{print $4}'",
shell=True, stdout=subprocess.PIPE).stdout\
.read().decode()
proc2 = subprocess.Popen("lscpu | egrep 'Socket\(s\)' | awk '{print $2}'",
shell=True, stdout=subprocess.PIPE).stdout\
.read().decode()
proc1 = subprocess.Popen(
"lscpu | grep -E 'Core\\(s\\)' | awk '{print $4}'",
shell=True,
stdout=subprocess.PIPE
).stdout.read().decode()
proc2 = subprocess.Popen(
"lscpu | grep -E 'Socket\\(s\\)' | awk '{print $2}'",
shell=True,
stdout=subprocess.PIPE
).stdout .read().decode()
Systeminfo.cpu = (int(proc1) * int(proc2)) >= 2

return Systeminfo.cpu

0 comments on commit c9d33e8

Please sign in to comment.