Files
scale-build/scale_build/iso.py
sonicaj 8e86e2d981 NAS-137225 / 26.04 / Fix scale build for trixie (#925)
* Trixie related changes for scale-build

* Point to HM mirrors

* Update apt preferences for trixie

* Update debootstrap changes for trixie

* Minor fix

* Remove python3 package

* Remove mandatory explicit dep

* Use openjdk-21-jdk for kernel

* Update passwd

* There is no need for custom openssl now

* Move from libssl3 to libssl3t64

* Remove util-linux from build manifest

* Set env variable for spdk

* Don't buidl spdk for now

* ipmctl is not available in stable

* Remove legacy sysv unit stuff

* Comment out netdata for now

* Small umount fix

* Also umount efivars

* Update build manifest to reflect updated branches

* Remove nfs entry from mtree

* Make sure to umount efivars

* Properly have apt sources fixed in update image

* Pull in grub2-common

* Add netdata mirror

* Fix url

* Make sure corepack is non-interactive

* Update netdata groups

* Fix efivars mounting

* Properly use clean_mounts

* Add fixme for netdata

* Properly comment out spdk explicit deps

* Remove grub-efi-amd64-signed from iso

* Make sure efivarfs is definitely mounted

* Bring in isc-dhcp-client for now

* Revert "Bring in isc-dhcp-client for now"

This reverts commit 259ffebba5.

* Only try to umount efivarfs if host is actually efi based

* Update repo's branches
2025-09-19 21:55:20 +05:00

53 lines
1.6 KiB
Python

import glob
import logging
import os
from .bootstrap.bootstrapdir import CdromBootstrapDirectory
from .exceptions import CallError
from .image.bootstrap import clean_mounts, setup_chroot_basedir
from .image.iso import install_iso_packages, make_iso_file
from .image.manifest import get_image_version, update_file_path
from .utils.logger import LoggingContext
from .utils.paths import LOG_DIR, RELEASE_DIR
from .config import TRUENAS_VENDOR
logger = logging.getLogger(__name__)
def build_iso():
try:
return build_impl()
finally:
clean_mounts()
def build_impl():
clean_mounts()
for f in glob.glob(os.path.join(LOG_DIR, 'cdrom*')):
os.unlink(f)
if not os.path.exists(update_file_path()):
raise CallError('Missing rootfs image. Run \'make update\' first.')
logger.debug('Bootstrapping CD chroot [ISO] (%s/cdrom-bootstrap.log)', LOG_DIR)
with LoggingContext('cdrom-bootstrap', 'w'):
cdrom_bootstrap_obj = CdromBootstrapDirectory()
cdrom_bootstrap_obj.setup()
setup_chroot_basedir(cdrom_bootstrap_obj)
image_version = get_image_version(vendor=TRUENAS_VENDOR)
logger.debug('Image version identified as %r', image_version)
logger.debug('Installing packages [ISO] (%s/cdrom-packages.log)', LOG_DIR)
try:
with LoggingContext('cdrom-packages', 'w'):
install_iso_packages()
logger.debug('Creating ISO file [ISO] (%s/cdrom-iso.log)', LOG_DIR)
with LoggingContext('cdrom-iso', 'w'):
make_iso_file()
finally:
clean_mounts()
logger.info('Success! CD/USB: %s/TrueNAS-SCALE-%s.iso', RELEASE_DIR, image_version)