diff options
| author | Andrii Klymenko <a.klymenko@vyos.io> | 2026-04-23 16:48:12 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-23 16:48:12 +0300 |
| commit | 3c3df90237c39caa1e5f7e2cf3180fa4f5f4b0bb (patch) | |
| tree | 9c2ac007b370c2e2ed20f1da9f71384adf51b478 /scripts | |
| parent | d84d127f91186082df2a786c7e20fe2af55dfa3b (diff) | |
| download | vyos-build-3c3df90237c39caa1e5f7e2cf3180fa4f5f4b0bb.tar.gz vyos-build-3c3df90237c39caa1e5f7e2cf3180fa4f5f4b0bb.zip | |
T8542: Add functionality to generate SBOM file from ISO image
Add additional validation step to ensure that the transfer drive is unmounted successfully.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/check-qemu-install | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install index 507b1ea6..e2a27d69 100755 --- a/scripts/check-qemu-install +++ b/scripts/check-qemu-install @@ -1370,15 +1370,21 @@ try: if args.sbom and transfer_disk_path and args.sbom_output_dir: log.info('Extracting SBOM files from transfer disk to host.') mount_point = f'{transfer_disk_path}.mnt' + mounted = False os.makedirs(mount_point, exist_ok=True) - subprocess.check_output(['mount', '-o', 'loop', transfer_disk_path, mount_point]) - for sbom_f in [sbom_file_cdx, sbom_file_spdx]: - src = os.path.join(mount_point, sbom_f) - if os.path.isfile(src): - shutil.copy2(src, args.sbom_output_dir) - log.info(f'SBOM file saved to: {args.sbom_output_dir}/{sbom_f}') - subprocess.check_output(['umount', mount_point]) - os.rmdir(mount_point) + try: + subprocess.check_output(['mount', '-o', 'loop', transfer_disk_path, mount_point]) + mounted = True + for sbom_f in [sbom_file_cdx, sbom_file_spdx]: + src = os.path.join(mount_point, sbom_f) + if os.path.isfile(src): + shutil.copy2(src, args.sbom_output_dir) + log.info(f'SBOM file saved to: {args.sbom_output_dir}/{sbom_f}') + finally: + if mounted: + subprocess.check_output(['umount', mount_point]) + if os.path.isdir(mount_point): + os.rmdir(mount_point) except EarlyExit: pass |
