i officially hate netctl now i think

This commit is contained in:
2019-11-30 01:05:20 -05:00
parent 5e57eb7bc5
commit 3a2eca4b98
13 changed files with 790 additions and 132 deletions

View File

@@ -1,6 +1,8 @@
import math
import os
import pathlib
import re
import shlex
import subprocess
##
import psutil
@@ -55,6 +57,22 @@ def isPowerofTwo(n):
return(isPowerOf2)
def kernelCmdline(chroot_base = '/'):
cmds = {}
chroot_base = pathlib.PosixPath(chroot_base)
cmdline = chroot_base.joinpath('proc', 'cmdline')
if not os.path.isfile(cmdline):
return(cmds)
with open(cmdline, 'r') as fh:
raw_cmds = fh.read().strip()
for c in shlex.split(raw_cmds):
l = c.split('=', 1)
if len(l) < 2:
l.append(None)
cmds[l[0]] = l[1]
return(cmds)
def kernelFilesystems():
# I wish there was a better way of doing this.
# https://unix.stackexchange.com/a/98680