Retitle 381957 dmidecode check could be simplified
Tags 381957 + patch
Thanks

Hi.

I just wanted to note that laptop-detect would work on a sarge system
as-id, while it won't do so when it used the --string option to
dmidecode. This is not to say that it shouldn't use the easier
commandline the --string option allows for, just that it would need a
versioned depends on dmidecode if it did.

I patched laptop-detect accordingly and attached the patch to this mail.

Regards,
Sven
diff -urN laptop-detect-0.12.1.debian-orig/debian/rules 
laptop-detect-0.12.1.simplified/debian/rules
--- laptop-detect-0.12.1.debian-orig/debian/rules       2005-06-14 
12:37:13.000000000 +0200
+++ laptop-detect-0.12.1.simplified/debian/rules        2006-08-09 
02:43:43.230298032 +0200
@@ -5,13 +5,13 @@
 
 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
 ifeq ($(DEB_HOST_ARCH),i386)
-dmidecode-depends := -V'dmidecode-depends=dmidecode'
-dmidecode-udeb-depends := -V'dmidecode-depends=dmidecode-udeb'
+dmidecode-depends := -V'dmidecode-depends=dmidecode (>2.8)'
+dmidecode-udeb-depends := -V'dmidecode-depends=dmidecode-udeb (>2.8)'
 endif
 
 ifeq ($(DEB_HOST_ARCH),amd64)
-dmidecode-depends := -V'dmidecode-depends=dmidecode'
-dmidecode-udeb-depends := -V'dmidecode-depends=dmidecode-udeb'
+dmidecode-depends := -V'dmidecode-depends=dmidecode (>2.8)'
+dmidecode-udeb-depends := -V'dmidecode-depends=dmidecode-udeb (>2.8)'
 endif
 
 PACKAGE=$(shell dh_listpackages | grep -- -udeb$$)
diff -urN laptop-detect-0.12.1.debian-orig/laptop-detect.sh 
laptop-detect-0.12.1.simplified/laptop-detect.sh
--- laptop-detect-0.12.1.debian-orig/laptop-detect.sh   2005-06-14 
12:37:13.000000000 +0200
+++ laptop-detect-0.12.1.simplified/laptop-detect.sh    2006-08-09 
02:41:42.049122461 +0200
@@ -4,7 +4,7 @@
 if test -d /proc/pmu; then
         batteries=$(grep Battery /proc/pmu/info| cut -f2 -d:)
         if test "$batteries" -ne 0; then
-#                echo "We're a laptop" &>2;
+#                echo "We're a laptop" >&2;
                 exit 0
         fi
         exit 1
@@ -12,7 +12,7 @@
 
 if [ -x /usr/sbin/dmidecode ]; then
         # dmidecode to grab the Chassis type
-        dmitype=$(dmidecode|grep Chassis -A 10|grep -m1 Type|sed -e 's/.*Type: 
\(.*\)/\1/')
+        dmitype=$(dmidecode --string chassis-type)
 
         if test "$dmitype" = "Notebook" || test "$dmitype" = "Portable"; then
 #               echo "We're a laptop" >&2;

Reply via email to