postmarketos-mkinitfs: flashing: fix wrong flavor (MR 2401)

The flavor string was naively parsed using sed by removing everything
before the first hyphen, this breaks for -rc kernels. Instead lets glob
/usr/share/kernel for the installed kernel flavor. This will also
prevent the kernel being flashed if the running kernel has a different
localversion than the updated one.

[ci:skip-build] already built successfully in CI
This commit is contained in:
Caleb Connolly 2021-08-01 18:12:26 +01:00 committed by Clayton Craft
parent 4baa805b41
commit 3e86acc9d9
No known key found for this signature in database
GPG key ID: 7A3461CA187CEA54
2 changed files with 14 additions and 5 deletions

View file

@ -1,6 +1,6 @@
# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org> # Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
pkgname=postmarketos-mkinitfs pkgname=postmarketos-mkinitfs
pkgver=0.28 pkgver=0.29
pkgrel=0 pkgrel=0
pkgdesc="Tool to generate initramfs images for postmarketOS" pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org" url="https://postmarketos.org"
@ -56,6 +56,6 @@ sha512sums="
1a267dd958609263a4f24657f602ac0e4e0c724bf1284adec85e82d05c9b07553085edea5a56f7fa09d1652af232c72d4d39a06858c2a580ff830577b5f37d67 init.sh.in 1a267dd958609263a4f24657f602ac0e4e0c724bf1284adec85e82d05c9b07553085edea5a56f7fa09d1652af232c72d4d39a06858c2a580ff830577b5f37d67 init.sh.in
daf8bbc02e0dc18dda653d1b25cac985c5ff66568eec7a379857b606843b94f03855d47ded2aff801015ec3c9e2cf90f646dc7deaaef23d373c2ff2b9bbfa435 init_functions.sh daf8bbc02e0dc18dda653d1b25cac985c5ff66568eec7a379857b606843b94f03855d47ded2aff801015ec3c9e2cf90f646dc7deaaef23d373c2ff2b9bbfa435 init_functions.sh
54c8ea6c4b5313c0ca82bbc40498a35d4b5cbcdbf950dc01b5025238ea6b8caa2f9a9ee57a269fb78673fbcac186c33243188458ecda45deb3354d5d8a77fdfe mkinitfs.sh 54c8ea6c4b5313c0ca82bbc40498a35d4b5cbcdbf950dc01b5025238ea6b8caa2f9a9ee57a269fb78673fbcac186c33243188458ecda45deb3354d5d8a77fdfe mkinitfs.sh
6b8de5dc13aef9c8090bc4e307b142887e4e3bf1851fe498845be64f7d1ba65d243c1bcb29fbd1b108be2a5067349be1461838573505c9d23e06a680265a4ec3 mkinitfs_functions.sh b653f5cfe3ef2616b7335f53204fd79f3859be24f40c7a76e1c3b4f9692b9dfe82106a0aeb3b3fb82a8edff3c11795251197287a73817d4ec31321a558cb8613 mkinitfs_functions.sh
c7a3c33daeb12b33ac72207191941c4d634f15c22958273b52af381a70ebaba1d3a9299483f0c447d9e66c560151fe7b9588bb4bbef2c8914f83185984ee4622 mkinitfs_test.sh c7a3c33daeb12b33ac72207191941c4d634f15c22958273b52af381a70ebaba1d3a9299483f0c447d9e66c560151fe7b9588bb4bbef2c8914f83185984ee4622 mkinitfs_test.sh
" "

View file

@ -447,9 +447,18 @@ flash_updated_boot_parts()
return return
fi fi
echo "==> Flashing boot image" # We assume here that the device only has a single kernel
flavor=$(uname -r | sed "s/^[^-]*-//") # package installed and that it is also the one being upgraded.
pmos-update-kernel "$flavor" FLAVOR="$(basename "$(find /usr/share/kernel/* -type d -print -quit)")"
if [ -z "$FLAVOR" ]; then
echo "==> Couldn't determine flavor, are you running the stock kernel?"
return
fi
echo "==> Flashing boot image flavor: $FLAVOR"
pmos-update-kernel "$FLAVOR"
} }
# Append the correct device tree to the linux image file or copy the dtb to the boot partition # Append the correct device tree to the linux image file or copy the dtb to the boot partition