usbinstall: use udisk; drop hal

This commit is contained in:
Silvan Calarco 2011-09-05 01:41:11 +02:00
parent d7ae79e2d5
commit 5ca3473783

View File

@ -17,8 +17,12 @@ filecpio=""~/openmamba-bootusb-it-snapshot-"$version".i586.cpio.gz""
TEXTDOMAIN=usbinstall
TEXTDOMAINDIR=/usr/share/locale/
# formattazione della chiavetta e installazione dei file necessari al boot di openmamba
function get_udisks_key() {
LANG=C udisks --show-info $1 | grep " $2:" | head -n1 | sed "s|[[:space:]]*$2:[[:space:]]*\(.*\)|\1|"
}
# formattazione della chiavetta e installazione dei file necessari al boot di openmamba
installa(){
conferma=0
chiave=$c
@ -97,21 +101,23 @@ exit 0
}
scansione() {
#scansione di hal alla ricerca di tutte le periferiche di archiviazione usb
#ricerca di tutte le periferiche di archiviazione usb
devices=`udisks --enumerate-device-files | grep -v /dev/disk | sort -n`
c=0
for udi in $(/usr/bin/hal-find-by-capability --capability storage)
do
if [[ $(hal-get-property --udi $udi --key storage.removable) = "true" &&
$(hal-get-property --udi $udi --key storage.drive_type) = "disk" ]]; then
c=$((c+1))
device[$c]=$(hal-get-property --udi $udi --key block.device)
vendor[$c]=$(hal-get-property --udi $udi --key storage.vendor)
model[$c]=$(hal-get-property --udi $udi --key storage.model)
parent_udi=$(hal-find-by-property --key block.storage_device --string $udi)
# mount[$c]=$(hal-get-property --udi $parent_udi --key volume.mount_point)
# label[$c]=$(hal-get-property --udi $parent_udi --key volume.label)
media_size[$c]=$(hal-get-property --udi $udi --key storage.removable.media_size)
size[$c]=$(( ${media_size[$c]}/(1000*1000*1000)))
for dev in $devices; do
native_path=`get_udisks_key $dev native-path`
vend=`get_udisks_key $dev vendor`
prod=`get_udisks_key $dev model`
[ -e $native_path/partition ] || continue
is_system_internal=`get_udisks_key $dev "system internal"`
if [ "$is_system_internal" != "1" ]; then
c=$((c+1))
device[$c]=$dev
vendor[$c]=$vend
model[$c]=$prod
media_size[$c]=`get_udisks_key $dev size`
size[$c]=$((${media_size[$c]}/(1000*1000*1000)))
fi
done
if [ $c -eq 0 ]; then