From 340ccc422c0b5ae8241054cc3cf4dfd93d3ffae4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 31 Jan 2023 15:27:45 -0500 Subject: [PATCH] Specify check for arch override of addons.cpio For now, keep using x86_64 as default, but allow overrides for other architectures. One day it may be cleaner to move all addons.cpio to arch specific subdirs. --- confluent_server/confluent/osimage.py | 5 ++++- imgutil/imgutil | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/confluent_server/confluent/osimage.py b/confluent_server/confluent/osimage.py index e914f636..3b22b621 100644 --- a/confluent_server/confluent/osimage.py +++ b/confluent_server/confluent/osimage.py @@ -773,7 +773,10 @@ def generate_stock_profiles(defprofile, distpath, targpath, osname, yout.write('# This manifest enables rebase to know original source of profile data and if any customizations have been done\n') manifestdata = {'distdir': srcname, 'disthashes': hmap} yout.write(yaml.dump(manifestdata, default_flow_style=False)) - for initrd in os.listdir('{0}/initramfs'.format(defprofile)): + initrds = os.listdir('{0}/initramfs'.format(defprofile)) + if os.path.exists('{0}/initramfs/{1}'.format(defprofile, arch)): + initrds.extend(os.listdir('{0}/initramfs/{1}'.format(defprofile, arch))) + for initrd in initrds: fullpath = '{0}/initramfs/{1}'.format(defprofile, initrd) if os.path.isdir(fullpath): continue diff --git a/imgutil/imgutil b/imgutil/imgutil index 1ff7f570..a4bbb3d0 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -8,6 +8,7 @@ import glob import json import argparse import os +import platform import pwd import re import shutil @@ -202,8 +203,12 @@ def capture_remote(args): os.symlink('/var/lib/confluent/public/site/initramfs.cpio', os.path.join(outdir, 'boot/initramfs/site.cpio')) confdir = '/opt/confluent/lib/osdeploy/{}-diskless'.format(oscat) - os.symlink('{}/initramfs/addons.cpio'.format(confdir), - os.path.join(outdir, 'boot/initramfs/addons.cpio')) + archaddon = '/opt/confluent/lib/osdeploy/{}-diskless/initramfs/{}/addons.cpio'.format(oscat, platform.machine()) + if os.path.exists(archaddon): + os.symlink(archaddon, os.path.join(outdir, 'boot/initramfs/addons.cpio')) + else: + os.symlink('{}/initramfs/addons.cpio'.format(confdir), + os.path.join(outdir, 'boot/initramfs/addons.cpio')) indir = '{}/profiles/default'.format(confdir) if os.path.exists(indir): copy_tree(indir, outdir) @@ -1281,8 +1286,12 @@ def pack_image(args): profiley.write('label: {0}\nkernelargs: quiet # confluent_imagemethod=untethered|tethered # tethered is default when unspecified to save on memory, untethered will use more ram, but will not have any ongoing runtime root fs dependency on the http servers.\n'.format(label)) oscat = oshandler.oscategory confdir = '/opt/confluent/lib/osdeploy/{}-diskless'.format(oscat) - os.symlink('{}/initramfs/addons.cpio'.format(confdir), - os.path.join(outdir, 'boot/initramfs/addons.cpio')) + archaddon = '/opt/confluent/lib/osdeploy/{}-diskless/initramfs/{}/addons.cpio'.format(oscat, platform.machine()) + if os.path.exists(archaddon): + os.symlink(archaddon, os.path.join(outdir, 'boot/initramfs/addons.cpio')) + else: + os.symlink('{}/initramfs/addons.cpio'.format(confdir), + os.path.join(outdir, 'boot/initramfs/addons.cpio')) indir = '{}/profiles/default'.format(confdir) if os.path.exists(indir): copy_tree(indir, outdir)