|
|
|
@ -133,7 +133,7 @@ class InitRamFs:
|
|
|
|
|
os.chdir(self.prevDir)
|
|
|
|
|
return res
|
|
|
|
|
|
|
|
|
|
def _packInitRamfs(self):
|
|
|
|
|
def _packInitRamfs(self,newInitramfsFile=None):
|
|
|
|
|
"""Pack initramfs"""
|
|
|
|
|
self.prevDir = os.getcwd()
|
|
|
|
|
try:
|
|
|
|
@ -165,14 +165,16 @@ class InitRamFs:
|
|
|
|
|
if cpioRes != 0:
|
|
|
|
|
return False
|
|
|
|
|
# remove old initrd file
|
|
|
|
|
os.unlink(self.initrdFile)
|
|
|
|
|
if not newInitramfsFile:
|
|
|
|
|
os.unlink(self.initrdFile)
|
|
|
|
|
newInitramfsFile = self.initrdFile
|
|
|
|
|
# pack and write new initrd file
|
|
|
|
|
initrd = gzip.open(self.initrdFile,'w')
|
|
|
|
|
initrd = gzip.open(newInitramfsFile,'w')
|
|
|
|
|
initrd.write(cpioData)
|
|
|
|
|
initrd.close()
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def cleanInitRamFs(self):
|
|
|
|
|
def cleanInitRamFs(self,newinitrd=None):
|
|
|
|
|
"""Unpack initramfs clean and pack"""
|
|
|
|
|
if not self._unpackInitRamfs():
|
|
|
|
|
return False
|
|
|
|
@ -195,6 +197,6 @@ class InitRamFs:
|
|
|
|
|
deleteModulesData),
|
|
|
|
|
[])
|
|
|
|
|
map(lambda x:os.unlink(x),deleteModulesData)
|
|
|
|
|
res = self._packInitRamfs()
|
|
|
|
|
res = self._packInitRamfs(newinitrd)
|
|
|
|
|
rmtree(self.tmpPath,ignore_errors=True)
|
|
|
|
|
return res
|