From a2c392a9ab83bb9031fb11f99f0101f1f2d9f140 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 21 Apr 2005 15:17:42 +0000 Subject: create common::release_file() and use it --- perl-install/common.pm | 7 ++++++- perl-install/install_any.pm | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/perl-install/common.pm b/perl-install/common.pm index 8c8fa4234..1abba61e4 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -243,8 +243,13 @@ sub set_permissions { or die "Could not start chmod!"; } +sub release_file { + my ($o_dir) = @_; + find { -r "$o_dir$_" } map { "/etc/$_" } 'mandrakelinux-release', 'mandrake-release', 'release', 'redhat-release'; +} + sub mandrake_release() { - chomp_(cat_("/etc/mandrakelinux-release")); + chomp_(cat_(release_file())); } sub require_root_capability() { diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index b8e41a9bd..a72d32c54 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -1471,9 +1471,8 @@ sub find_root_parts { my ($fstab, $prefix) = @_; map { my $handle = any::inspect($_, $prefix); - my $f = $handle && (find { -f $_ } map { "$handle->{dir}/etc/$_" } 'mandrakelinux-release', 'mandrake-release', 'redhat-release'); - if ($f) { - my $s = cat_($f); + if (my $f = $handle && common::release_file($handle->{dir})) { + my $s = cat_("$handle->{dir}$f"); chomp($s); $s =~ s/\s+for\s+\S+//; log::l("find_root_parts found $_->{device}: $s"); -- cgit v1.2.1