Bug#498052: do not call hdparm with empty device list

2008-09-06 Thread Thomas Lange
Package: fai-client
Version: 3.2.9

The subruotines task_setup() tries to detect all cdroms and then calls
hdparm for every cdrom device. If this list is empty hdparm is called
the wrong way is prints is long help.

-- 
regards Thomas



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#498052: do not call hdparm with empty device list

2008-09-06 Thread Sebastian Harl
tags 498052 + patch
thanks

Hi,

On Sat, Sep 06, 2008 at 07:02:09PM +0200, Thomas Lange wrote:
 The subruotines task_setup() tries to detect all cdroms and then calls
 hdparm for every cdrom device. If this list is empty hdparm is called
 the wrong way is prints is long help.

The attached patch should fix this issue.

Cheers,
Sebastian

-- 
Sebastian tokkee Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin

From 85dda5b9976bc5e16594856c23dd926c11346492 Mon Sep 17 00:00:00 2001
From: Sebastian Harl [EMAIL PROTECTED]
Date: Sat, 6 Sep 2008 19:58:45 +0200
Subject: [PATCH] lib/subroutines: task_setup(): Warn, if no CD-ROM's have been found.

---
 lib/subroutines |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/subroutines b/lib/subroutines
index d6c0e9f..b35a03e 100644
--- a/lib/subroutines
+++ b/lib/subroutines
@@ -231,9 +231,13 @@ task_setup() {
 
 if [ -f /boot/RUNNING_FROM_FAICD ]; then
 	local cdrom=$(mount| awk '/dev.+on \/ /{print $1}')
-	hdparm -d $cdrom | grep -q off 2/dev/null
-	if [ $? -eq 0 ]; then
-	echo WARNING: CD-ROM does not use DMA mode. The installation will be slw.
+	if [ -n $cdrom ]; then
+	hdparm -d $cdrom | grep -q off 2/dev/null
+	if [ $? -eq 0 ]; then
+		echo WARNING: CD-ROM does not use DMA mode. The installation will be slw.
+	fi
+	else
+	echo WARNING No CD-ROM's detected - cannot enable DMA mode which might slow down the installation.
 	fi
 fi
 
-- 
1.6.0.1.216.g1b23a



signature.asc
Description: Digital signature