8 if [ -e /usr/bin/dirname ]; then
11 echo $1 | sed 's/\/'$(basename $1)'$//'
15 # compat function to handle different udev versions
22 out=$(udevadm info --name=$name --query=$query $options)
24 if [ $rc -eq 0 ]; then
35 local live_dev=/dev/live
36 if [ ! -e $live_dev ]; then
41 live_part=$(readlink -e $live_dev)
42 live_disk=$(basename $(dirname $(udev_info $live_part path)))
43 if [ "$live_disk" = "block" ]; then
44 live_disk=$(basename $(udev_info $live_part path))
50 # find_disk $bus $serial
54 local live=$(get_live_disk)
56 # in initramfs, shell does not expand
57 # /dev/disk/by-id/{ata,cciss,scsi,usb}* correctly,
58 # so manually enumerate them
59 for d in $(ls /dev/disk/by-id/ata* /dev/disk/by-id/cciss* /dev/disk/by-id/scsi* /dev/disk/by-id/usb* 2>/dev/null); do
61 eval $(udev_info $(readlink -f $d) property "--export")
62 # ID_FS_USAGE is set for partitions
63 if [ "$DEVTYPE" = "disk" -a "$ID_BUS" = "$bus" ]; then
64 if [ -z "$serial" -o "$serial" = "ALL" \
65 -o "$ID_SERIAL" = "$serial" ]; then
66 local dev="$(readlink -e $d)"
67 if [ -n "$live" -a "$dev" = "/dev/$live" ]; then
68 # cannot install LiveOS over itself
70 elif [ "$serial" = "ALL" ]; then
93 # parse_disk_id DISK_ID
94 # DISK_ID=[ata|cciss|scsi|usb[:serial#]|/dev/...]
95 # ata|cciss|scsi|usb - select disk bus, as reported by udev ID_BUS
96 # serial# - select exact disk using serial number, as reported by
98 # e.g. storage_init=usb:Generic_STORAGE_DEVICE_0000145418-0:0
99 # ALL selects all the disks on the specified bus
100 # e.g. storage_init=ata:ALL
102 # /dev/... - use specified disk device
103 # (for cases when HAL doesn't handle it)
131 disk="$(ls -1 $i 2>/dev/null | head -n1)"
134 if [ -n "$bus" ]; then
135 disk=$(find_disk $bus $serial)
141 # execute a function if called as a script, e.g.
142 # ovirt-boot-functions ovirt_store_config /etc/hosts
144 if [ "$(basename -- "$0")" = "ovirt-boot-functions" ]; then