#!/bin/sh

volumes="`hal-find-by-capability --capability volume 2>/dev/null`"

[ -z "$volumes" ] && exit 0

for vol in $volumes; do
    [ "`hal-get-property --udi $vol --key volume.ignore 2>/dev/null`" = "true" ] && continue
    stdev="`hal-get-property --udi $vol --key block.storage_device 2>/dev/null`"
    [ "`hal-get-property --udi $stdev --key storage.removable 2>/dev/null`" != "true" -a "`hal-get-property --udi $stdev --key storage.hotpluggable 2>/dev/null`" != "true" ] && continue
    dev="`hal-get-property --udi $vol --key block.device 2>/dev/null`"
    if [ "`hal-get-property --udi $vol --key volume.is_mounted 2>/dev/null`" = "true" ]; then
	mp="`hal-get-property --udi $vol --key volume.mount_point 2>/dev/null`"
	echo "device: $dev (mounted to $mp)"
    else
	echo "device: $dev (not mounted)"
    fi
done
