Skip to content

Commit c15a9bd

Browse files
author
Every Packet Matters Bear
committed
This commit fixes issues with kernel config not being found, issue #4
1 parent a1ff15d commit c15a9bd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

gentooimgr/install.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,11 @@ def step10_emerge_pkgs(args, cfg):
202202
completestep(10, "pkgs")
203203

204204
def step11_kernel(args, cfg):
205-
# at this point, genkernel will be installed
205+
# at this point, genkernel will be installed. Please note that configuration files must be copied before this point
206206
LOG.info(f":: Step 11: kernel")
207207
proc = Popen(["eselect", "kernel", "set", "1"])
208208
proc.communicate()
209209
if not args.kernel_dist:
210-
os.chdir(args.kernel_dir)
211210
threads = str(gentooimgr.config.THREADS)
212211
gentooimgr.kernel.build_kernel(args, cfg)
213212

@@ -379,6 +378,8 @@ def prechroot(args, cfg):
379378
"""
380379
LOG.info("\t::Doing some pre-chroot work")
381380
gentooimgr.kernel.kernel_copy_conf(args, cfg)
381+
exists = os.path.exists(cfg.get("kernel", {}).get("path", gentooimgr.kernel.DEFAULT_KERNEL_CONFIG_PATH))
382+
LOG.info(f"\t::Kernel configuration exists: {exists}")
382383

383384
def configure(args, config: dict) -> int:
384385
# Load configuration
@@ -410,7 +411,9 @@ def configure(args, config: dict) -> int:
410411
LOG.info(":: Binding and Mounting, Entering CHROOT")
411412
prechroot(args, cfg)
412413
gentooimgr.chroot.bind()
414+
os.chdir(os.sep)
413415
os.chroot(config.get("mountpoint"))
416+
os.chdir(os.sep)
414417

415418
# emerge --sync
416419
if not stepdone(9): step9_sync(args, cfg)

gentooimgr/kernel.py

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def kernel_copy_conf(args, config, inchroot=False):
2525
if not os.path.exists(kernelconfig):
2626
LOG.error(f"Expected kernel configuration file does not exist {kernelconfig}")
2727
kernelpath = config.get("kernel", {}).get("path", DEFAULT_KERNEL_CONFIG_PATH)
28+
if not inchroot:
29+
# Remove leading / from kernelpath and prepend our mountpoint for a proper non-chroot path (default)
30+
kernelpath = os.path.join(config.get("mountpoint", gentooimgr.config.GENTOO_MOUNT), kernelpath.lstrip(os.sep))
2831
if os.path.exists(kernelpath):
2932
os.remove(kernelpath)
3033
else:

0 commit comments

Comments
 (0)