Move variable cl_chroot_status to calculate-lib.

master
Mike Hiretsky 14 years ago
parent ecb822e9b7
commit dab8fdff80

@ -124,31 +124,6 @@ class fillVars(object, varsShare):
else:
return cacheDir
reChroot = re.compile("^(?:_=.*bin/chroot|CHROOT=on)$",re.S)
def isChroot(self,pid):
"""Recursive detect chroot mode"""
if not os.access('/proc/%d/environ'%pid,R_OK):
return False
if filter(self.reChroot.match,
open('/proc/%d/environ'%pid,'r').read().split('\x00')):
return True
else:
ppid = filter(lambda x:x.startswith('PPid:'),
open('/proc/%d/status'%pid,'r').readlines())[0]
ppid = int(ppid.strip().partition('\t')[2])
if ppid == 0:
return False
else:
return self.isChroot(ppid)
def get_cl_chroot_status(self):
"""Detect chroot mode by mtab content"""
try:
return "on" if self.isChroot(os.getpid()) else "off"
except:
return "off"
def get_cl_builder_iso_action(self):
"""Need perform templates for builder:iso"""
if self.Get('cl_action')=='iso':

@ -65,9 +65,6 @@ class Data:
# override the default cache location for calckernel
cl_kernel_cache_path = {'mode':'w'}
# is shell in chroot
cl_chroot_status = {}
# need perform templates for builder:iso
cl_builder_iso_action = {}

Loading…
Cancel
Save