[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:
>> I plan to commit this cuple of packages tomorrow, if noone objects, to
>> address the laptop-detect issue.
>>
>> This changes laptop-detect from a dependency, on tasksel, to a
>> recommendation and let d-i to install it. This way we avoid the
>> changing of tasksel to architecture dependent package and solves the
>> problem of getting laptop-detect installed on every arch.
>
> 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.

1. http://git.debian.org/?p=collab-maint/laptop-detect.git;a=blob;f=laptop-detect.in

> 2) I think the log message for non-laptop arches is redundant.

Yes, I think it makes sense to remove it.

> 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.

New patches attached.
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,10 @@
   [ 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.
+
   [ Translations of tasks ]
   * Portuguese updated.
   * Galician updated.
@@ -15,7 +19,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 [ -x "`which laptop-detect 2>/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 [ -x "`which laptop-detect 2>/dev/null`" ] && \
+		laptop-detect; then
 		# Nearly always appropriate to include a desktop.
 		return 0
 	else
>From df5354ee2872e3e5491022fceaec29198dce0630 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,
powerpc and sparc (few but they exist) 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             |    7 ++++++-
 packages/pkgsel/debian/rules                 |    1 +
 packages/pkgsel/pre-pkgsel.d/10laptop-detect |    8 ++++++++
 3 files changed, 15 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..a884bee 100644
--- a/packages/pkgsel/debian/changelog
+++ b/packages/pkgsel/debian/changelog
@@ -1,10 +1,15 @@
 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, sparc 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..e077a5f
--- /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/*|sparc/*)
+	    apt-install laptop-detect || true
+	    ;;
+esac
-- 
1.5.4


-- 
        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: