i officially hate netctl now i think
This commit is contained in:
18
aif/utils.py
18
aif/utils.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user