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

Tobias Powalowski tpowa at archlinux.org
Sat Apr 21 05:42:35 EDT 2012


    Date: Saturday, April 21, 2012 @ 05:42:34
  Author: tpowa
Revision: 156580

upgpkg: hwdetect 2012.04-2

cleanup and fix many things

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

----------+
 PKGBUILD |    4 +--
 hwdetect |   62 ++++++++++++++++++++++++++-----------------------------------
 2 files changed, 29 insertions(+), 37 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2012-04-21 07:48:29 UTC (rev 156579)
+++ PKGBUILD	2012-04-21 09:42:34 UTC (rev 156580)
@@ -2,7 +2,7 @@
 # Maintainer: Tobias Powalowski <tpowa at archlinux.org>
 pkgname=hwdetect
 pkgver=2012.04
-pkgrel=1
+pkgrel=2
 pkgdesc="Hardware detection script with loading modules and mkinitcpio.conf / rc.conf support"
 arch=(any)
 license=('GPL')
@@ -16,4 +16,4 @@
 build() {
   install -D -m 755 ${srcdir}/hwdetect ${pkgdir}/sbin/hwdetect
 }
-md5sums=('bd84fbd91a00a86c0d3a4c8f72377a2b')
+md5sums=('e442044d3e9fbaf2927a6fe62a40975e')

Modified: hwdetect
===================================================================
--- hwdetect	2012-04-21 07:48:29 UTC (rev 156579)
+++ hwdetect	2012-04-21 09:42:34 UTC (rev 156580)
@@ -68,19 +68,30 @@
 [ "$1" = "--help" ] && usage
 [ "$1" = "-h" ]     && usage
 
-# setting kernel version
-case $1 in
-       --kernel_directory=*)
-	KERNEL_DIRECTORY="$(echo $1 | awk -F= '{print $2;}')"
-	;;
-	--kernel_version=*)
-	KERNEL_VERSION="$(echo $1 | awk -F= '{print $2;}')"
-	;;
-	--rootdevice=*)
-	ROOTDEVICE="$(echo $1 | awk -F= '{print $2;}')"
-	;;
-esac
+# setting parameters
+PARAMETER="$(echo $*)"
+parameter() {
+	while [ -n "$1" ]; do
+		case $1 in
+			--kernel_directory=*)
+			KERNEL_DIRECTORY="$(echo $1 | awk -F= '{print $2;}')"
+			;;
+			--kernel_version=*)
+			KERNEL_VERSION="$(echo $1 | awk -F= '{print $2;}')"
+			;;
+			--rootdevice=*)
+			ROOTDEVICE="$(echo $1 | awk -F= '{print $2;}')"
+			;;
+			-hooks-dir=*|--hooks-dir=*)
+			HOOKS_DIR="$(echo $1 | awk -F= '{print $2;}')"
+			;;
+		esac
+		shift
+	done
+}
 
+parameter $PARAMETER
+
 if [ "$KERNEL_VERSION" = "" ]; then
 	KERNEL_VERSION="$(uname -r)"
 fi
@@ -221,12 +232,6 @@
 	fi
 fi
 
-# checking /sys
-if ! [ -d /sys/ ]; then
-	echo "/sys/ is not present -- mount /sys first" >&2
-	exit 1
-fi
-
 : >/tmp/modules-plain
 : >/tmp/modules-stripped
 : >/tmp/modules-sorted
@@ -234,17 +239,11 @@
 : >/tmp/.blkid
 
 # generate blkid
-/sbin/blkid -c /dev/null -s TYPE > /tmp/.blkid
+blkid -c /dev/null -s TYPE > /tmp/.blkid
 
 # find pci aliases
 aliases=$(find /sys/ -noleaf -name modalias  -exec cat {} +)
 
-# check for empty aliases
-if [ "$aliases" = "" ]; then
-	echo "hwdetect aborted -- you need a kernel >= 2.6.12" >&2
-	exit 1
-fi
-
 # generate files for the different actions
 modprobe -i -a --dirname=$KERNEL_DIRECTORY --set-version=$KERNEL_VERSION --show-depends $aliases >> /tmp/modules-plain 2>/dev/null
 
@@ -389,19 +388,12 @@
 }
 
 # starting different actions
-while [ $# -gt 0 ]; do
+while [ -n "$*"  ]; do
 	case $1 in
-		-hooks-dir=*|--hooks-dir=*)
-			HOOKS_DIR="$(echo $1 | awk -F= '{print $2;}')"
-			 ;;
 		--load-modules)
 			# load all detected pci modules
 			for i in $(cat /tmp/moduleslist); do
-				if [ -e /lib/udev/load-modules.sh ]; then 
-					/lib/udev/load-modules.sh $i > /dev/null 2>&1
-				else
-					modprobe $i > /dev/null 2>&1
-				fi
+				modprobe $i > /dev/null 2>&1
 			done
 			;;
 
@@ -513,7 +505,7 @@
 			 ;;
 		--hooks) 
 			if [ "$HOOKS_DIR" = "" ]; then
-				HOOKS_DIR="/lib/initcpio/install"
+				HOOKS_DIR="/usr/lib/initcpio/install"
 			fi
 			START_HOOKS="base v86d udev keymap fsck autodetect ide pata scsi sata usb fw pcmcia net dmraid usbinput $ADVANCED btrfs filesystems shutdown"
 			# remove the ones that don't exist on the system



More information about the arch-commits mailing list