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:
parent
19ed6ed871
commit
a95a44d7f1
@ -328,14 +328,17 @@ class TreeBuilder(object):
|
|||||||
# Construct an initrd from the kernel name
|
# Construct an initrd from the kernel name
|
||||||
outfile = kernel.path.replace("vmlinuz-", "initrd-") + ".img"
|
outfile = kernel.path.replace("vmlinuz-", "initrd-") + ".img"
|
||||||
logger.info("rebuilding %s", outfile)
|
logger.info("rebuilding %s", outfile)
|
||||||
logger.info("dracut warnings about /proc are safe to ignore")
|
|
||||||
|
|
||||||
if backup:
|
if backup:
|
||||||
initrd = joinpaths(self.vars.inroot, outfile)
|
initrd = joinpaths(self.vars.inroot, outfile)
|
||||||
if os.path.exists(initrd):
|
if os.path.exists(initrd):
|
||||||
os.rename(initrd, initrd + backup)
|
os.rename(initrd, initrd + backup)
|
||||||
cmd = dracut + [outfile, kernel.version]
|
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(cmd, root=self.vars.inroot)
|
||||||
|
runcmd([ "umount", self.vars.inroot + "/proc" ])
|
||||||
|
runcmd([ "umount", self.vars.inroot + "/dev" ])
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
templatefile = templatemap[self.vars.arch.basearch]
|
templatefile = templatemap[self.vars.arch.basearch]
|
||||||
|
Loading…
Reference in New Issue
Block a user