lorax/pseudo/sparc.pseudo.py

88 lines
2.4 KiB
Python
Raw Normal View History

2011-03-04 08:45:20 +00:00
# sparc.pseudo.py
##### constants #####
ANABOOTDIR = "usr/share/anaconda/boot"
IMAGESDIR = "images"
SPARCDIR = "boot"
ISOPATHDIR = "isopath"
MKISOFS = "mkisofs"
IMPLANTISOMD5 = "implantisomd5"
##### main() #####
""" kernellist, installroot, outputroot, product, version, treeinfo, bootiso
"""
# create directories
makedirs(joinpaths(outputroot, IMAGESDIR))
makedirs(joinpaths(outputroot, SPARCDIR))
# copy silo.conf
siloconf = copy(joinpaths(installroot, ANABOOTDIR, "silo.conf"),
2011-03-04 12:27:59 +00:00
joinpaths(outputroot, SPARCDIR))
2011-03-04 08:45:20 +00:00
# copy boot.msg
bootmsg = copy(joinpaths(installroot, ANABOOTDIR, "boot.msg"),
2011-03-04 12:27:59 +00:00
joinpaths(outputroot, SPARCDIR))
2011-03-04 08:45:20 +00:00
replace(bootmsg, "%PRODUCT%", product)
replace(bootmsg, "%VERSION%", version)
# copy *.b to sparc dir
copy(joinpaths(installroot, ANABOOTDIR, "*.b"),
2011-03-04 12:27:59 +00:00
joinpaths(outputroot, SPARCDIR))
2011-03-04 08:45:20 +00:00
2011-03-04 12:27:59 +00:00
# create images
for kernel in kernellist:
# copy kernel
kernel.fname = "vmlinuz"
kernel.fpath = copy(kernel.fpath,
joinpaths(outputroot, SPARCDIR, kernel.fname))
# create and copy initrd
initrd_fname = "initrd.img"
initrd_fpath = copy(create_initrd(kernel),
joinpaths(outputroot, SPARCDIR, initrd_fname))
# add kernel and initrd to .treeinfo
with open(treeinfo, "a") as f:
f.write("[images-%s]\n" % kernel.arch)
f.write("kernel = %s\n" % joinpaths(SPARCDIR, kernel.fname))
f.write("initrd = %s\n" % joinpaths(SPARCDIR, initrd_fname))
2011-03-04 08:45:20 +00:00
if (bootiso):
# create isopath dir
isopathdir = joinpaths(outputroot, ISOPATHDIR)
makedirs(isopathdir)
# copy sparc dir to isopath dir
copytree(joinpaths(outputroot, SPARCDIR), isopathdir)
# create boot.iso
bootiso_fpath = joinpaths(outputroot, IMAGESDIR, bootiso)
2011-03-04 12:27:59 +00:00
# run mkisofs (XXX what's with the "Fedora" exclude?)
2011-03-04 08:45:20 +00:00
rc = exec([MKISOFS, "-R", "-J", "-T",
2011-03-04 12:27:59 +00:00
"-G", "/%s" % joinpaths(SPARCDIR, "isofs.b"),
2011-03-04 08:45:20 +00:00
"-B", "...",
2011-03-04 12:27:59 +00:00
"-s", "/%s" % joinpaths(SPARCDIR, "silo.conf"),
"-r", "-V", '"PBOOT"', "-A", '"%s %s"' % (product, version),
"-x", "Fedora", "-x", "repodata",
"-sparc-label", '"%s %s Boot Disc"' % (product, version),
2011-03-04 08:45:20 +00:00
"-o", bootiso_fpath, "-graft-points",
2011-03-04 12:27:59 +00:00
"boot=%s" % joinpaths(outputroot, SPARCDIR)])
2011-03-04 08:45:20 +00:00
# run implantisomd5
rc = exec([IMPLANTISOMD5, bootiso_fpath])
# remove isopath dir
remove(isopathdir)