File:  [LON-CAPA] / loncom / build / distprobe
Revision 1.1: download - view: text, annotated - select for diffs
Sun Apr 21 16:44:29 2002 UTC (22 years ago) by harris41
Branches: MAIN
CVS tags: version_0_6_2, version_0_6, version_0_5_1, version_0_5, version_0_4, stable_2002_july, stable_2002_april, STABLE, HEAD
probes for linux distribution and version (debian2.2 or redhat6.* or redhat7.*)

#!/usr/bin/perl

# YEAR=2002
# 4/21 Scott Harrison

my $dist='default';
if (-e '/etc/redhat-release') {
    open(IN,'</etc/redhat-release');
    my $versionstring=<IN>;
    chomp($versionstring);
    close(IN);
    my $version=(split(/\s+/,$versionstring))[4];
    if ($version=~/^7\./) {
	$dist='redhat7';
    }
}
elsif (-e '/etc/debian_version') {
    open(IN,'</etc/debian_version');
    my $version=<IN>;
    chomp($version);
    close(IN);
    if ($version eq '2.2') {
	$dist='debian2.2';
    }
}
else {
    warn('Unknown installation filesystem; expecting debian version 2.2 '.
	 'or redhat 6.* or 7.*');
}
print $dist;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>