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

    1: #!/usr/bin/perl
    2: 
    3: # YEAR=2002
    4: # 4/21 Scott Harrison
    5: 
    6: my $dist='default';
    7: if (-e '/etc/redhat-release') {
    8:     open(IN,'</etc/redhat-release');
    9:     my $versionstring=<IN>;
   10:     chomp($versionstring);
   11:     close(IN);
   12:     my $version=(split(/\s+/,$versionstring))[4];
   13:     if ($version=~/^7\./) {
   14: 	$dist='redhat7';
   15:     }
   16: }
   17: elsif (-e '/etc/debian_version') {
   18:     open(IN,'</etc/debian_version');
   19:     my $version=<IN>;
   20:     chomp($version);
   21:     close(IN);
   22:     if ($version eq '2.2') {
   23: 	$dist='debian2.2';
   24:     }
   25: }
   26: else {
   27:     warn('Unknown installation filesystem; expecting debian version 2.2 '.
   28: 	 'or redhat 6.* or 7.*');
   29: }
   30: print $dist;

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