summaryrefslogtreecommitdiffstats
path: root/perl-install/modules.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-05-30 11:13:29 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-05-30 11:13:29 +0000
commit74b7bd702790a02b44e0a8e2be3a8c2ced994ea4 (patch)
tree79f43edd9d7213dde0a114944e0c36344c07f32a /perl-install/modules.pm
parentc1af4addb6f18c15b59fc270854a0fbb8d92dcb6 (diff)
downloaddrakx-backup-do-not-use-74b7bd702790a02b44e0a8e2be3a8c2ced994ea4.tar
drakx-backup-do-not-use-74b7bd702790a02b44e0a8e2be3a8c2ced994ea4.tar.gz
drakx-backup-do-not-use-74b7bd702790a02b44e0a8e2be3a8c2ced994ea4.tar.bz2
drakx-backup-do-not-use-74b7bd702790a02b44e0a8e2be3a8c2ced994ea4.tar.xz
drakx-backup-do-not-use-74b7bd702790a02b44e0a8e2be3a8c2ced994ea4.zip
- fix detecting usb drives (#13395)
(backport from trunk)
Diffstat (limited to 'perl-install/modules.pm')
-rw-r--r--perl-install/modules.pm26
1 files changed, 22 insertions, 4 deletions
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index 6ba7b3ee2..e0492c086 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -55,6 +55,21 @@ sub module_is_available {
find { m!/\Q$module\E\.k?o! } cat_($::prefix . '/lib/modules/' . c::kernel_version() . '/modules.dep');
}
+sub post_2007_1_fuzzy_pidofs {
+ my ($regexp) = @_;
+ grep {
+ if (/^(\d+)$/) {
+ my $s = MDK::Common::File::cat_("/proc/$_/cmdline") ||
+ readlink("/proc/$_/exe") ||
+ MDK::Common::File::cat_("/proc/$_/stat") =~ /\s(\S+)/ && $1 ||
+ '';
+ $s =~ /$regexp/;
+ } else {
+ 0;
+ }
+ } MDK::Common::File::all('/proc');
+}
+
#-###############################################################################
#- module loading
#-###############################################################################
@@ -75,11 +90,14 @@ sub load_raw {
} elsif (member('usb-storage', @$l)) {
#- usb-storage is only modprobed when we know there is some scsi devices
#- so trying hard to wait for devices to be detected
- my $retry = 10;
- sleep 1; #- TOREMOVE for compatibility with previous behaviour: wait at least 2 seconds
- while ($retry--) {
+
+ #- first sleep the minimum time usb-stor-scan takes
+ sleep 5; #- 5 == /sys/module/usb_storage/parameters/delay_use
+ # then wait for usb-stor-scan to complete
+ my $retry = 0;
+ while ($retry++ < 10) {
+ post_2007_1_fuzzy_pidofs('usb-stor-scan') or last;
sleep 1;
- last if all('/sys/bus/scsi/devices');
log::l("waiting for usb-storage devices to appear (retry = $retry)");
}
}