[LON-CAPA-cvs] cvs: loncom /build distprobe
matthew
lon-capa-cvs@mail.lon-capa.org
Mon, 24 Nov 2003 16:56:47 -0000
matthew Mon Nov 24 11:56:47 2003 EDT
Modified files:
/loncom/build distprobe
Log:
Now recognizes Fedora. Rewrite of some code & reindentation of other code.
Index: loncom/build/distprobe
diff -u loncom/build/distprobe:1.4 loncom/build/distprobe:1.5
--- loncom/build/distprobe:1.4 Tue Jul 1 13:55:12 2003
+++ loncom/build/distprobe Mon Nov 24 11:56:47 2003
@@ -1,6 +1,31 @@
#!/usr/bin/perl
-
-# YEAR=2002
+#
+# The LearningOnline Network with CAPA
+#
+# $Id: distprobe,v 1.5 2003/11/24 16:56:47 matthew Exp $
+#
+# Copyright Michigan State University Board of Trustees
+#
+# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
+#
+# LON-CAPA is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# LON-CAPA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LON-CAPA; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# /home/httpd/html/adm/gpl.txt
+#
+# http://www.lon-capa.org/
+#
my $dist='default';
if (-e '/etc/redhat-release') {
@@ -8,16 +33,22 @@
my $versionstring=<IN>;
chomp($versionstring);
close(IN);
- my $version=(split(/\s+/,$versionstring))[4];
- if ($version=~/^7\./) {
- $dist='redhat7';
- } elsif ($version=~/^8\./) {
- $dist='redhat8';
- } elsif ($version=~/^9/) {
- $dist='redhat9';
+ if ($versionstring =~ /^Red Hat Linux release ([\d\.]+) /) {
+ $version = $1;
+ if ($version=~/^7\./) {
+ $dist='redhat7';
+ } elsif ($version=~/^8\./) {
+ $dist='redhat8';
+ } elsif ($version=~/^9/) {
+ $dist='redhat9';
+ }
+ } elsif ($versionstring =~ /Fedora Core release ([\d\.]+) /) {
+ $dist = 'fedora'.$1;
+ } else {
+ warn('Unable to interpret /etc/redhat-release '.
+ 'to determine system type');
}
-}
-elsif (-e '/etc/debian_version') {
+} elsif (-e '/etc/debian_version') {
open(IN,'</etc/debian_version');
my $version=<IN>;
chomp($version);
@@ -25,9 +56,7 @@
if ($version eq '2.2') {
$dist='debian2.2';
}
-}
-else {
- warn('Unknown installation filesystem; expecting debian version 2.2 '.
- 'or redhat 6.* or 7.*');
+} else {
+ warn('Unknown installation: expecting a debian or redhat system');
}
print $dist;