replace find with faster fd call

This commit is contained in:
Tobias Powalowski 2024-06-18 14:30:29 +02:00
parent 44f2dfe015
commit a945ae0bf3
4 changed files with 9 additions and 9 deletions

View file

@ -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!"

View file

@ -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
}

View file

@ -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

View file

@ -802,12 +802,12 @@ The calculated size to boot the image follows the formula:<br>
</tr>
<tr class="even">
<td>ROOTFS size in MiB</td>
<td class="MyYes">743</td>
<td class="MyYes">723</td>
<td class="MyNo">1900</td>
</tr>
<tr class="odd">
<td>ROOTFS packages</td>
<td class="MyYes">202</td>
<td class="MyYes">212</td>
<td class="MyNo">426</td>
</tr>
<tr class="even">