From a945ae0bf3fd07d8bd10cb564f7ec5364f0f6550 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Tue, 18 Jun 2024 14:30:29 +0200 Subject: [PATCH] replace find with faster fd call --- usr/lib/archboot/cpio/cpio.sh | 4 ++-- usr/lib/archboot/iso.sh | 6 +++--- usr/lib/archboot/release.sh | 4 ++-- usr/share/archboot/doc/archboot.html | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/usr/lib/archboot/cpio/cpio.sh b/usr/lib/archboot/cpio/cpio.sh index 69f153614..25a892dad 100644 --- a/usr/lib/archboot/cpio/cpio.sh +++ b/usr/lib/archboot/cpio/cpio.sh @@ -249,9 +249,9 @@ _create_cpio() { echo "Creating zstd compressed image..." pushd "${_ROOTFS}" >"${_NO_LOG}" || return # Reproducibility: set all timestamps to 0 - find . -mindepth 1 -execdir touch -hcd "@0" "{}" + + fd . -u --min-depth 1 -X touch -hcd "@0" # use zstd only it has best compression and decompression - find . -mindepth 1 -printf '%P\0' | sort -z | + fd . -u --min-depth 1 -0 | sort -z | LANG=C bsdtar --null -cnf - -T - | LANG=C bsdtar --null -cf - --format=newc @- | zstd -T0 -19 > "${_GENERATE_IMAGE}" || _abort "Image creation failed!" diff --git a/usr/lib/archboot/iso.sh b/usr/lib/archboot/iso.sh index e5adad401..4db3c6085 100644 --- a/usr/lib/archboot/iso.sh +++ b/usr/lib/archboot/iso.sh @@ -178,7 +178,7 @@ _prepare_background() { _reproducibility() { # Reproducibility: set all timestamps to 0 # from /usr/bin/mkinitcpio - find "${_ISODIR}" -mindepth 1 -execdir touch -hcd "@0" "{}" + + fd . "${_ISODIR}" -u --min-depth 1 -X touch -hcd "@0" } _prepare_uefi_image() { @@ -193,10 +193,10 @@ _prepare_uefi_image() { mcopy -m -i "${VFAT_IMAGE}" -s "${_ISODIR}"/EFI "${_ISODIR}"/boot ::/ # leave EFI/ and /boot/kernel for virtualbox and other restricted VM emulators :( if [[ "${_ARCH}" == "x86_64" || "${_ARCH}" == "riscv64" ]]; then - find "${_ISODIR}"/boot/* ! -name "vmlinuz-${_ARCH}" -delete + fd -u -t f -E "vmlinuz-${_ARCH}" . "${_ISODIR}"/boot/ -X rm fi if [[ "${_ARCH}" == "aarch64" ]]; then - find "${_ISODIR}"/boot/* ! -name "Image-${_ARCH}.gz" -delete + fd -u -t f -E "Image-${_ARCH}.gz" . "${_ISODIR}"/boot/ -X rm fi } diff --git a/usr/lib/archboot/release.sh b/usr/lib/archboot/release.sh index 2ab899471..8e5d073db 100644 --- a/usr/lib/archboot/release.sh +++ b/usr/lib/archboot/release.sh @@ -35,9 +35,9 @@ _compress_initrd() { echo "Creating zstd compressed image: ${1}" pushd "${_W_DIR}/tmp/initrd" >"${_NO_LOG}" || return # Reproducibility: set all timestamps to 0 - find . -mindepth 1 -execdir touch -hcd "@0" "{}" + + fd . -u --min-depth 1 -X touch -hcd "@0" # use zstd only it has best compression and decompression - find . -mindepth 1 -printf '%P\0' | sort -z | + fd . -u --min-depth 1 -0 | sort -z | LANG=C bsdtar --null -cnf - -T - | LANG=C bsdtar --null -cf - --format=newc @- | zstd -T0 -19 > "../../${1}" || exit 1 diff --git a/usr/share/archboot/doc/archboot.html b/usr/share/archboot/doc/archboot.html index 7f40a5b46..f4ae4971c 100644 --- a/usr/share/archboot/doc/archboot.html +++ b/usr/share/archboot/doc/archboot.html @@ -802,12 +802,12 @@ The calculated size to boot the image follows the formula:
ROOTFS size in MiB -743 +723 1900 ROOTFS packages -202 +212 426