File:
[LON-CAPA] /
loncom /
build /
distprobe
Revision
1.20:
download - view:
text,
annotated -
select for diffs
Thu Jul 21 21:28:29 2011 UTC (13 years, 1 month ago) by
raeburn
Branches:
MAIN
CVS tags:
version_2_11_2_uiuc,
version_2_11_2_msu,
version_2_11_2_educog,
version_2_11_2,
version_2_11_1,
version_2_11_0_RC3,
version_2_11_0_RC2,
version_2_11_0_RC1,
version_2_11_0,
version_2_10_X,
version_2_10_1,
loncapaMITrelate_1,
language_hyphenation_merge,
language_hyphenation,
HEAD,
BZ4492-merge,
BZ4492-feature_horizontal_radioresponse,
BZ4492-feature_Support_horizontal_radioresponse,
BZ4492-Support_horizontal_radioresponse
- Support CentOS 6.
1: #!/usr/bin/perl
2: #
3: # The LearningOnline Network with CAPA
4: #
5: # $Id: distprobe,v 1.20 2011/07/21 21:28:29 raeburn 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: my $version=$2;
47: if ($version - int($version) > .9) {
48: $dist = 'fedora'.(int($version)+1);
49: } else {
50: $dist = 'fedora'.int($version);
51: }
52: } elsif ($versionstring =~ /Red Hat Enterprise Linux [AE]S release ([\d\.]+) /) {
53: $dist = 'rhes'.$1;
54: } elsif ($versionstring =~ /Red Hat Enterprise Linux Server release (\d+)/) {
55: $dist = 'rhes'.$1;
56: } elsif ($versionstring =~ /CentOS(?:| Linux) release (\d+)/) {
57: $dist = 'centos'.$1;
58: } elsif ($versionstring =~ /Scientific Linux (?:SL )?release ([\d.]+) /) {
59: my $ver = $1;
60: $ver =~ s/\.\d+$//;
61: $dist = 'scientific'.$ver;
62: } else {
63: warn('Unable to interpret /etc/redhat-release '.
64: 'to determine system type');
65: }
66: } elsif (-e '/etc/SuSE-release') {
67: open(IN,'</etc/SuSE-release');
68: my $versionstring=<IN>;
69: chomp($versionstring);
70: close(IN);
71: if ($versionstring =~ /^SUSE LINUX Enterprise Server ([\d\.]+) /i) {
72: $dist='sles'.$1;
73: } elsif ($versionstring =~ /^SuSE Linux ([\d\.]+) /i) {
74: $dist = 'suse'.$1;
75: } elsif ($versionstring =~ /^openSUSE ([\d\.]+) /i) {
76: $dist = 'suse'.$1;
77: } else {
78: warn('Unable to interpret /etc/SuSE-release '.
79: 'to determine system type');
80: }
81: } elsif (-e '/etc/issue') {
82: open(IN,'</etc/issue');
83: my $versionstring=<IN>;
84: chomp($versionstring);
85: close(IN);
86: if ($versionstring =~ /^Ubuntu (\d+)\.\d+/i) {
87: $dist = 'ubuntu'.$1;
88: } elsif ($versionstring =~ /^Debian\s+GNU\/Linux\s+(\d+)\.\d+/i) {
89: $dist = 'debian'.$1;
90: } elsif (-e '/etc/debian_version') {
91: open(IN,'</etc/debian_version');
92: my $version=<IN>;
93: chomp($version);
94: close(IN);
95: if ($version =~ /^(\d+)\.\d+\.?\d*/) {
96: $dist='debian'.$1;
97: } else {
98: warn('Unable to interpret /etc/debian_version '.
99: 'to determine system type');
100: }
101: } else {
102: warn('Unable to interpret /etc/issue '.
103: 'to determine system type');
104: }
105: } elsif (-e '/etc/debian_version') {
106: open(IN,'</etc/debian_version');
107: my $version=<IN>;
108: chomp($version);
109: close(IN);
110: if ($version =~ /^(\d+)\.\d+\.?\d*/) {
111: $dist='debian'.$1;
112: } else {
113: warn('Unable to interpret /etc/debian_version '.
114: 'to determine system type');
115: }
116: } else {
117: warn('Unknown installation: expecting a debian, suse, or redhat system');
118: }
119: print $dist;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>