Datastore & backup - request for help

Bert Freudenberg bert at freudenbergs.de
Tue May 20 06:58:30 EDT 2008


On 20.05.2008, at 11:31, Martin Langhoff wrote:

> On Tue, May 20, 2008 at 8:58 PM, Marco Pesenti Gritti
> <mpgritti at gmail.com> wrote:
>> But it works only on the XO.
>
> Fair enough. Is there a portable (and lightweight) way of asking this
> question from bash?


battery=`hal-find-by-capability --capability battery`
ac_adapter=`hal-find-by-capability --capability ac_adapter`

finds you the HAL devices for the battery and the ac.

lshal -lu $battery
lshal -lu $ac_adapter

shows the properties, then you can apply generic shell magic to test  
(like, grep for "ac_adapter.present = true"). Also, it gives you the  
sysfs path if you prefer that.

Note that hal-find-* may return multiple items or none depending on  
the machine.

- Bert -





More information about the Devel mailing list