From 6c486b1a3b2918e6ee955b4e70dc6d0081ed01a5 Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Sun, 19 Feb 2023 15:41:17 +0400 Subject: [PATCH] Fix build with Docker --- = | 0 build.sh | 15 +++++++++++++-- debootstrap-backport-zstd-support.patch | 18 ++++++++++++++++++ etc/auto/config | 1 + live-build-fix-shim-remove.patch | 16 ++++++++++++++++ 5 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 = create mode 100644 debootstrap-backport-zstd-support.patch create mode 100644 live-build-fix-shim-remove.patch diff --git a/= b/= new file mode 100644 index 0000000..e69de29 diff --git a/build.sh b/build.sh index ccd36d0..6da09d1 100755 --- a/build.sh +++ b/build.sh @@ -27,16 +27,27 @@ echo -e " " # Use system live-build if running on Debian +apt-get update && apt-get install -y lsb-release + dist="$(lsb_release -i -s)" if [ $dist == "Debian" ]; then - apt-get install -y binutils zstd live-build + apt-get install -y binutils patch zstd live-build dpkg -i ./debs/ubuntu-keyring*.deb else - apt-get install -y binutils zstd debootstrap + apt-get install -y binutils patch zstd debootstrap dpkg -i ./debs/*.deb fi +# TODO: This patch was submitted upstream at: +# https://salsa.debian.org/live-team/live-build/-/merge_requests/255 +# This can be removed when our Debian container has a version containing this fix +patch -d /usr/lib/live/build/ < live-build-fix-shim-remove.patch + +# TODO: This can be removed when our Debian container has debootstrap 1.0.124 or later +# It's needed to support the new zstd .deb package compression that Ubuntu is doing +patch -d /usr/share/debootstrap/ < debootstrap-backport-zstd-support.patch + # Increase number of blocks for creating efi.img. # This prevents error with "Disk full" on the lb binary_grub-efi stage patch -d /usr/lib/live/build/ < increase_number_of_blocks.patch diff --git a/debootstrap-backport-zstd-support.patch b/debootstrap-backport-zstd-support.patch new file mode 100644 index 0000000..16d8765 --- /dev/null +++ b/debootstrap-backport-zstd-support.patch @@ -0,0 +1,18 @@ +--- /usr/share/debootstrap/functions.orig 2021-10-23 23:13:10.576805331 +0000 ++++ /usr/share/debootstrap/functions 2021-10-23 23:14:05.465350379 +0000 +@@ -974,6 +974,7 @@ + case "$tarball" in + control.tar.gz) cat_cmd=zcat ;; + control.tar.xz) cat_cmd=xzcat ;; ++ control.tar.zst) cat_cmd=zstdcat ;; + control.tar) cat_cmd=cat ;; + *) error 1 UNKNOWNCONTROLCOMP "Unknown compression type for %s in %s" "$tarball" "$pkg" ;; + esac +@@ -996,6 +997,7 @@ + data.tar.gz) cat_cmd=zcat ;; + data.tar.bz2) cat_cmd=bzcat ;; + data.tar.xz) cat_cmd=xzcat ;; ++ data.tar.zst) cat_cmd=zstdcat ;; + data.tar) cat_cmd=cat ;; + *) error 1 UNKNOWNDATACOMP "Unknown compression type for %s in %s" "$tarball" "$pkg" ;; + esac diff --git a/etc/auto/config b/etc/auto/config index a3206db..13c94f7 100755 --- a/etc/auto/config +++ b/etc/auto/config @@ -44,6 +44,7 @@ lb config noauto \ --zsync false \ --security true \ --updates true \ + --debootstrap-options="--extractor=ar" \ "${@}" # replace channel and suite diff --git a/live-build-fix-shim-remove.patch b/live-build-fix-shim-remove.patch new file mode 100644 index 0000000..7ec099e --- /dev/null +++ b/live-build-fix-shim-remove.patch @@ -0,0 +1,16 @@ +--- binary_grub-efi 2021-04-02 15:43:54.000000000 +0000 ++++ binary_grub-efi_v2 2021-10-23 22:43:57.314540341 +0000 +@@ -280,8 +280,12 @@ + # Saving cache + Save_package_cache binary + +- # Removing depends ++ # Removing depends, some bootloader packages are marked as Protected/Important ++ # in Ubuntu, so temporarily add an apt flag to allow them to be removed ++ PRE_APT_OPTIONS="${APT_OPTIONS}" ++ APT_OPTIONS="${APT_OPTIONS} --allow-remove-essential" + Remove_packages ++ APT_OPTIONS="${PRE_APT_OPTIONS}" + ;; + + false)