diff --git a/confluent_osdeploy/diskless/build/genimage.py b/confluent_osdeploy/diskless/build/genimage.py new file mode 100644 index 00000000..062aacfe --- /dev/null +++ b/confluent_osdeploy/diskless/build/genimage.py @@ -0,0 +1,50 @@ +import optparse +import os +import subprocess +import tempfile +try: + import configparser +except ImportError: + import ConfigParser as configparser + + +def create_yumconf(sourcedir): + hdl, name = tempfile.mkstemp(prefix='genimage-yumconfig.') + yumconf = os.fdopen(hdl, mode='w+') + if os.path.exists(sourcedir + '/repodata'): + pass + else: + c = configparser.ConfigParser() + c.read(sourcedir + '/.treeinfo') + for sec in c.sections(): + if sec.startswith('variant-'): + try: + repopath = c.get(sec, 'repository') + except Exception: + continue + _, varname = sec.split('-', 1) + yumconf.write('[genimage-{0}]\n'.format(varname.lower())) + yumconf.write('name=Local install repository for {0}\n'.format(varname)) + currdir = os.path.join(sourcedir, repopath) + yumconf.write('baseurl={0}\n'.format(currdir)) + yumconf.write('enabled=1\ngpgcheck=0\n\n') + return name + + +def main(): + parser = optparse.OptionParser() + parser.add_option('-s', '--source', help='Directory to pull installation from (e.g. /var/lib/confluent/distributions/rocky-8.3-x86_64') + (opts, args) = parser.parse_args() + yumargs = ['yum', '--installroot={0}'.format(args[0])] + if opts.source: + yumconfig = create_yumconf(opts.source) + yumargs.extend(['-c', yumconfig, '--disablerepo=*', '--enablerepo=genimage-*']) + yumargs.append('install') + with open(os.path.join(os.path.dirname(__file__), 'pkglist'), 'r') as pkglist: + pkgs = pkglist.read() + pkgs = pkgs.split() + yumargs.extend(pkgs) + subprocess.check_call(yumargs) + +if __name__ == '__main__': + main() diff --git a/confluent_osdeploy/diskless/build/pkglist b/confluent_osdeploy/diskless/build/pkglist index 25242303..d74a442e 100644 --- a/confluent_osdeploy/diskless/build/pkglist +++ b/confluent_osdeploy/diskless/build/pkglist @@ -1,2 +1,14 @@ -'@minimal-environment' chrony kernel net-tools nfs-utils openssh-server rsync tar util-linux python3 tar dracut dracut-network ethtool parted openssl dhclient openssh-clients bash vim-minimal rpm iputils clevis lvm2 efibootmgr shim-x64.x86_64 grub2-efi-x64 attr - +dnf +hostname +irqbalance +less +sssd-client +NetworkManager +nfs-utils +numactl-libs +passwd +rootfiles +sudo +tuned +yum +chrony kernel net-tools nfs-utils openssh-server rsync tar util-linux python3 tar dracut dracut-network ethtool parted openssl dhclient openssh-clients bash vim-minimal rpm iputils clevis lvm2 efibootmgr shim-x64.x86_64 grub2-efi-x64 attr