|
| 1 | +%define our_gopath %{_topdir}/.gopath |
| 2 | + |
| 3 | +Summary: Azure Linux Image Tools |
| 4 | +Name: azurelinux-image-tools |
| 5 | +Version: 0.18.0 |
| 6 | +Release: 1%{?dist} |
| 7 | +License: MIT |
| 8 | +URL: https://github.com/microsoft/azure-linux-image-tools/ |
| 9 | +Group: Applications/System |
| 10 | +Vendor: Microsoft Corporation |
| 11 | +Distribution: Azure Linux |
| 12 | +Source0: https://github.com/microsoft/azure-linux-image-tools/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz |
| 13 | +# Below is a manually created tarball, no download link. |
| 14 | +# We're using pre-populated Go modules from this tarball, since network is disabled during build time. |
| 15 | +# Use generate_source_tarball.sh script with the package version to build this tarball. |
| 16 | +# |
| 17 | +Source1: %{name}-%{version}-vendor.tar.gz |
| 18 | +BuildRequires: golang >= 1.24.1 |
| 19 | +BuildRequires: systemd-udev |
| 20 | +Requires: %{name}-imagecustomizer = %{version}-%{release} |
| 21 | + |
| 22 | +%description |
| 23 | +Azure Linux Image Tools. This package provides the Azure Linux Image Customizer tool |
| 24 | +and its dependencies for customizing Azure Linux images. |
| 25 | + |
| 26 | +%package imagecustomizer |
| 27 | +Summary: Image Customizer |
| 28 | +Requires: qemu-img |
| 29 | +Requires: rpm |
| 30 | +Requires: coreutils |
| 31 | +Requires: util-linux |
| 32 | +Requires: systemd |
| 33 | +Requires: openssl |
| 34 | +Requires: sed |
| 35 | +Requires: createrepo_c |
| 36 | +Requires: squashfs-tools |
| 37 | +Requires: cdrkit |
| 38 | +Requires: parted |
| 39 | +Requires: e2fsprogs |
| 40 | +Requires: dosfstools |
| 41 | +Requires: xfsprogs |
| 42 | +Requires: zstd |
| 43 | +Requires: veritysetup |
| 44 | +Requires: grub2 |
| 45 | +Requires: binutils |
| 46 | +Requires: lsof |
| 47 | +Requires: python3 |
| 48 | +Requires: python3-pip |
| 49 | +Requires: jq |
| 50 | +%ifarch x86_64 |
| 51 | +Requires: grub2-pc |
| 52 | +Requires: systemd-ukify |
| 53 | +%endif |
| 54 | + |
| 55 | +%description imagecustomizer |
| 56 | +The Azure Linux Image Customizer is a tool that can take an |
| 57 | +existing generic Azure Linux image and modify it to be suited for a particular |
| 58 | +scenario. By providing an Azure Linux base image, users can also supply a config |
| 59 | +file specifying how they want the image to be customized. For example, this |
| 60 | +could include the installation of certain RPMs, updating the SELinux mode, and |
| 61 | +enabling DM-Verity. |
| 62 | + |
| 63 | +%prep |
| 64 | +%autosetup -p1 -n azure-linux-image-tools-%{version} |
| 65 | +tar -xf %{SOURCE1} --no-same-owner -C toolkit/tools |
| 66 | + |
| 67 | +%build |
| 68 | +export GOPATH=%{our_gopath} |
| 69 | +export GOFLAGS="-mod=vendor" |
| 70 | +make -C toolkit go-imagecustomizer REBUILD_TOOLS=y SKIP_LICENSE_SCAN=y |
| 71 | + |
| 72 | +%install |
| 73 | +mkdir -p %{buildroot}%{_bindir} |
| 74 | +install -p -m 0755 toolkit/out/tools/imagecustomizer %{buildroot}%{_bindir}/imagecustomizer |
| 75 | + |
| 76 | +# Install container support files for imagecustomizer subpackage |
| 77 | +# These files are used when building the imagecustomizer container |
| 78 | +mkdir -p %{buildroot}/usr/local/bin |
| 79 | +mkdir -p %{buildroot}/ |
| 80 | + |
| 81 | +# Copy container scripts from their source locations to container paths |
| 82 | +install -p -m 0755 toolkit/tools/imagecustomizer/container/entrypoint.sh %{buildroot}/usr/local/bin/imagecustomizer-entrypoint.sh |
| 83 | +install -p -m 0755 toolkit/tools/imagecustomizer/container/run.sh %{buildroot}/usr/local/bin/imagecustomizer-run.sh |
| 84 | +install -p -m 0755 toolkit/scripts/telemetry_hopper/telemetry_hopper.py %{buildroot}/usr/local/bin/telemetry_hopper.py |
| 85 | +install -p -m 0644 toolkit/scripts/telemetry_hopper/requirements.txt %{buildroot}/imagecustomizer-telemetry-requirements.txt |
| 86 | + |
| 87 | +%check |
| 88 | +go test -C toolkit/tools ./... |
| 89 | + |
| 90 | +%files |
| 91 | + |
| 92 | +%files imagecustomizer |
| 93 | +%license LICENSE |
| 94 | +%{_bindir}/imagecustomizer |
| 95 | +# Container support files - placed in container filesystem paths with imagecustomizer- prefix |
| 96 | +/usr/local/bin/imagecustomizer-entrypoint.sh |
| 97 | +/usr/local/bin/imagecustomizer-run.sh |
| 98 | +/usr/local/bin/telemetry_hopper.py |
| 99 | +/imagecustomizer-telemetry-requirements.txt |
| 100 | + |
| 101 | +%changelog |
| 102 | +* Wed Aug 20 2025 Lanze Liu <lanzeliu@microsoft.com> 0.18.0-1 |
| 103 | +- Original version for Azure Linux (license: MIT). |
| 104 | +- License verified. |
0 commit comments