forked from sig_core/toolkit
Add new latest link for ISO images
This creates a different, yet sustainable symlink for ISO images. This essentially allows the following formats: * Rocky-X.Y-ARCH-TYPE * Rocky-X.Y-DATE-ARCH-TYPE * Rocky-ARCH-TYPE * Rocky-X-latest-ARCH-TYPE
This commit is contained in:
parent
0ad6773539
commit
8749fc465f
@ -26,6 +26,8 @@ fi
|
|||||||
{% if extra_iso_mode == "podman" %}
|
{% if extra_iso_mode == "podman" %}
|
||||||
# symlink to unversioned image name
|
# symlink to unversioned image name
|
||||||
ln -sf {{ isoname }} {{ generic_isoname }}
|
ln -sf {{ isoname }} {{ generic_isoname }}
|
||||||
|
ln -sf {{ isoname }} {{ latest_isoname }}
|
||||||
ln -sf {{ isoname }}.manifest {{ generic_isoname }}.manifest
|
ln -sf {{ isoname }}.manifest {{ generic_isoname }}.manifest
|
||||||
|
ln -sf {{ isoname }}.manifest {{ latest_isoname }}.manifest
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -536,9 +536,15 @@ class IsoBuild:
|
|||||||
manifest = '{}.manifest'.format(isobootpath)
|
manifest = '{}.manifest'.format(isobootpath)
|
||||||
link_name = '{}-{}-boot.iso'.format(self.shortname, arch)
|
link_name = '{}-{}-boot.iso'.format(self.shortname, arch)
|
||||||
link_manifest = link_name + '.manifest'
|
link_manifest = link_name + '.manifest'
|
||||||
|
latest_link_name = '{}-{}-latest-{}-boot.iso'.format(self.shortname,
|
||||||
|
self.major_version,
|
||||||
|
arch)
|
||||||
|
latest_link_manifest = latest_link_name + '.manifest'
|
||||||
isobootpath = os.path.join(iso_to_go, discname)
|
isobootpath = os.path.join(iso_to_go, discname)
|
||||||
linkbootpath = os.path.join(iso_to_go, link_name)
|
linkbootpath = os.path.join(iso_to_go, link_name)
|
||||||
manifestlink = os.path.join(iso_to_go, link_manifest)
|
manifestlink = os.path.join(iso_to_go, link_manifest)
|
||||||
|
latestlinkbootpath = os.path.join(iso_to_go, latest_link_name)
|
||||||
|
latestmanifestlink = os.path.join(iso_to_go, latest_link_manifest)
|
||||||
|
|
||||||
if not force_unpack:
|
if not force_unpack:
|
||||||
file_check = isobootpath
|
file_check = isobootpath
|
||||||
@ -550,16 +556,25 @@ class IsoBuild:
|
|||||||
os.makedirs(iso_to_go, exist_ok=True)
|
os.makedirs(iso_to_go, exist_ok=True)
|
||||||
try:
|
try:
|
||||||
shutil.copy2(path_to_src_image, isobootpath)
|
shutil.copy2(path_to_src_image, isobootpath)
|
||||||
|
|
||||||
|
# For Rocky-ARCH-boot.iso
|
||||||
if os.path.exists(linkbootpath):
|
if os.path.exists(linkbootpath):
|
||||||
os.remove(linkbootpath)
|
os.remove(linkbootpath)
|
||||||
os.symlink(discname, linkbootpath)
|
os.symlink(discname, linkbootpath)
|
||||||
|
|
||||||
|
# For Rocky-X-latest-ARCH-boot.iso
|
||||||
|
if os.path.exists(latestlinkbootpath):
|
||||||
|
os.remove(latestlinkbootpath)
|
||||||
|
os.symlink(discname, latestlinkbootpath)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.error(Color.FAIL + 'We could not copy the image or create a symlink.')
|
self.log.error(Color.FAIL + 'We could not copy the image or create a symlink.')
|
||||||
raise SystemExit(e)
|
raise SystemExit(e)
|
||||||
|
|
||||||
|
# For Rocky-ARCH-boot.iso
|
||||||
if os.path.exists(path_to_src_image + '.manifest'):
|
if os.path.exists(path_to_src_image + '.manifest'):
|
||||||
shutil.copy2(path_to_src_image + '.manifest', manifest)
|
shutil.copy2(path_to_src_image + '.manifest', manifest)
|
||||||
os.symlink(manifest.split('/')[-1], manifestlink)
|
os.symlink(manifest.split('/')[-1], manifestlink)
|
||||||
|
os.symlink(manifest.split('/')[-1], latestmanifestlink)
|
||||||
|
|
||||||
self.log.info('Creating checksum for %s boot iso...' % arch)
|
self.log.info('Creating checksum for %s boot iso...' % arch)
|
||||||
checksum = Shared.get_checksum(isobootpath, self.checksum, self.log)
|
checksum = Shared.get_checksum(isobootpath, self.checksum, self.log)
|
||||||
@ -570,6 +585,7 @@ class IsoBuild:
|
|||||||
c.write(checksum)
|
c.write(checksum)
|
||||||
c.close()
|
c.close()
|
||||||
|
|
||||||
|
# For Rocky-ARCH-boot.iso
|
||||||
linksum = Shared.get_checksum(linkbootpath, self.checksum, self.log)
|
linksum = Shared.get_checksum(linkbootpath, self.checksum, self.log)
|
||||||
if not linksum:
|
if not linksum:
|
||||||
self.log.error(Color.FAIL + linkbootpath + ' not found! Did we actually make the symlink?')
|
self.log.error(Color.FAIL + linkbootpath + ' not found! Did we actually make the symlink?')
|
||||||
@ -578,6 +594,15 @@ class IsoBuild:
|
|||||||
l.write(linksum)
|
l.write(linksum)
|
||||||
l.close()
|
l.close()
|
||||||
|
|
||||||
|
# For Rocky-X-latest-ARCH-boot.iso
|
||||||
|
latestlinksum = Shared.get_checksum(latestlinkbootpath, self.checksum, self.log)
|
||||||
|
if not latestlinksum:
|
||||||
|
self.log.error(Color.FAIL + latestlinkbootpath + ' not found! Did we actually make the symlink?')
|
||||||
|
return
|
||||||
|
with open(latestlinkbootpath + '.CHECKSUM', "w+") as l:
|
||||||
|
l.write(latestlinksum)
|
||||||
|
l.close()
|
||||||
|
|
||||||
def _copy_nondisc_to_repo(self, force_unpack, arch, repo):
|
def _copy_nondisc_to_repo(self, force_unpack, arch, repo):
|
||||||
"""
|
"""
|
||||||
Syncs data from a non-disc set of images to the appropriate repo. Repo
|
Syncs data from a non-disc set of images to the appropriate repo. Repo
|
||||||
@ -844,6 +869,12 @@ class IsoBuild:
|
|||||||
)
|
)
|
||||||
|
|
||||||
generic_isoname = '{}-{}-{}.iso'.format(self.shortname, arch, image)
|
generic_isoname = '{}-{}-{}.iso'.format(self.shortname, arch, image)
|
||||||
|
latest_isoname = '{}-{}-latest-{}-{}.iso'.format(
|
||||||
|
self.shortname,
|
||||||
|
self.major_version,
|
||||||
|
arch,
|
||||||
|
image
|
||||||
|
)
|
||||||
|
|
||||||
lorax_pkg_cmd = '/usr/bin/dnf install {} -y {}'.format(
|
lorax_pkg_cmd = '/usr/bin/dnf install {} -y {}'.format(
|
||||||
' '.join(required_pkgs),
|
' '.join(required_pkgs),
|
||||||
@ -922,6 +953,7 @@ class IsoBuild:
|
|||||||
lorax_pkg_cmd=lorax_pkg_cmd,
|
lorax_pkg_cmd=lorax_pkg_cmd,
|
||||||
isoname=isoname,
|
isoname=isoname,
|
||||||
generic_isoname=generic_isoname,
|
generic_isoname=generic_isoname,
|
||||||
|
latest_isoname=latest_isoname,
|
||||||
)
|
)
|
||||||
|
|
||||||
iso_readme_template_output = iso_readme_template.render(
|
iso_readme_template_output = iso_readme_template.render(
|
||||||
|
Loading…
Reference in New Issue
Block a user