From 2e874f7ba0ecafe32de081da72eaab51dd20a920 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 3 Mar 2004 11:45:23 +0000 Subject: - device_name_to_entry() will not fail anymore so that removing a device works - log calls to drakupdate_fstab - use "find" instead of "grep" where possible --- perl-install/standalone/drakupdate_fstab | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'perl-install/standalone/drakupdate_fstab') diff --git a/perl-install/standalone/drakupdate_fstab b/perl-install/standalone/drakupdate_fstab index ced536698..8bc72aacc 100755 --- a/perl-install/standalone/drakupdate_fstab +++ b/perl-install/standalone/drakupdate_fstab @@ -29,6 +29,8 @@ use fs; $::isStandalone = 1; #- not using standalone.pm which generates too many logs for drakupdate_fstab purpose +log::l("drakupdate_fstab called with @ARGV\n"); + $::testing = $ARGV[0] eq '--test' && shift @ARGV; $::auto = $ARGV[0] eq '--auto' && shift @ARGV; my $no_flag = $ARGV[0] eq '--no-flag' && shift @ARGV; @@ -61,13 +63,13 @@ sub device_name_to_entry { my ($e, $nb); if ((my $devfs_prefix, $nb) = $name =~ m,(.*)/(?:cd|disc|part(\d+))$,) { - ($e) = grep { $_->{devfs_prefix} eq $devfs_prefix } @l or return; + $e = find { $_->{devfs_prefix} eq $devfs_prefix } @l; } else { - if (($e) = grep { $name eq $_->{device} } @l) { + if ($e = find { $name eq $_->{device} } @l) { $nb = ''; } else { (my $prefix, $nb) = $name =~ m/^(.*?)(\d*)$/; - ($e) = grep { $prefix eq ($_->{prefix} || $_->{device}) } @l or return; + $e = find { $prefix eq ($_->{prefix} || $_->{device}) } @l; } } @@ -75,6 +77,8 @@ sub device_name_to_entry { $e->{devfs_device} = $e->{devfs_prefix} . '/part' . $nb; $e->{device} = ($e->{prefix} || $e->{device}) . $nb; } + $e ||= {}; + $e->{device} = $name; #- keeping the exact name given (often is the devfs name) $e; } -- cgit v1.2.1