fix: POC for a sane dracut chroot environment

`bash` and various other utilities only work with a sane chroot
environment. At least `bash` needs `/dev/fd` to function properly.

Take this as a POC patch to make things work.
This commit is contained in:
Harald Hoyer 2021-05-21 16:48:05 +02:00
parent 19ed6ed871
commit a95a44d7f1

View File

@ -328,14 +328,17 @@ class TreeBuilder(object):
# Construct an initrd from the kernel name
outfile = kernel.path.replace("vmlinuz-", "initrd-") + ".img"
logger.info("rebuilding %s", outfile)
logger.info("dracut warnings about /proc are safe to ignore")
if backup:
initrd = joinpaths(self.vars.inroot, outfile)
if os.path.exists(initrd):
os.rename(initrd, initrd + backup)
cmd = dracut + [outfile, kernel.version]
runcmd([ "mount", "-t", "proc", "-o", "nosuid,noexec,nodev", "proc", self.vars.inroot + "/proc" ])
runcmd([ "mount", "-t", "devtmpfs", "-o", "mode=0755,noexec,nosuid,strictatime", "devtmpfs", self.vars.inroot + "/dev" ])
runcmd(cmd, root=self.vars.inroot)
runcmd([ "umount", self.vars.inroot + "/proc" ])
runcmd([ "umount", self.vars.inroot + "/dev" ])
def build(self):
templatefile = templatemap[self.vars.arch.basearch]