summaryrefslogtreecommitdiffstats
path: root/MDK
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2004-10-18 15:17:28 +0000
committerFlorent Villard <warly@mandriva.com>2004-10-18 15:17:28 +0000
commita86f61b6d7d96e3f13b1fa18378e1de380c96c10 (patch)
tree313b18b24eed47429c6f2ae7bc44a6a67cbe21e1 /MDK
parent7ec17262cd6bbda5ec69753ff27ab5d4f7493c5c (diff)
downloadperl-MDK-Common-a86f61b6d7d96e3f13b1fa18378e1de380c96c10.tar
perl-MDK-Common-a86f61b6d7d96e3f13b1fa18378e1de380c96c10.tar.gz
perl-MDK-Common-a86f61b6d7d96e3f13b1fa18378e1de380c96c10.tar.bz2
perl-MDK-Common-a86f61b6d7d96e3f13b1fa18378e1de380c96c10.tar.xz
perl-MDK-Common-a86f61b6d7d96e3f13b1fa18378e1de380c96c10.zip
Add distrib function to get company, system (e.g. Mandrakelinux) and product (e.g. 10.1)
Diffstat (limited to 'MDK')
-rw-r--r--MDK/Common/System.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/MDK/Common/System.pm b/MDK/Common/System.pm
index 7a6d194..d81efe0 100644
--- a/MDK/Common/System.pm
+++ b/MDK/Common/System.pm
@@ -224,6 +224,17 @@ sub better_arch {
}
sub compat_arch { better_arch(arch(), $_[0]) }
+sub distrib() {
+ my $release = MDK::Common::File::cat_('/etc/release');
+ my ($real_system, $real_product) = $release =~ /(.*) release ([\d.]+)/;
+ my $oem_config = '/etc/sysconfig/oem';
+ my %oem = -f $oem_config && getVarsFromSh($oem_config);
+ my $company = $oem{COMPANY} || 'Mandrakesoft';
+ my $system = $oem{SYSTEM} || $real_system;
+ my $product = $oem{PRODUCT} || $real_product;
+ (company => $company, system => $system, product => $product, real_system => $real_system, real_product => $real_product)
+}
+
sub typeFromMagic {
my $f = shift;
sysopen(my $F, $f, 0) or return;