2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-11-22 18:32:20 +00:00

Clean up the capture initramfs config on Ubuntu sources

Capture copies an initramfs-tools hook and conf.d/confluent.conf into the
source to build the deployment initramfs, but only ever removed the EL
dracut module afterwards. With MODULES=list left in place, the source's
next initramfs update was limited to the hook's driver list, and a source
captured again carried both files into the image, where rebuilding the
initramfs on install to disk shrank the clones' initramfs the same way.
Remove them after capture and leave them out of the image.
This commit is contained in:
Markus Hilger
2026-11-03 21:16:47 +01:00
parent ebd2d548a1
commit 8fd41b1315
+11 -1
View File
@@ -150,6 +150,11 @@ class FileMasker():
secontext = secontext.split(b'\x00', 1)[0].decode('utf8')
subprocess.check_call(['chcon', secontext, tmaskwith])
# What capture adds to an Ubuntu source to build the deployment initramfs.
# MODULES=list in there would also shrink the initramfs of the source and of
# installed clones to the hook's driver list.
CAPTURE_BOOT_FILES = ('/etc/initramfs-tools/hooks/confluent',
'/etc/initramfs-tools/conf.d/confluent.conf')
# Directories whose contents are host specific leftovers (scratch space,
# crash dumps, logs, caches, cached credentials). The directories themselves
# are kept so their mode, ownership and labels survive.
@@ -171,7 +176,7 @@ CAPTURE_DROP_FILES = (
# identity and stable privacy IPv6 addresses
'/var/lib/dhcpcd/*.lease*', '/var/lib/dhcpcd/duid', '/var/lib/dhcpcd/secret',
'/var/lib/NetworkManager/secret_key',
'/root/.*_history', '/root/.lesshst', '/root/.viminfo')
'/root/.*_history', '/root/.lesshst', '/root/.viminfo') + CAPTURE_BOOT_FILES
# Network profiles with static addresses of the source, which would come up
# on interfaces confignet does not configure (deployment writes the node's
# own, as with the netplan files masked in capture_fs). Profiles without
@@ -291,6 +296,11 @@ def capture_local_cleanup():
shutil.rmtree('/usr/lib/dracut/modules.d/97confluent')
except Exception:
pass
for bootfile in CAPTURE_BOOT_FILES:
try:
os.remove(bootfile)
except FileNotFoundError:
pass
subprocess.check_call(['umount', '/run/imgutil/capout'])
def build_boot_tree(targpath):