[arch-commits] Commit in hwdetect/trunk (PKGBUILD hwdetect)

Tobias Powalowski tpowa at gemini.archlinux.org
Fri Jan 28 06:29:38 UTC 2022


    Date: Friday, January 28, 2022 @ 06:29:38
  Author: tpowa
Revision: 435242

upgpkg: hwdetect 2022.01-3: add kernel fallback

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

----------+
 PKGBUILD |    4 ++--
 hwdetect |    9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-01-27 21:45:41 UTC (rev 435241)
+++ PKGBUILD	2022-01-28 06:29:38 UTC (rev 435242)
@@ -1,7 +1,7 @@
 # Maintainer: Tobias Powalowski <tpowa at archlinux.org>
 pkgname=hwdetect
 pkgver=2022.01
-pkgrel=2
+pkgrel=3
 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=('293e1b392bf97fdb9435cfb1ec829bef97d29aff5fb6c623744d959440350fd0b0bf78cc03a1d51799649109ac562c9974c642a9eadd575cd3a804443d8a9547')
+sha512sums=('e32e4cb06a501b7c9bff3b11c258a6cd98dab2a62b6746190e95aba8fa9e7d67bace29a2da99af50b1e7f61c77c4dd901701e9a746a220306159718f761ad60e')
 
 package() {
   install -D -m 755 "${srcdir}/hwdetect" "${pkgdir}/usr/bin/hwdetect"

Modified: hwdetect
===================================================================
--- hwdetect	2022-01-27 21:45:41 UTC (rev 435241)
+++ hwdetect	2022-01-28 06:29:38 UTC (rev 435242)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 # Autodetection script for scanning /sys for hardware
 # for Archlinux by Tobias Powalowski <tpowa at archlinux.org>
 
@@ -100,11 +100,13 @@
 }
 
 kver() {
-    # get kernel version
+    # 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 _HWKVER _ < <(dd if="/boot/${VMLINUZ}" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null)
+    read -r _HWKVER _ < <(dd if="/boot/${VMLINUZ}" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null)
+    # fallback if no detectable kernel is installed
+    [[ "${_HWKVER}" == "" ]] && _HWKVER="$(uname -r)"
 }
 
 parameter $PARAMETER
@@ -112,6 +114,7 @@
 if [ "$KERNEL_VERSION" = "" ]; then
         kver
 	KERNEL_VERSION="${_HWKVER}"
+	
 fi
 
 # dmraid switch



More information about the arch-commits mailing list