2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-24 18:41:55 +00:00

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.
This commit is contained in:
Jarrod Johnson 2023-01-31 15:27:45 -05:00
parent 2c3afac576
commit 340ccc422c
2 changed files with 17 additions and 5 deletions

View File

@ -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

View File

@ -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)