Add create urandom device (IssueID #435)

master
Mike Hiretsky 12 years ago
parent d5ca2c0bb3
commit 890b5b786f

@ -280,12 +280,39 @@ class cl_builder(color_print):
updateMeta = self.runChroot(builderPath,"emerge --sync")
self.printByResult(updateMeta.success())
def createUrandom(self,devPath):
"""
Create urandom and other needed devices
"""
createdDev = []
for node,mode,dmode,major,minor in [("urandom",0666,stat.S_IFCHR,1,9)]:
try:
nodePath = path.join(devPath,node)
if not path.exists(nodePath):
os.mknod(nodePath,mode|dmode,os.makedev(major,minor))
os.chmod(nodePath,mode)
createdDev.append(node)
except:
pass
def removeUrandom(self,devPath,createdDev):
"""
Remove urandom and other created devices
"""
for dev in createdDev:
try:
os.unlink(path.join(devPath,'dev',dev)
except:
pass
def prepareSourceDistributive(self,distr):
"""Unmount all bind,proc mount points from source distribute"""
mp = self.clVars.Get('cl_builder_path')
createdDev = self.createUrandom(mp)
self.dispatchConf(mp)
self.updatePortage(mp)
self.updateMan(mp)
self.removeUrandom(mp,createdDev)
# unmount all from source distribute
mps = filter(lambda x:x!=mp,map(lambda x:x[1],childMounts(mp)))

Loading…
Cancel
Save