|
|
|
@ -18,6 +18,7 @@ import os
|
|
|
|
|
from os import path, R_OK
|
|
|
|
|
import platform
|
|
|
|
|
import re
|
|
|
|
|
import errno
|
|
|
|
|
from calculate.lib.utils.dracut import Dracut
|
|
|
|
|
from calculate.lib.datavars import Variable, ReadonlyVariable
|
|
|
|
|
from calculate.lib.utils.files import (readFile, process, listDirectory,
|
|
|
|
@ -344,3 +345,20 @@ class VariableOsSubsystem(Variable):
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
return SystemType.detect()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableClRootReadonly(ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
|
"""
|
|
|
|
|
type = "bool"
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
check_fn = '/var/tmp/.calculate-rw-check-%d' % os.getpid()
|
|
|
|
|
try:
|
|
|
|
|
with open(check_fn,'w') as f:
|
|
|
|
|
pass
|
|
|
|
|
os.unlink(check_fn)
|
|
|
|
|
except (IOError,OSError) as e:
|
|
|
|
|
if e.errno == errno.EROFS:
|
|
|
|
|
return "on"
|
|
|
|
|
return "off"
|
|
|
|
|