|
|
|
@ -34,6 +34,7 @@ from cl_distr import IsoDistributive, DirectoryDistributive, \
|
|
|
|
|
from cl_template import template,iniParser
|
|
|
|
|
from cl_vars_share import varsShare
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
from time import sleep
|
|
|
|
|
|
|
|
|
|
from cl_kernel_utils import KernelConfig,InitRamFs
|
|
|
|
|
|
|
|
|
@ -261,6 +262,22 @@ class cl_builder(color_print):
|
|
|
|
|
return data[5]
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def getProcessByRoot(self,rootPath):
|
|
|
|
|
def psax(x):
|
|
|
|
|
try:
|
|
|
|
|
rootPath = path.join('/proc',x,'root')
|
|
|
|
|
cmdLinePath = path.join('/proc',x,'cmdline')
|
|
|
|
|
if path.exists(rootPath) and path.exists(cmdLinePath):
|
|
|
|
|
return {'pid':x,
|
|
|
|
|
'root':os.readlink(rootPath),
|
|
|
|
|
'cmdline':open(cmdLinePath,'r').read().strip()}
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
return {'pid':x,'root':'','cmdline':''}
|
|
|
|
|
procid = filter(lambda x:x.isdigit(),os.listdir('/proc'))
|
|
|
|
|
return filter(lambda x:x['root'].startswith(rootPath),
|
|
|
|
|
map(psax,procid))
|
|
|
|
|
|
|
|
|
|
def printInfo(self):
|
|
|
|
|
self.printSUCCESS(_("Creating image of") + " Calculate Linux")
|
|
|
|
|
self.defaultPrint("%s\n"%_("System information"))
|
|
|
|
@ -295,6 +312,16 @@ class cl_builder(color_print):
|
|
|
|
|
else:
|
|
|
|
|
self.printWARNING(_("WARNING") +": " +
|
|
|
|
|
_("image will be created on disk which mounted to root"))
|
|
|
|
|
warningProc = \
|
|
|
|
|
self.getProcessByRoot(self.clVars.Get('cl_builder_path'))
|
|
|
|
|
if warningProc:
|
|
|
|
|
self.printWARNING(_("WARNING") +": " +
|
|
|
|
|
_("continuation of the operation will kill follow process:"))
|
|
|
|
|
for procObj in warningProc:
|
|
|
|
|
self.printWARNING(
|
|
|
|
|
" %s"%" ".join(
|
|
|
|
|
map(lambda x:x.replace("\n"," ").strip(),
|
|
|
|
|
procObj['cmdline'].split('\x00')))[:75])
|
|
|
|
|
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
else:
|
|
|
|
@ -378,6 +405,25 @@ class cl_builder(color_print):
|
|
|
|
|
self.assembleIso = False
|
|
|
|
|
self.printERROR(_("Interrupting the image creating"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
killMap = [(0,15,_("Terminating %s processes")),
|
|
|
|
|
(4,9,_("Kill %s processes")),
|
|
|
|
|
(2,0,None),
|
|
|
|
|
(10,9,_("Repeat kill %s processes"))]
|
|
|
|
|
listing = self.getProcessByRoot(self.clVars.Get('cl_builder_path'))
|
|
|
|
|
for waitTime,killCode,msg in killMap:
|
|
|
|
|
sleep(waitTime)
|
|
|
|
|
listing = filter(lambda x:path.exists(path.join('/proc',x['pid'])),
|
|
|
|
|
listing)
|
|
|
|
|
if not listing:
|
|
|
|
|
break
|
|
|
|
|
if msg:
|
|
|
|
|
self.printSUCCESS(msg%",".join(map(lambda x:x['pid'],listing))
|
|
|
|
|
+" ...")
|
|
|
|
|
if not killCode:
|
|
|
|
|
continue
|
|
|
|
|
for i in listing:
|
|
|
|
|
os.kill(int(i['pid']),killCode)
|
|
|
|
|
self.printMessageForTest(_("Prepare data for live image"))
|
|
|
|
|
self.prepareSourceDistributive(self.sourceDistr)
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|