--- loncom/build/distprobe 2003/11/24 16:56:47 1.5 +++ loncom/build/distprobe 2009/07/05 23:58:38 1.16 @@ -2,7 +2,7 @@ # # The LearningOnline Network with CAPA # -# $Id: distprobe,v 1.5 2003/11/24 16:56:47 matthew Exp $ +# $Id: distprobe,v 1.16 2009/07/05 23:58:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,21 +42,76 @@ if (-e '/etc/redhat-release') { } elsif ($version=~/^9/) { $dist='redhat9'; } - } elsif ($versionstring =~ /Fedora Core release ([\d\.]+) /) { - $dist = 'fedora'.$1; + } elsif ($versionstring =~ /Fedora( Core)? release ([\d\.]+) /) { + my $version=$2; + if ($version - int($version) > .9) { + $dist = 'fedora'.(int($version)+1); + } else { + $dist = 'fedora'.int($version); + } + } elsif ($versionstring =~ /Red Hat Enterprise Linux [AE]S release ([\d\.]+) /) { + $dist = 'rhes'.$1; + } elsif ($versionstring =~ /Red Hat Enterprise Linux Server release (\d+)/) { + $dist = 'rhes'.$1; + } elsif ($versionstring =~ /CentOS release (\d+)/) { + $dist = 'centos'.$1; + } elsif ($versionstring =~ /Scientific Linux SL release ([\d\.]+) /) { + $dist = 'scientific'.$1; } else { warn('Unable to interpret /etc/redhat-release '. 'to determine system type'); } +} elsif (-e '/etc/SuSE-release') { + open(IN,'; + chomp($versionstring); + close(IN); + if ($versionstring =~ /^SUSE LINUX Enterprise Server ([\d\.]+) /i) { + $dist='sles'.$1; + } elsif ($versionstring =~ /^SuSE Linux ([\d\.]+) /i) { + $dist = 'suse'.$1; + } elsif ($versionstring =~ /^openSUSE ([\d\.]+) /i) { + $dist = 'suse'.$1; + } else { + warn('Unable to interpret /etc/SuSE-release '. + 'to determine system type'); + } +} elsif (-e '/etc/issue') { + open(IN,'; + chomp($versionstring); + close(IN); + if ($versionstring =~ /^Ubuntu (\d+)\.\d+/i) { + $dist = 'ubuntu'.$1; + } elsif ($versionstring =~ /^Debian\s+GNU\/Linux\s+(\d+)\.\d+/i) { + $dist = 'debian'.$1; + } elsif (-e '/etc/debian_version') { + open(IN,'; + chomp($version); + close(IN); + if ($version =~ /^(\d+)\.\d+\.?\d*/) { + $dist='debian'.$1; + } else { + warn('Unable to interpret /etc/debian_version '. + 'to determine system type'); + } + } else { + warn('Unable to interpret /etc/issue '. + 'to determine system type'); + } } elsif (-e '/etc/debian_version') { open(IN,'; chomp($version); close(IN); - if ($version eq '2.2') { - $dist='debian2.2'; + if ($version =~ /^(\d+)\.\d+\.?\d*/) { + $dist='debian'.$1; + } else { + warn('Unable to interpret /etc/debian_version '. + 'to determine system type'); } } else { - warn('Unknown installation: expecting a debian or redhat system'); + warn('Unknown installation: expecting a debian, suse, or redhat system'); } print $dist;