Bug#394557: laptop-mode-tools: LVM partitions not supported
Peter Eisentraut wrote: So where is the next version? On my HD. I was planning on releasing it this week, some things came up but I'll probably get to it before the end of the weekend. Cheers, Bart -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#394557: laptop-mode-tools: LVM partitions not supported
So where is the next version? -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#394557: laptop-mode-tools: LVM partitions not supported
Hi Mikko, Mikko Rapeli wrote: The problem is quite simple, though I don't understand the reasons for the laptop_mode coding style with environment variables. With the fix below I get LVM partitions remounted: I see, thanks for reporting this! Unfortunately adding the spaces to the beginning and end is somewhat necessary, because otherwise (for instance) the partition /dev/automatic_thingummy will be found using grep auto. I think the trick would be to do something like: if ( (echo -n ; echo -n $PARTITIONS ; echo -n ) | grep $DEV /dev/null ) ; then Does it work for you that way? Cheers, Bart -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#394557: laptop-mode-tools: LVM partitions not supported
On Sun, Oct 22, 2006 at 08:14:58AM +0200, Bart Samwel wrote: I see, thanks for reporting this! Unfortunately adding the spaces to the beginning and end is somewhat necessary, because otherwise (for instance) the partition /dev/automatic_thingummy will be found using grep auto. I think the trick would be to do something like: if ( (echo -n ; echo -n $PARTITIONS ; echo -n ) | grep $DEV /dev/null ) ; then Does it work for you that way? I didn't try, since I found a cleaner way to do the shell wild card expansion. What do you think? Expansion is postprocessing and all the comparisons and white space additions are left as they are: diff -ur laptop-mode-tools-1.32/usr/sbin/laptop_mode laptop-mode-tools-1.32-0mcf02/usr/sbin/laptop_mode --- laptop-mode-tools-1.32/usr/sbin/laptop_mode 2006-10-06 13:07:02.0 +0300 +++ laptop-mode-tools-1.32-0mcf02/usr/sbin/laptop_mode 2006-10-22 09:58:47.0 +0300 @@ -271,6 +271,9 @@ PARTITIONS=auto /dev/mapper/* fi +# Expand shell wild cards +PARTITIONS=$( echo $PARTITIONS ) + # Convert seconds to hdparm -S format # Everything over 20 minutes is interpreted as 2 hours. seconds_to_hdparm_S() { -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#394557: laptop-mode-tools: LVM partitions not supported
Mikko Rapeli wrote: On Sun, Oct 22, 2006 at 08:14:58AM +0200, Bart Samwel wrote: [...] grep auto. I think the trick would be to do something like: if ( (echo -n ; echo -n $PARTITIONS ; echo -n ) | grep $DEV /dev/null ) ; then Does it work for you that way? I didn't try, since I found a cleaner way to do the shell wild card expansion. What do you think? Expansion is postprocessing and all the comparisons and white space additions are left as they are: [...] +# Expand shell wild cards +PARTITIONS=$( echo $PARTITIONS ) Yeah, _that_ is the way to go. Nice small patch, thanks -- it'll be in the next version, with kudos in the release notes! :-) Cheers, Bart -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#394557: laptop-mode-tools: LVM partitions not supported
Package: laptop-mode-tools Version: 1.32-1 Severity: normal Tags: patch *** Please type your report below this line *** laptop_mode does not expand any wild cards used with PARTITIONS variable properly, so LVM partitions are not remounted with powersaving options, even though it set to auto /dev/mapper/* by default. Here's an example with debug output enabled: # /etc/init.d/laptop-mode start | grep home /dev/mapper/silun_levyt-home not found in PARTITIONS. /home not found in PARTITIONS. Checking /dev/mapper/silun_levyt-home against HD because PARTITIONS contains auto. The problem is quite simple, though I don't understand the reasons for the laptop_mode coding style with environment variables. With the fix below I get LVM partitions remounted: # /etc/init.d/laptop-mode start|grep home /dev/mapper/silun_levyt-home found in PARTITIONS. /home not found in PARTITIONS. Checking /dev/mapper/silun_levyt-home against HD because PARTITIONS contains auto. Executing: mount /dev/mapper/silun_levyt-home -t ext3 /home -o remount,rw,commit=360 Executing: /sbin/blockdev --setra 6144 /dev/mapper/silun_levyt-home And the patch: --- laptop-mode-tools-1.32.orig/usr/sbin/laptop_mode +++ laptop-mode-tools-1.32/usr/sbin/laptop_mode @@ -966,19 +966,27 @@ echo Remounting filesystems. $OUTPUT cat /etc/mtab | while read DEV MP FST OPTS DUMP PASS ; do DO=0 - if ( echo $PARTITIONS | grep $DEV /dev/null ) ; then + # $PARTITIONS may contain shell wild cards like + # /dev/mapper/* , so the shell needs to expand them + # before grep matching, thus no quoting with echo and + # no white space matches with grep. + # Perhaps there is a good reason for this + # style? Perhaps no variable should have wild cards or + # perhaps all wild cards should be expanded somewhere + # else where its safe? + if ( echo $PARTITIONS | grep $DEV /dev/null ) ; then DO=1 echo $DEV found in PARTITIONS. $OUTPUT else echo $DEV not found in PARTITIONS. $OUTPUT fi - if ( echo $PARTITIONS | grep $MP /dev/null ) ; then + if ( echo $PARTITIONS | grep $MP /dev/null ) ; then DO=1 echo $MP found in PARTITIONS. $OUTPUT else echo $MP not found in PARTITIONS. $OUTPUT fi - if ( echo $PARTITIONS | grep auto /dev/null ) ; then + if ( echo $PARTITIONS | grep auto /dev/null ) ; then echo Checking $DEV against HD because PARTITIONS contains \auto\. $OUTPUT for THISHD in $HD ; do echoConsidering $THISHD. $OUTPUT -- System Information: Debian Release: testing APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.17-2-686 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Versions of packages laptop-mode-tools depends on: ii lsb-base 3.1-15 Linux Standard Base 3.1 init scrip Versions of packages laptop-mode-tools recommends: ii acpid 1.0.4-5Utilities for using ACPI power man ii hdparm6.6-1 tune hard disk parameters for high pn sdparmnone (no description available) -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]