File:  [LON-CAPA] / nsdl / build / distprobe
Revision 1.1: download - view: text, annotated - select for diffs
Thu May 23 18:46:25 2002 UTC (20 years, 2 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
probe for operating system type and version

#!/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>