Package: laptop-mode-tools
Version: 1.47-1
Severity: normal

        I bumped in to the same issue the previous poster did.  So I cobbled
together a patch that should handle the transition from 'udevinfo' to
'udevadm'.  It seems to work for me, but it hasn't undergone especially
rigorous testing.

                                        Schwab


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.29 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages laptop-mode-tools depends on:
ii  lsb-base                      3.2-22     Linux Standard Base 3.2 init scrip
ii  psmisc                        22.6-1     Utilities that use the proc filesy
ii  util-linux                    2.13.1.1-1 Miscellaneous system utilities

Versions of packages laptop-mode-tools recommends:
pn  acpid | apmd <none>                      (no description available)
ii  ethtool      6+20090307-1                display or change Ethernet device 
ii  hal          0.5.12~git20090406.46dc48-1 Hardware Abstraction Layer
ii  hdparm       9.12-2                      tune hard disk parameters for high
ii  sdparm       1.02-1                      Output and modify SCSI device para

laptop-mode-tools suggests no packages.

-- no debconf information
--- hdparm.orig 2009-04-17 03:00:43.000000000 -0700
+++ hdparm      2009-04-18 17:45:37.000000000 -0700
@@ -20,9 +20,9 @@ is_capable() {
 
        # If we are running udev, this is the most portable way
        # It assumes more or less recent udev (> 070)
-       if [ $HAVE_UDEVINFO -ne 0 ] ; then
-               $LM_VERBOSE && echo -n "Querying $1 media type using udevinfo: 
" >> $OUTPUT
-               eval "$(udevinfo -q env -n $1 2>> $OUTPUT | egrep 
'(ID_TYPE=|ID_BUS=)' 2>&1 | tee -a $OUTPUT)"
+       if [ $HAVE_UDEVCMD -ne 0 ] ; then
+               $LM_VERBOSE && echo -n "Querying $1 media type using 
$(UDEVCMD): " >> $OUTPUT
+               eval "$($UDEVCMD_QUERYNAME $1 2>> $OUTPUT | egrep 
'(ID_TYPE=|ID_BUS=)' 2>&1 | tee -a $OUTPUT)"
                if [ -n "$ID_TYPE" -a -n "$ID_BUS" ] ; then
                        $LM_VERBOSE && echo "type '$ID_TYPE' on bus '$ID_BUS' 
detected" >> $OUTPUT
                        MEDIA=$ID_TYPE
@@ -129,13 +129,23 @@ fi
 if [ -x "$(which sdparm 2> /dev/null)" ]; then
   SDPARM_AVAILABLE=1
 fi
-HAVE_UDEVINFO=0
-if [ -x "$(which udevinfo 2> /dev/null)" ] ; then
-       UDEVVERSION=$(udevinfo -V | awk '{ print $3; }')
+# Prefer 'udevadm' over 'udevinfo', which is deprecated.
+HAVE_UDEVCMD=0
+if [ -x "$(which udevadm 2> /dev/null)" ] ; then
+       UDEVCMD="udevadm"
+       UDEVCMD_VERSION="udevadm info --version"
+       UDEVCMD_QUERYNAME="udevadm info --query=env --name"
+elif [ -x "$(which udevinfo 2> /dev/null)" ] ; then
+       UDEVCMD="udevinfo"
+       UDEVCMD_VERSION="udevinfo -V | awk '{ print $3; }'"
+       UDEVCMD_QUERYNAME="udevinfo -q env -n"
+fi
+if [ -n "$UDEVCMD" ]; then
+       UDEVVERSION=$($UDEVCMD_VERSION)
        if [ "$UDEVVERSION" -gt 70 ] ; then
-               HAVE_UDEVINFO=1
+               HAVE_UDEVCMD=1
        else
-               $LM_VERBOSE && echo "udevinfo present but version not > 070, 
not using udev" >> $OUTPUT
+               $LM_VERBOSE && echo "$(UDEVCMD) present but version not > 070, 
not using udev" >> $OUTPUT
        fi
 fi
 

Reply via email to