Date: Monday, September 19, 2022 @ 05:18:47
  Author: tpowa
Revision: 456444

upgpkg: hwdetect 2022.09-2: add riscv64 support

Modified:
  hwdetect/trunk/PKGBUILD
  hwdetect/trunk/hwdetect

----------+
 PKGBUILD |    4 ++--
 hwdetect |    7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2022-09-19 02:01:50 UTC (rev 456443)
+++ PKGBUILD    2022-09-19 05:18:47 UTC (rev 456444)
@@ -1,7 +1,7 @@
 # Maintainer: Tobias Powalowski <tp...@archlinux.org>
 pkgname=hwdetect
 pkgver=2022.09
-pkgrel=1
+pkgrel=2
 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=('69d10fc1d5e0386bfbe0763c6ce15852e5a528696d8fd81891fc670f0d9492b5853ec1181d967bcc4a0ab2d45741de951732f31effb2ff876f2f63df18aaaefe')
+sha512sums=('edb9909dc4c4696d993be8aa3f297fb12e7826fa18880af68a8a0cb862344e384a295e64407f321c23f33cd4736a442c1185dfe07762d9f4f3038029c0bd5fac')
 
 package() {
   install -D -m 755 "${srcdir}/hwdetect" "${pkgdir}/usr/bin/hwdetect"

Modified: hwdetect
===================================================================
--- hwdetect    2022-09-19 02:01:50 UTC (rev 456443)
+++ hwdetect    2022-09-19 05:18:47 UTC (rev 456444)
@@ -99,11 +99,12 @@
 
 kver() {
     # get kernel version from installed kernel
-    [[ "$(uname -m)" == "x86_64" ]] && VMLINUZ=/boot/vmlinuz-linux
+    [[ "$(uname -m)" == "x86_64" || "$(uname -m)" == "riscv64" ]] && 
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)
+        reader=cat
+        [[ $(file -b --mime-type "${VMLINUZ}") == 'application/gzip' ]] && 
reader=zcat
+        read _ _ kver _ < <($reader "${VMLINUZ}" | grep -m1 -aoE 'Linux 
version .(\.[-[:alnum:]]+)+')
     fi
     # fallback if no detectable kernel is installed
     [[ "${_HWKVER}" == "" ]] && _HWKVER="$(uname -r)"

Reply via email to