main/postmarketos-mkinitfs: remove initramfs-extra cache (!1133)

This commit is contained in:
Daniele Debernardi 2020-04-07 23:31:13 +02:00 committed by Bart Ribbers
parent e2ab2fcd47
commit 36f15b58f6
No known key found for this signature in database
GPG Key ID: 699D16185DAFAE61
2 changed files with 12 additions and 23 deletions

View File

@ -1,5 +1,5 @@
pkgname=postmarketos-mkinitfs
pkgver=0.10.1
pkgver=0.10.2
pkgrel=0
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
@ -26,4 +26,4 @@ package() {
sha512sums="1d49db8a48ad513cc548b8a0ea23cc64518e71c93863155b4e9d2271fb46090506331c03d6955d693c8568c248ecc76b218efe4a6f6bba57c41c5f6d775dc61b init.sh.in
315cc6e8a73f9984e6843395d68734d26ac2fffce34039ec5f229ebcd818bdb353318398d6c824cede5d0b36e13d7589a1f1d3295d8162279b5dc6a2b939da88 init_functions.sh
ca5689a3b15ccec4249b1c1fe110956b7119a7d159a289ac312b05447f2a469b8ec7731b6d29e0b232374eb4379cd1426b556dc31f09bd14b6fc6d1ae751b0c9 mkinitfs.sh"
02b484122ed5345fd84ccea20d62262aa6bffd775e5f424f24dc4de202705a235a9e1950b5ee8c80f039889fdf6864a798c15382867eed311363835e7b31126a mkinitfs.sh"

View File

@ -350,28 +350,17 @@ generate_initramfs_extra()
exit 1
fi
# Hash all input files for caching
initfs_extra_files=$(echo "$BINARIES_EXTRA$osk_conf" | xargs -0 -I{} sh -c 'ls $1 2>/dev/null' -- {} | sort -u)
initfs_extra_files_hashes="$(md5sum $initfs_extra_files)"
initfs_extra_hash="$(echo "$initfs_extra_files_hashes" | md5sum | awk '{ print $1 }')"
# Set up initramfs-extra in temp folder
tmpdir_extra=$(mktemp -d /tmp/mkinitfs.XXXXXX)
mkdir -p "$tmpdir_extra"
copy_files "$(get_binaries_extra)" "$tmpdir_extra"
copy_files "$osk_conf" "$tmpdir_extra"
create_cpio_image "$tmpdir_extra" "$1.new"
rm -rf "$tmpdir_extra"
# The hash is appended to the initramfs, check if up-to-date
if [ ! -f "$1" ] || [ "$initfs_extra_hash" != "$(tail -c 32 "$1")" ]; then
# Set up initramfs-extra in temp folder
tmpdir_extra=$(mktemp -d /tmp/mkinitfs.XXXXXX)
mkdir -p "$tmpdir_extra"
copy_files "$(get_binaries_extra)" "$tmpdir_extra"
copy_files "$osk_conf" "$tmpdir_extra"
create_cpio_image "$tmpdir_extra" "$1.new"
rm -rf "$tmpdir_extra"
# Append hash to initramfs (used to check if up-to-date)
echo -n "$initfs_extra_hash" >> "$1.new"
# Replace old initramfs-extra *after* we are done to make sure
# it does not become corrupted if something goes wrong.
mv "$1.new" "$1"
fi
# Replace old initramfs-extra *after* we are done to make sure
# it does not become corrupted if something goes wrong.
mv "$1.new" "$1"
}
# initialize