From 629f91cb5efd2783c1f07f46a43b9cec6753908aaf508b21028b3cb86cff469b Mon Sep 17 00:00:00 2001 From: Max Lin Date: Mon, 29 Sep 2025 21:15:18 +0800 Subject: [PATCH] Update and workaround squashfs.img on non-s390x --- agama-installer.tftpbootlinks.txt | 14 ++++++ agama-installer.tftpbootpatterns.txt | 14 ++++++ baseiso-containment.changes | 29 +++++++++++++ baseiso-containment.spec | 11 ++++- baseiso.spec.in | 65 +++++++++++++++++++++++++--- baseiso_post_run | 30 ++++++------- 6 files changed, 139 insertions(+), 24 deletions(-) create mode 100644 agama-installer.tftpbootlinks.txt create mode 100644 agama-installer.tftpbootpatterns.txt diff --git a/agama-installer.tftpbootlinks.txt b/agama-installer.tftpbootlinks.txt new file mode 100644 index 0000000..42df1c4 --- /dev/null +++ b/agama-installer.tftpbootlinks.txt @@ -0,0 +1,14 @@ +/EFI/BOOT/MokManager.efi +/EFI/BOOT/bootaa64.efi +/EFI/BOOT/bootx64.efi +/EFI/BOOT/grub.efi +/boot/aarch64/loader/initrd +/boot/aarch64/loader/linux +/boot/x86_64/loader/initrd +/boot/x86_64/loader/linux +/boot/s390x/initrd +/boot/s390x/linux +/boot/ppc64le/initrd +/boot/ppc64le/linux +/LiveOS/squashfs.img + diff --git a/agama-installer.tftpbootpatterns.txt b/agama-installer.tftpbootpatterns.txt new file mode 100644 index 0000000..6a7409a --- /dev/null +++ b/agama-installer.tftpbootpatterns.txt @@ -0,0 +1,14 @@ +^/LiveOS/squashfs\.img$ +^/EFI/BOOT/.*\.efi$ +^/boot/.*/initrd$ +^/boot/.*/linux$ +^/suse\.ins$ +^/susehmc\.ins$ +^/boot/s390x/cd\.ikr$ +^/boot/s390x/initrd\.off$ +^/boot/s390x/initrd\.siz$ +^/boot/s390x/parmfile$ +^/boot/s390x/parmfile\.hmc$ +^/boot/s390x/sles\.exec$ +^/boot/s390x/suse\.ins$ +^/boot/s390x/zipl\.map$ diff --git a/baseiso-containment.changes b/baseiso-containment.changes index 27900b4..72b902f 100644 --- a/baseiso-containment.changes +++ b/baseiso-containment.changes @@ -1,3 +1,32 @@ +------------------------------------------------------------------- +Wed Sep 10 09:20:15 UTC 2025 - Max Lin + +- Only add squashfs.img to CD1 if s390x architecture + +------------------------------------------------------------------- +Fri Sep 5 21:29:52 UTC 2025 - Eugenio Paolantonio + +- 0.2.7 + * tftpboot: package s390x specific files + * maintain the directory structure rather than putting everything inside + the loader/ directory. Files are also symlinked into loader/ to + keep old configurations working + * add skelcd package that can be extracted in ftp-trees (bsc#1248800) + +------------------------------------------------------------------- +Wed Jul 2 09:13:28 UTC 2025 - Eugenio Paolantonio + +- 0.2.6 + * rework tftpboot rpm generation: extract the whole live squashfs + filesystem from the standard agama-installer iso, rather than + using the purpose-built PXE images (which will be likely dropped + soon) + +------------------------------------------------------------------- +Tue Jun 24 13:27:33 CEST 2025 - Ruediger Oertel + +* copy milestone files along with the created rpms if they exist + ------------------------------------------------------------------- Mon Apr 28 09:59:09 UTC 2025 - Giacomo Leidi diff --git a/baseiso-containment.spec b/baseiso-containment.spec index d0217a3..b875ca0 100644 --- a/baseiso-containment.spec +++ b/baseiso-containment.spec @@ -1,7 +1,7 @@ # # spec file for package baseiso-containment # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,15 +17,18 @@ Name: baseiso-containment -Version: 0.2.5 +Version: 0.2.7 Release: 0 Summary: Wraps Agama build for product composer License: MIT Group: System/Management Source1: baseiso.spec.in Source2: baseiso_post_run +Source3: agama-installer.tftpbootpatterns.txt +Source4: agama-installer.tftpbootlinks.txt BuildRequires: filesystem BuildArch: noarch +Requires: mkisofs %description Wraps Agama build as base image for product composer @@ -33,11 +36,15 @@ Wraps Agama build as base image for product composer %install mkdir -p %{buildroot}%{_prefix}/lib/build/post_build.d install -m 644 %{S:1} %{buildroot}%{_prefix}/lib/build/ +install -m 644 %{S:3} %{buildroot}%{_prefix}/lib/build/ +install -m 644 %{S:4} %{buildroot}%{_prefix}/lib/build/ install -m 755 %{S:2} %{buildroot}%{_prefix}/lib/build/post_build.d/ %files %dir %{_prefix}/lib/build/post_build.d %{_prefix}/lib/build/post_build.d/*_post_run %{_prefix}/lib/build/baseiso.spec.in +%{_prefix}/lib/build/*.tftpbootpatterns.txt +%{_prefix}/lib/build/*.tftpbootlinks.txt %changelog diff --git a/baseiso.spec.in b/baseiso.spec.in index 99d45d9..1e26c21 100644 --- a/baseiso.spec.in +++ b/baseiso.spec.in @@ -1,6 +1,14 @@ # needsrootforbuild -%bcond pxeboot 0 +# Keep this as a bcond for the future, but always +# enable it by default as baseiso-containment only +# works for agama-installer ISOs currently +%bcond pxeboot 1 + +# Patterns file name can be specified by defining %{tftpbootpatterns_name}, +# or it defaults to "agama-installer". +%define tftpbootpatterns_path /usr/lib/build/%{?tftpbootpatterns_name}%{!?tftpbootpatterns_name:agama-installer}.tftpbootpatterns.txt +%define tftpbootlinks_path /usr/lib/build/%{?tftpbootpatterns_name}%{!?tftpbootpatterns_name:agama-installer}.tftpbootlinks.txt Url: http://www.suse.com/ Name: baseiso-__NAME____FLAVOR__ @@ -11,10 +19,12 @@ Group: System/Management License: SUSE-EULA Provides: baseiso(__NAME____FLAVOR__) -%define install_dir %{_libexecdir}/base-isos -%define tftpboot_dir /usr/share/tftpboot-installation -%define product_dir %{tftpboot_dir}/__NAME____FLAVOR__ -%define pxeboot_dir %{product_dir}/%{_arch}/loader +%define install_dir %{_libexecdir}/base-isos +%define tftpboot_dir /usr/share/tftpboot-installation +%define product_dir %{tftpboot_dir}/__NAME____FLAVOR__ +%define pxeboot_dir %{product_dir}/%{_arch} +%define skelcd_dir /usr/lib/skelcd +%define skelcd_cd1_dir %{skelcd_dir}/CD1 %description Images to be used by product composer as a base. It is designed @@ -29,14 +39,50 @@ BuildArch: noarch Loaders that can be used for PXE boot, extracted from the installer content. +%package -n skelcd-__NAME____FLAVOR__ +Summary: Product Composer Base Images (skeleton data) +Group: System/Management + +%description -n skelcd-__NAME____FLAVOR__ +Loaders that can be extracted in ftp-trees. + %install mkdir -p %buildroot%{install_dir} cp -a /usr/src/packages/KIWI/* %buildroot%install_dir + %if %{with pxeboot} mkdir -p %{buildroot}%{pxeboot_dir} -tar -xvf %{buildroot}%{install_dir}/__NAME__*.install.tar -C %{buildroot}%{pxeboot_dir} --transform 's/__NAME__.%{_arch}-__VERSION__./pxe-installer./' --show-transformed-names -ls -ltha %{buildroot}%{pxeboot_dir} +mkdir -p %{buildroot}%{skelcd_cd1_dir} +for file in $(isoinfo -R -i %{buildroot}%{install_dir}/*.iso -find -type f -print | grep -Ef %{tftpbootpatterns_path}); do + mkdir -p %{buildroot}%{pxeboot_dir}/$(dirname ${file}) + if [[ ! "$file" =~ "squashfs.img" ]]; then + mkdir -p %{buildroot}%{skelcd_cd1_dir}/$(dirname ${file}) + else + if [ "%{_arch}" == "s390x" ]; then + mkdir -p %{buildroot}%{skelcd_cd1_dir}/$(dirname ${file}) + fi + fi + isoinfo -R -i %{buildroot}%{install_dir}/*.iso -x ${file} > %{buildroot}%{pxeboot_dir}/${file} + if [[ ! "$file" =~ "squashfs.img" ]]; then + cp %{buildroot}%{pxeboot_dir}/${file} %{buildroot}%{skelcd_cd1_dir}/${file} + else + if [ "%{_arch}" == "s390x" ]; then + cp %{buildroot}%{pxeboot_dir}/${file} %{buildroot}%{skelcd_cd1_dir}/${file} + fi + fi +done + +# Create compatibility symlinks with the directory structure used by older +# baseiso-containment releases. +# They will go in %{pxeboot_dir}/loader. This is only needed only for +# the tftpboot- packages. +if [ -e %{tftpbootlinks_path} ]; then + mkdir -p %{buildroot}%{pxeboot_dir}/loader + cat %{tftpbootlinks_path} | while read file; do + [ ! -e %{buildroot}%{pxeboot_dir}/${file} ] || ln -s %{pxeboot_dir}/${file} %{buildroot}%{pxeboot_dir}/loader/$(basename ${file}) + done +fi %endif if [ -n "__FLAVOR__" ]; then @@ -61,6 +107,11 @@ fi %defattr(-,root,root) %dir %attr(0755,tftp,tftp) %tftpboot_dir %tftpboot_dir + +%files -n skelcd-__NAME____FLAVOR__ +%defattr(-,root,root) +%dir %skelcd_dir +%skelcd_cd1_dir %endif %changelog diff --git a/baseiso_post_run b/baseiso_post_run index e640854..7bd59ae 100644 --- a/baseiso_post_run +++ b/baseiso_post_run @@ -35,25 +35,15 @@ ARCH="$(uname -m)" set +e # we have set -e, so on Minimal VMs this needs to fail silently iso_file=`ls -1 /usr/src/packages/KIWI/agama-installer*.iso 2>/dev/null` -pxe_file=`ls -1 /usr/src/packages/KIWI/agama-installer*.install.tar 2>/dev/null` +milestone_file=`ls -1 /usr/src/packages/KIWI/agama-installer*.milestone 2>/dev/null` set -e # nothing to do for us -if [ -z "$iso_file" ] && [ -z "$pxe_file" ]; then +if [ -z "$iso_file" ]; then exit 0 fi -if [ -n "$pxe_file" ]; then - PXEBOOT_BCOND="--with pxeboot" -else - PXEBOOT_BCOND="--without pxeboot" -fi - -if [ -n "$iso_file" ]; then - main_file=${iso_file##*/} -else - main_file=${pxe_file##*/} -fi +main_file=${iso_file##*/} iso_name=${main_file%.$ARCH*} iso_version=${main_file#*$ARCH-} @@ -84,9 +74,9 @@ sed -e "s@__NAME__@$iso_name@g" \ cp -v $TOPDIR/SOURCES/*.changes $BUILD_DIR/image.changes if [ -z "$BUILD_DISTURL" ]; then - rpmbuild --target $ARCH -ba $PXEBOOT_BCOND $BUILD_DIR/image.spec + rpmbuild --target $ARCH -ba $BUILD_DIR/image.spec else - rpmbuild --target $ARCH -ba $PXEBOOT_BCOND --define "disturl $BUILD_DISTURL" $BUILD_DIR/image.spec + rpmbuild --target $ARCH -ba --define "disturl $BUILD_DISTURL" $BUILD_DIR/image.spec fi # required for the BS to find the rpm, because it is @@ -96,4 +86,14 @@ mv $TOPDIR/RPMS/$ARCH/baseiso-$iso_name$FLAVOR-$iso_version-$iso_build.$ARCH.rpm if [ -e $TOPDIR/RPMS/noarch/tftpboot-$iso_name$FLAVOR-$ARCH-$iso_version-$iso_build.noarch.rpm ]; then mv $TOPDIR/RPMS/noarch/tftpboot-$iso_name$FLAVOR-$ARCH-$iso_version-$iso_build.noarch.rpm $TOPDIR/OTHER/ fi +if [ -e $TOPDIR/RPMS/$ARCH/skelcd-$iso_name$FLAVOR-$iso_version-$iso_build.$ARCH.rpm ]; then + mv $TOPDIR/RPMS/$ARCH/skelcd-$iso_name$FLAVOR-$iso_version-$iso_build.$ARCH.rpm $TOPDIR/OTHER/ +fi mv $TOPDIR/SRPMS/baseiso-$iso_name$FLAVOR-$iso_version-$iso_build.src.rpm $TOPDIR/OTHER/ +if [ -e "$milestone_file" ]; then + for rpmpack in $TOPDIR/OTHER/*rpm ; do + test -e $rpmpack || continue + cp -a $milestone_file ${rpmpack%.rpm}.milestone + done +fi + -- 2.51.1