File:  [LON-CAPA] / loncom / build / distprobe
Revision 1.5: download - view: text, annotated - select for diffs
Mon Nov 24 16:56:47 2003 UTC (20 years, 6 months ago) by matthew
Branches: MAIN
CVS tags: version_1_2_X, version_1_2_1, version_1_2_0, version_1_1_X, version_1_1_99_5, version_1_1_99_4, version_1_1_99_3, version_1_1_99_2, version_1_1_99_1, version_1_1_99_0, version_1_1_3, version_1_1_2, version_1_1_1, version_1_1_0, version_1_0_99_3, version_1_0_99_2, version_1_0_99_1, version_1_0_99, HEAD
Now recognizes Fedora.  Rewrite of some code & reindentation of other code.

    1: #!/usr/bin/perl
    2: #
    3: # The LearningOnline Network with CAPA
    4: #
    5: # $Id: distprobe,v 1.5 2003/11/24 16:56:47 matthew Exp $
    6: #
    7: # Copyright Michigan State University Board of Trustees
    8: #
    9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   10: #
   11: # LON-CAPA is free software; you can redistribute it and/or modify
   12: # it under the terms of the GNU General Public License as published by
   13: # the Free Software Foundation; either version 2 of the License, or
   14: # (at your option) any later version.
   15: #
   16: # LON-CAPA is distributed in the hope that it will be useful,
   17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19: # GNU General Public License for more details.
   20: #
   21: # You should have received a copy of the GNU General Public License
   22: # along with LON-CAPA; if not, write to the Free Software
   23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24: #
   25: # /home/httpd/html/adm/gpl.txt
   26: #
   27: # http://www.lon-capa.org/
   28: #
   29: 
   30: my $dist='default';
   31: if (-e '/etc/redhat-release') {
   32:     open(IN,'</etc/redhat-release');
   33:     my $versionstring=<IN>;
   34:     chomp($versionstring);
   35:     close(IN);
   36:     if ($versionstring =~ /^Red Hat Linux release ([\d\.]+) /) {
   37:         $version = $1;
   38:         if ($version=~/^7\./) {
   39:             $dist='redhat7';
   40:         } elsif ($version=~/^8\./) {
   41:             $dist='redhat8';
   42:         } elsif ($version=~/^9/) {
   43:             $dist='redhat9';
   44:         }
   45:     } elsif ($versionstring =~ /Fedora Core release ([\d\.]+) /) {
   46:         $dist = 'fedora'.$1;
   47:     } else {
   48:         warn('Unable to interpret /etc/redhat-release '.
   49:              'to determine system type');
   50:     }
   51: } elsif (-e '/etc/debian_version') {
   52:     open(IN,'</etc/debian_version');
   53:     my $version=<IN>;
   54:     chomp($version);
   55:     close(IN);
   56:     if ($version eq '2.2') {
   57: 	$dist='debian2.2';
   58:     }
   59: } else {
   60:     warn('Unknown installation: expecting a debian or redhat system');
   61: }
   62: print $dist;

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