[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [RFC] laptop-detect being installed just on useful architectures



Frans Pop <elendil@planet.nl> writes:

> On Friday 08 February 2008, Otavio Salvador wrote:
>> > 1) You did not answer my question whether laptop-detect really supports
>> >    sparc. If it does not, we should not install it there (and
>> > laptop-detect should not be built for sparc).
>>
>> It does, if kernel does.
>>
>> Currently laptop-detect checks dmi and if there're batteries[1] on the
>> system, in those cases, it guess it's a laptop.
>
> I still have some doubts whether it really makes sense to install it. I 
> expect 99.999% of sparc systems that get Debian installed will be either 
> workstations or, even much more likely, servers.
> Have you ever actually _seen_ someone with a sparc laptop?

I didn't. I have no strong opinion about keep it or not. I'm ok to
drop it by now.

<...>
>> > 3) The laptop test in tasksel should be modified to _first_ test
>> > whether laptop-detect exists or not. As it is now it will barf errors.
>>
>> I found it in two places and changed both them.
>
> 1) The test checks whether laptop-detect is executable twice as which
>    itself already does that.

Right. 

> 2) The test will still produce output.

Right. I've also fixed dmidecode test too to avoid same problems
there.

New patches again.
>From ab359fed12ccdf40e0a90c819f61e6fe446ffc6c Mon Sep 17 00:00:00 2001
From: Otavio Salvador <otavio@ossystems.com.br>
Date: Fri, 8 Feb 2008 10:03:50 -0200
Subject: [PATCH] pkgsel: installs laptop-detect on architectures know to have laptops

The architectures that're know to have laptops are i386, amd64 and
powerpc and then we install laptop-detect only on those.

This change will just work if tasksel newer then 2.72 is used.
---
 packages/pkgsel/debian/changelog             |    6 +++++-
 packages/pkgsel/debian/rules                 |    1 +
 packages/pkgsel/pre-pkgsel.d/10laptop-detect |    8 ++++++++
 3 files changed, 14 insertions(+), 1 deletions(-)
 create mode 100755 packages/pkgsel/pre-pkgsel.d/10laptop-detect

diff --git a/packages/pkgsel/debian/changelog b/packages/pkgsel/debian/changelog
index a87fd7f..ca92b06 100644
--- a/packages/pkgsel/debian/changelog
+++ b/packages/pkgsel/debian/changelog
@@ -1,10 +1,14 @@
 pkgsel (0.17) UNRELEASED; urgency=low
 
+  [ Colin Watson ]
   * Pass pkgsel/include to aptitude following "--" to prevent typos in
     preseed files being interpreted as aptitude options by accident.
   * Silence syslog noise if /usr/lib/pre-pkgsel.d is empty.
 
- -- Colin Watson <cjwatson@debian.org>  Thu, 10 Jan 2008 09:41:19 +0000
+  [ Otavio Salvador ]
+  * Install laptop-detect only when running at i386, amd64 and powerpc.
+
+ -- Otavio Salvador <otavio@ossystems.com.br>  Fri, 08 Feb 2008 10:07:05 -0200
 
 pkgsel (0.16) unstable; urgency=low
 
diff --git a/packages/pkgsel/debian/rules b/packages/pkgsel/debian/rules
index cc7ed2f..fff0e80 100755
--- a/packages/pkgsel/debian/rules
+++ b/packages/pkgsel/debian/rules
@@ -14,6 +14,7 @@ install: build
 	dh_clean -k
 	dh_installdirs
 	install -m755 pre-pkgsel.d/10popcon debian/pkgsel/usr/lib/pre-pkgsel.d
+	install -m755 pre-pkgsel.d/10laptop-detect debian/pkgsel/usr/lib/pre-pkgsel.d
 	dh_install
 
 binary-indep: build install
diff --git a/packages/pkgsel/pre-pkgsel.d/10laptop-detect b/packages/pkgsel/pre-pkgsel.d/10laptop-detect
new file mode 100755
index 0000000..b5f95c9
--- /dev/null
+++ b/packages/pkgsel/pre-pkgsel.d/10laptop-detect
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+
+# Install laptop-detect on architectures know to have laptops
+case "$(archdetect)" in
+	i386/*|amd64/*|powerpc/*)
+	    apt-install laptop-detect || true
+	    ;;
+esac
-- 
1.5.4

Index: debian/control
===================================================================
--- debian/control	(revisão 2058)
+++ debian/control	(cópia de trabalho)
@@ -17,7 +17,8 @@
 
 Package: tasksel-data
 Architecture: all
-Depends: tasksel, laptop-detect
+Depends: tasksel
+Recommends: laptop-detect
 Conflicts: tasksel (<< 2.67)
 Description: Official tasks used for installation of Debian systems
  This package contains data about the standard tasks available on a Debian
Index: debian/changelog
===================================================================
--- debian/changelog	(revisão 2058)
+++ debian/changelog	(cópia de trabalho)
@@ -3,6 +3,11 @@
   [ Joey Hess ]
   * Add smartmontools to the file-server task.
 
+  [ Otavio Salvador ]
+  * Change laptop-detect from a dependency to a recommendation. It will be
+    installed by d-i on specific architectures.
+  * Change desktop test to avoid testing twice if dmidecode is executable.
+
   [ Translations of tasks ]
   * Portuguese updated.
   * Galician updated.
@@ -15,7 +20,7 @@
   * Lithuanian updated.
   * Korean updated.
 
- -- Bart Cornelis (cobaco) <cobaco@linux.be>  Sat, 12 Jan 2008 18:00:12 +0100
+ -- Otavio Salvador <otavio@debian.org>  Fri, 08 Feb 2008 10:13:49 -0200
 
 tasksel (2.71) unstable; urgency=low
 
Index: tests/laptop
===================================================================
--- tests/laptop	(revisão 2058)
+++ tests/laptop	(cópia de trabalho)
@@ -2,7 +2,8 @@
 # Causes a task to be selected if the machine appears to be a laptop.
 
 if [ "$NEW_INSTALL" ]; then
-	if laptop-detect; then
+	if which laptop-detect >/dev/null && \
+		laptop-detect; then
 		exit 2 # mark for install
 	else
 		exit 3 # do not mark for install
Index: tests/desktop
===================================================================
--- tests/desktop	(revisão 2058)
+++ tests/desktop	(cópia de trabalho)
@@ -69,7 +69,8 @@
 }
 
 desktop_hardware () {
-	if laptop-detect; then
+	if which laptop-detect >/dev/null && \
+		laptop-detect; then
 		# Nearly always appropriate to include a desktop.
 		return 0
 	else
@@ -82,7 +83,7 @@
 }
 
 rack_hardware () {
-	if [ -x "`which dmidecode 2>/dev/null`" ] && \
+	if which dmidecode >/dev/null && \
 		dmidecode | grep -q 'Type: Rack Mount Chassis'; then
 		return 0
 	fi

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio@debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."

Reply to: