diff --git a/scripts/format-disk.py b/scripts/format-disk.py index 76816d3..6b0399d 100644 --- a/scripts/format-disk.py +++ b/scripts/format-disk.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import os import subprocess @@ -10,6 +11,12 @@ def _run_command(command): return result +def _get_system_memory(): + mem_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') + mem_gib = mem_bytes / (1024.**3) + return round(mem_gib) + + def read_disks(): output = _run_command(["lsblk", "-dpno", "name"]) disks = [] @@ -45,6 +52,7 @@ def main(): create_menu(disks) disk_to_format = disks[get_disk_to_format()] format_disk(disk_to_format) + print(_get_system_memory()) if __name__ == "__main__":