From ed5fa7ec69c0e2261277b3ac7685efa0d61ac9e8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 24 Feb 2009 15:19:13 -0800 Subject: Don't depend on /proc/ide /proc/ide doesn't exist in all configs, and it doesn't work correctly with KVM and other buggy virtualized ide. --- scripts/install-system | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/scripts/install-system b/scripts/install-system index 7fee5210..e9459538 100755 --- a/scripts/install-system +++ b/scripts/install-system @@ -173,23 +173,19 @@ get_drive_size () { # Probe hardrives not shown in /proc/partitions by default probe_drives () { - # find IDE drives. Not all drives show up in /proc/partitions for - # some reason. - # TODO: not sure we have to do this for anything but compact flash - # when we test on other platforms, we will find out and modify this section - # as appropriate - drive=$(find /proc/ide/ide* -name "hd*" 2>/dev/null | /usr/bin/awk -F"/" '{ print $5 }') - - # now exclude all drives but disks + # Find drives that may not be in /proc/partitions since not mounted + drive=$(ls /sys/block | grep '[hsv]d.') + + # now exclude all drives that are read-only for drive in $drive do - media=$(cat /proc/ide/$drive/media) - if [ "$media" = "disk" ]; then - output=$(mount | grep $drive) - if [ -z "$output" ]; then - output=$(parted /dev/$DRIVE p) + if [ $(cat /sys/block/$drive/ro) -ne 0 ] + then + output=$(mount | grep $drive) + if [ -z "$output" ]; then + output=$(parted /dev/$drive p) + fi fi - fi done } -- cgit v1.2.3