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 TEXTDOMAIN=usbinstall
TEXTDOMAINDIR=/usr/share/locale/ 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(){ installa(){
conferma=0 conferma=0
chiave=$c chiave=$c
@ -97,21 +101,23 @@ exit 0
} }
scansione() { 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 c=0
for udi in $(/usr/bin/hal-find-by-capability --capability storage)
do for dev in $devices; do
if [[ $(hal-get-property --udi $udi --key storage.removable) = "true" && native_path=`get_udisks_key $dev native-path`
$(hal-get-property --udi $udi --key storage.drive_type) = "disk" ]]; then vend=`get_udisks_key $dev vendor`
c=$((c+1)) prod=`get_udisks_key $dev model`
device[$c]=$(hal-get-property --udi $udi --key block.device) [ -e $native_path/partition ] || continue
vendor[$c]=$(hal-get-property --udi $udi --key storage.vendor) is_system_internal=`get_udisks_key $dev "system internal"`
model[$c]=$(hal-get-property --udi $udi --key storage.model) if [ "$is_system_internal" != "1" ]; then
parent_udi=$(hal-find-by-property --key block.storage_device --string $udi) c=$((c+1))
# mount[$c]=$(hal-get-property --udi $parent_udi --key volume.mount_point) device[$c]=$dev
# label[$c]=$(hal-get-property --udi $parent_udi --key volume.label) vendor[$c]=$vend
media_size[$c]=$(hal-get-property --udi $udi --key storage.removable.media_size) model[$c]=$prod
size[$c]=$(( ${media_size[$c]}/(1000*1000*1000))) media_size[$c]=`get_udisks_key $dev size`
size[$c]=$((${media_size[$c]}/(1000*1000*1000)))
fi fi
done done
if [ $c -eq 0 ]; then if [ $c -eq 0 ]; then