From 3786b3b76afe5c68c7309f97150d5a8c279119c5 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 20 Sep 2020 14:24:03 -0500 Subject: ISO backend: Call dracut in chroot --- image/backends/iso.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'image') diff --git a/image/backends/iso.cc b/image/backends/iso.cc index 89d1e84..c70f004 100644 --- a/image/backends/iso.cc +++ b/image/backends/iso.cc @@ -367,15 +367,20 @@ public: std::ifstream kverstream(kverpath); kverstream >> kver; - /* dracut with -r can't autodetect udev directory without udev.pc */ - ::setenv("udevdir", "/lib/udev", 0); - if(run_command("dracut", {"--kver", kver, "-r", target+"/", "-N", + const std::string irdname = "initrd-" + my_arch; + if(run_command("chroot", {target, "dracut", "--kver", kver, "-N", "--force", "-a", "dmsquash-live", - cdpath + "/initrd-" + my_arch}) != 0) { + "/boot/" + irdname}) != 0) { output_error("CD backend", "dracut failed to create initramfs"); return COMMAND_ERROR; } + fs::rename(target + "/boot/" + irdname, cdpath + "/" + irdname, ec); + if(ec) { + output_error("CD backend", "cannot install initrd to CD root"); + return FS_ERROR; + } + /* REQ: ISO.24 */ std::string postscript; if(opts.find("post-script") != opts.end() && -- cgit v1.2.3-70-g09d2