mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 11:01:09 +00:00
Begin next draft of genimage
Write in python and support sourcing only from local directories if desired.
This commit is contained in:
parent
e1a4f370b2
commit
a3266ad01c
50
confluent_osdeploy/diskless/build/genimage.py
Normal file
50
confluent_osdeploy/diskless/build/genimage.py
Normal file
@ -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()
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user