fixup: correct argument signature for initrd_append
This commit is contained in:
parent
c7c01667d6
commit
96ce44708d
@ -22,10 +22,12 @@ logger = logging.getLogger("pylorax.treebuilder")
|
|||||||
|
|
||||||
import os, re, glob
|
import os, re, glob
|
||||||
from subprocess import check_call, PIPE
|
from subprocess import check_call, PIPE
|
||||||
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
from sysutils import joinpaths, cpfile, replace, remove
|
from sysutils import joinpaths, cpfile, replace, remove
|
||||||
from ltmpl import LoraxTemplate
|
from ltmpl import LoraxTemplate
|
||||||
from base import DataHolder
|
from base import DataHolder
|
||||||
|
from imgutils import mkcpio
|
||||||
|
|
||||||
templatemap = {'i386': 'x86.tmpl',
|
templatemap = {'i386': 'x86.tmpl',
|
||||||
'x86_64': 'x86.tmpl',
|
'x86_64': 'x86.tmpl',
|
||||||
@ -114,21 +116,25 @@ class TreeBuilder(BaseBuilder):
|
|||||||
if not backup:
|
if not backup:
|
||||||
dracut.append("--force")
|
dracut.append("--force")
|
||||||
for kernel in self.kernels:
|
for kernel in self.kernels:
|
||||||
|
logger.info("rebuilding %s", kernel.initrd.path)
|
||||||
if backup:
|
if backup:
|
||||||
initrd = joinpaths(self.inroot, kernel.initrd.path)
|
initrd = joinpaths(self.inroot, kernel.initrd.path)
|
||||||
os.rename(initrd, initrd + backup)
|
os.rename(initrd, initrd + backup)
|
||||||
check_call(["chroot", self.inroot] + \
|
check_call(["chroot", self.inroot] + \
|
||||||
dracut + [kernel.initrd.path, kernel.version])
|
dracut + [kernel.initrd.path, kernel.version])
|
||||||
|
|
||||||
def initrd_append(rootdir):
|
def initrd_append(self, rootdir):
|
||||||
'''Place the given files into a cpio archive and append that archive
|
'''Place the given files into a cpio archive and append that archive
|
||||||
to the initrds.'''
|
to the initrds.'''
|
||||||
cpio = NamedTemporaryFile(prefix="lorax.")
|
cpio = NamedTemporaryFile(prefix="lorax.") # XXX workdir?
|
||||||
mkcpio(rootdir, cpio, compression=None)
|
mkcpio(rootdir, cpio.name, compression=None)
|
||||||
for kernel in self.kernels:
|
for kernel in self.kernels:
|
||||||
initrd = open(kernel.initrd.path, "ab")
|
cpio.seek(0)
|
||||||
cpio = open(cpio, "rb")
|
initrd_path = joinpaths(self.inroot, kernel.initrd.path)
|
||||||
initrd.write(cpio.read())
|
with open(initrd_path, "ab") as initrd:
|
||||||
|
logger.info("%s size before appending: %i",
|
||||||
|
kernel.initrd.path, os.path.getsize(initrd.name))
|
||||||
|
initrd.write(cpio.read())
|
||||||
|
|
||||||
def implantisomd5(self):
|
def implantisomd5(self):
|
||||||
for section, data in self.treeinfo_data:
|
for section, data in self.treeinfo_data:
|
||||||
|
Loading…
Reference in New Issue
Block a user