Move arch-specific logic out of installtree
Any decisions about arch-specific stuff should happen in the Lorax class or the arch-specific templates/code. Move that logic up to Lorax.run() and remove installtree.basearch.
This commit is contained in:
parent
051af505ae
commit
9b9f021caf
@ -179,8 +179,8 @@ class Lorax(BaseLoraxClass):
|
|||||||
logger.debug("self.arch.%s = %s", attr, getattr(self.arch,attr))
|
logger.debug("self.arch.%s = %s", attr, getattr(self.arch,attr))
|
||||||
|
|
||||||
logger.info("setting up install tree")
|
logger.info("setting up install tree")
|
||||||
self.installtree = LoraxInstallTree(self.yum, self.arch.basearch,
|
self.installtree = LoraxInstallTree(self.yum, self.arch.libdir,
|
||||||
self.arch.libdir, self.workdir)
|
self.workdir)
|
||||||
|
|
||||||
logger.info("setting up build parameters")
|
logger.info("setting up build parameters")
|
||||||
product = DataHolder(name=product, version=version, release=release,
|
product = DataHolder(name=product, version=version, release=release,
|
||||||
@ -233,10 +233,11 @@ class Lorax(BaseLoraxClass):
|
|||||||
self.installtree.remove_locales()
|
self.installtree.remove_locales()
|
||||||
|
|
||||||
logger.info("creating keymaps")
|
logger.info("creating keymaps")
|
||||||
self.installtree.create_keymaps()
|
if self.arch.basearch not in ("s390", "s390x"):
|
||||||
|
self.installtree.create_keymaps(basearch=self.arch.basearch)
|
||||||
|
|
||||||
logger.info("creating screenfont")
|
logger.info("creating screenfont")
|
||||||
self.installtree.create_screenfont()
|
self.installtree.create_screenfont(basearch=self.arch.basearch)
|
||||||
|
|
||||||
logger.info("moving stubs")
|
logger.info("moving stubs")
|
||||||
self.installtree.move_stubs()
|
self.installtree.move_stubs()
|
||||||
@ -254,6 +255,9 @@ class Lorax(BaseLoraxClass):
|
|||||||
self.installtree.create_depmod_conf()
|
self.installtree.create_depmod_conf()
|
||||||
|
|
||||||
# misc tree modifications
|
# misc tree modifications
|
||||||
|
if self.arch.basearch in ("s390", "s390x"):
|
||||||
|
# TODO: move this to the arch template
|
||||||
|
self.installtree.misc_s390_modifications()
|
||||||
self.installtree.misc_tree_modifications()
|
self.installtree.misc_tree_modifications()
|
||||||
|
|
||||||
# get config files
|
# get config files
|
||||||
@ -262,6 +266,8 @@ class Lorax(BaseLoraxClass):
|
|||||||
|
|
||||||
self.installtree.get_config_files(config_dir)
|
self.installtree.get_config_files(config_dir)
|
||||||
self.installtree.setup_sshd(config_dir)
|
self.installtree.setup_sshd(config_dir)
|
||||||
|
if self.arch.basearch in ("s390", "s390x"):
|
||||||
|
self.installtree.generate_ssh_keys()
|
||||||
|
|
||||||
# get anaconda portions
|
# get anaconda portions
|
||||||
self.installtree.get_anaconda_portions()
|
self.installtree.get_anaconda_portions()
|
||||||
|
@ -39,11 +39,10 @@ from sysutils import *
|
|||||||
|
|
||||||
class LoraxInstallTree(BaseLoraxClass):
|
class LoraxInstallTree(BaseLoraxClass):
|
||||||
|
|
||||||
def __init__(self, yum, basearch, libdir, workdir):
|
def __init__(self, yum, libdir, workdir):
|
||||||
BaseLoraxClass.__init__(self)
|
BaseLoraxClass.__init__(self)
|
||||||
self.yum = yum
|
self.yum = yum
|
||||||
self.root = self.yum.installroot
|
self.root = self.yum.installroot
|
||||||
self.basearch = basearch
|
|
||||||
self.libdir = libdir
|
self.libdir = libdir
|
||||||
self.workdir = workdir
|
self.workdir = workdir
|
||||||
|
|
||||||
@ -73,15 +72,11 @@ class LoraxInstallTree(BaseLoraxClass):
|
|||||||
# move the lang-table to etc
|
# move the lang-table to etc
|
||||||
shutil.move(langtable, joinpaths(self.root, "etc"))
|
shutil.move(langtable, joinpaths(self.root, "etc"))
|
||||||
|
|
||||||
def create_keymaps(self):
|
def create_keymaps(self, basearch):
|
||||||
if self.basearch in ("s390", "s390x"):
|
|
||||||
# skip on s390
|
|
||||||
return True
|
|
||||||
|
|
||||||
keymaps = joinpaths(self.root, "etc/keymaps.gz")
|
keymaps = joinpaths(self.root, "etc/keymaps.gz")
|
||||||
|
|
||||||
# look for override
|
# look for override
|
||||||
override = "keymaps-override-{0.basearch}".format(self)
|
override = "keymaps-override-{0}".format(basearch)
|
||||||
override = joinpaths(self.root, "usr/share/anaconda", override)
|
override = joinpaths(self.root, "usr/share/anaconda", override)
|
||||||
if os.path.isfile(override):
|
if os.path.isfile(override):
|
||||||
logger.debug("using keymaps override")
|
logger.debug("using keymaps override")
|
||||||
@ -89,16 +84,16 @@ class LoraxInstallTree(BaseLoraxClass):
|
|||||||
else:
|
else:
|
||||||
# create keymaps
|
# create keymaps
|
||||||
cmd = [joinpaths(self.root, "usr/libexec/anaconda", "getkeymaps"),
|
cmd = [joinpaths(self.root, "usr/libexec/anaconda", "getkeymaps"),
|
||||||
self.basearch, keymaps, self.root]
|
basearch, keymaps, self.root]
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
proc.wait()
|
proc.wait()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def create_screenfont(self):
|
def create_screenfont(self, basearch):
|
||||||
dst = joinpaths(self.root, "etc/screenfont.gz")
|
dst = joinpaths(self.root, "etc/screenfont.gz")
|
||||||
|
|
||||||
screenfont = "screenfont-{0.basearch}.gz".format(self)
|
screenfont = "screenfont-{0}.gz".format(basearch)
|
||||||
screenfont = joinpaths(self.root, "usr/share/anaconda", screenfont)
|
screenfont = joinpaths(self.root, "usr/share/anaconda", screenfont)
|
||||||
if not os.path.isfile(screenfont):
|
if not os.path.isfile(screenfont):
|
||||||
return False
|
return False
|
||||||
@ -367,24 +362,19 @@ class LoraxInstallTree(BaseLoraxClass):
|
|||||||
with open(joinpaths(self.root, "etc/depmod.d/dd.conf"), "w") as fobj:
|
with open(joinpaths(self.root, "etc/depmod.d/dd.conf"), "w") as fobj:
|
||||||
fobj.write(text)
|
fobj.write(text)
|
||||||
|
|
||||||
def misc_tree_modifications(self):
|
def misc_s390_modifications(self):
|
||||||
if self.basearch in ("s390", "s390x"):
|
|
||||||
# copy linuxrc.s390
|
# copy linuxrc.s390
|
||||||
src = joinpaths(self.root, "usr/share/anaconda/linuxrc.s390")
|
src = joinpaths(self.root, "usr/share/anaconda/linuxrc.s390")
|
||||||
dst = joinpaths(self.root, "sbin", "init")
|
dst = joinpaths(self.root, "sbin", "init")
|
||||||
os.unlink(dst)
|
os.unlink(dst)
|
||||||
shutil.copy2(src, dst)
|
shutil.copy2(src, dst)
|
||||||
|
|
||||||
|
def misc_tree_modifications(self):
|
||||||
# init symlinks
|
# init symlinks
|
||||||
target = "/sbin/init"
|
target = "/sbin/init"
|
||||||
name = joinpaths(self.root, "init")
|
name = joinpaths(self.root, "init")
|
||||||
os.symlink(target, name)
|
os.symlink(target, name)
|
||||||
|
|
||||||
# mtab symlink
|
|
||||||
#target = "/proc/mounts"
|
|
||||||
#name = joinpaths(self.root, "etc", "mtab")
|
|
||||||
#os.symlink(target, name)
|
|
||||||
|
|
||||||
os.unlink(joinpaths(self.root, "etc/systemd/system/default.target"))
|
os.unlink(joinpaths(self.root, "etc/systemd/system/default.target"))
|
||||||
os.symlink("/lib/systemd/system/anaconda.target", joinpaths(self.root, "etc/systemd/system/default.target"))
|
os.symlink("/lib/systemd/system/anaconda.target", joinpaths(self.root, "etc/systemd/system/default.target"))
|
||||||
|
|
||||||
@ -496,8 +486,7 @@ class LoraxInstallTree(BaseLoraxClass):
|
|||||||
# change permissions
|
# change permissions
|
||||||
chmod_(shadow, 400)
|
chmod_(shadow, 400)
|
||||||
|
|
||||||
# generate ssh keys for s390
|
def generate_ssh_keys(self):
|
||||||
if self.basearch in ("s390", "s390x"):
|
|
||||||
logger.info("generating SSH1 RSA host key")
|
logger.info("generating SSH1 RSA host key")
|
||||||
rsa1 = joinpaths(self.root, "etc/ssh/ssh_host_key")
|
rsa1 = joinpaths(self.root, "etc/ssh/ssh_host_key")
|
||||||
cmd = [self.lcmds.SSHKEYGEN, "-q", "-t", "rsa1", "-f", rsa1,
|
cmd = [self.lcmds.SSHKEYGEN, "-q", "-t", "rsa1", "-f", rsa1,
|
||||||
@ -579,11 +568,8 @@ class LoraxInstallTree(BaseLoraxClass):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def kernels(self):
|
def kernels(self):
|
||||||
kerneldir = "boot"
|
kerneldir = joinpaths(self.root, "boot")
|
||||||
if self.basearch == "ia64":
|
# FIXME: kernel search path?
|
||||||
kerneldir = "boot/efi/EFI/redhat"
|
|
||||||
|
|
||||||
kerneldir = joinpaths(self.root, kerneldir)
|
|
||||||
kpattern = re.compile(r"vmlinuz-(?P<ver>[-._0-9a-z]+?"
|
kpattern = re.compile(r"vmlinuz-(?P<ver>[-._0-9a-z]+?"
|
||||||
r"(?P<pae>(PAE)?)(?P<xen>(xen)?))$")
|
r"(?P<pae>(PAE)?)(?P<xen>(xen)?))$")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user