Date: Friday, January 28, 2022 @ 06:34:59 Author: tpowa Revision: 435244
upgpkg: hwdetect 2022.01-4: add check for kernel files Modified: hwdetect/trunk/PKGBUILD hwdetect/trunk/hwdetect ----------+ PKGBUILD | 4 ++-- hwdetect | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-01-28 06:29:54 UTC (rev 435243) +++ PKGBUILD 2022-01-28 06:34:59 UTC (rev 435244) @@ -1,7 +1,7 @@ # Maintainer: Tobias Powalowski <[email protected]> pkgname=hwdetect pkgver=2022.01 -pkgrel=3 +pkgrel=4 pkgdesc="Hardware detection script with loading modules and mkinitcpio.conf" arch=(any) url="https://archlinux.org/packages/extra/any/hwdetect/" @@ -12,7 +12,7 @@ 'lvm2: for lvm2 mkinitcpio config support' 'mdadm: for raid mkinitcpio config support') source=(hwdetect) -sha512sums=('e32e4cb06a501b7c9bff3b11c258a6cd98dab2a62b6746190e95aba8fa9e7d67bace29a2da99af50b1e7f61c77c4dd901701e9a746a220306159718f761ad60e') +sha512sums=('0c53f8b18c3ba88af0a0d972118ca56d4c58254255c5976bf7ceb64f93e3ad47292eb6456c923a08b6a80fe1b4f6cffe94264998a8a042687f666d0e863b8049') package() { install -D -m 755 "${srcdir}/hwdetect" "${pkgdir}/usr/bin/hwdetect" Modified: hwdetect =================================================================== --- hwdetect 2022-01-28 06:29:54 UTC (rev 435243) +++ hwdetect 2022-01-28 06:34:59 UTC (rev 435244) @@ -101,10 +101,12 @@ kver() { # get kernel version from installed kernel - [[ "$(uname -m)" == "x86_64" ]] && VMLINUZ=vmlinuz-linux - [[ "$(uname -m)" == "aarch64" ]] && VMLINUZ=Image - offset=$(hexdump -s 526 -n 2 -e '"%0d"' "/boot/${VMLINUZ}") - read -r _HWKVER _ < <(dd if="/boot/${VMLINUZ}" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null) + [[ "$(uname -m)" == "x86_64" ]] && VMLINUZ=/boot/vmlinuz-linux + [[ "$(uname -m)" == "aarch64" ]] && VMLINUZ=/boot/Image + if [[ -f "${VMLINUZ}" ]]; then + offset=$(hexdump -s 526 -n 2 -e '"%0d"' "${VMLINUZ}") + read -r _HWKVER _ < <(dd if="${VMLINUZ}" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null) + fi # fallback if no detectable kernel is installed [[ "${_HWKVER}" == "" ]] && _HWKVER="$(uname -r)" }
