--- loncom/build/distprobe 2011/07/21 21:28:29 1.20 +++ loncom/build/distprobe 2021/03/18 21:40:03 1.24 @@ -2,7 +2,7 @@ # # The LearningOnline Network with CAPA # -# $Id: distprobe,v 1.20 2011/07/21 21:28:29 raeburn Exp $ +# $Id: distprobe,v 1.24 2021/03/18 21:40:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -28,7 +28,16 @@ # my $dist='default'; -if (-e '/etc/redhat-release') { +my $unknown; +if (-e '/etc/oracle-release') { + open(IN,'; + chomp($versionstring); + close(IN); + if ($versionstring =~ /^Oracle Linux Server release (\d+)/) { + $dist = 'oracle'.$1; + } +} elsif (-e '/etc/redhat-release') { open(IN,'; chomp($versionstring); @@ -53,7 +62,9 @@ if (-e '/etc/redhat-release') { $dist = 'rhes'.$1; } elsif ($versionstring =~ /Red Hat Enterprise Linux Server release (\d+)/) { $dist = 'rhes'.$1; - } elsif ($versionstring =~ /CentOS(?:| Linux) release (\d+)/) { + } elsif ($versionstring =~ /Red Hat Enterprise Linux release (\d+)/) { + $dist = 'rhes'.$1; + } elsif ($versionstring =~ /CentOS(?:| Linux| Stream) release (\d+)/) { $dist = 'centos'.$1; } elsif ($versionstring =~ /Scientific Linux (?:SL )?release ([\d.]+) /) { my $ver = $1; @@ -62,6 +73,7 @@ if (-e '/etc/redhat-release') { } else { warn('Unable to interpret /etc/redhat-release '. 'to determine system type'); + $unknown = 1; } } elsif (-e '/etc/SuSE-release') { open(IN,') { + chomp(); + if (/^ID="(\w+)"/) { + $id=$1; + } elsif (/^VERSION_ID="([\d\.]+)"/) { + $version=$1; + } + } + close(IN); + if ($id eq 'sles') { + my ($major,$minor) = split(/\./,$version); + if ($major =~ /^\d+$/) { + $dist = $id.$major; + } + } + } + if ($dist eq 'default') { + warn('Unable to interpret /etc/os-release '. + 'to determine system type.'); + $unknown = 1; + } + } else { + warn('Unknown installation: expecting a debian, ubuntu, suse, sles, redhat, fedora or scientific linux system.')."\n"; } -} else { - warn('Unknown installation: expecting a debian, suse, or redhat system'); } print $dist;