[LON-CAPA-cvs] cvs: loncom /build distprobe

raeburn raeburn at source.lon-capa.org
Wed Oct 17 10:33:49 EDT 2018


raeburn		Wed Oct 17 14:33:49 2018 EDT

  Modified files:              
    /loncom/build	distprobe 
  Log:
  - Support SLES 15.
  
  
Index: loncom/build/distprobe
diff -u loncom/build/distprobe:1.20 loncom/build/distprobe:1.21
--- loncom/build/distprobe:1.20	Thu Jul 21 21:28:29 2011
+++ loncom/build/distprobe	Wed Oct 17 14:33:49 2018
@@ -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.21 2018/10/17 14:33:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -28,6 +28,7 @@
 #
 
 my $dist='default';
+my $unknown;
 if (-e '/etc/redhat-release') {
     open(IN,'</etc/redhat-release');
     my $versionstring=<IN>;
@@ -62,6 +63,7 @@
     } else {
         warn('Unable to interpret /etc/redhat-release '.
              'to determine system type');
+        $unknown = 1;
     }
 } elsif (-e '/etc/SuSE-release') {
     open(IN,'</etc/SuSE-release');
@@ -77,6 +79,7 @@
     } else {
         warn('Unable to interpret /etc/SuSE-release '.
              'to determine system type');
+        $unknown = 1;
     }
 } elsif (-e '/etc/issue') {
     open(IN,'</etc/issue');
@@ -97,10 +100,8 @@
         } else {
             warn('Unable to interpret /etc/debian_version '.
                  'to determine system type');
+            $unknown = 1;
         }
-    } else {
-        warn('Unable to interpret /etc/issue '.
-             'to determine system type');
     }
 } elsif (-e '/etc/debian_version') {
     open(IN,'</etc/debian_version');
@@ -112,8 +113,36 @@
     } else {
         warn('Unable to interpret /etc/debian_version '.
              'to determine system type');
+        $unknown = 1;
+    }
+}
+if (($dist eq 'default') && (!$unknown)) {
+    if (-e '/etc/os-release') {
+        if (open(IN,'<','/etc/os-release')) {
+            my ($id,$version);
+            while(<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;




More information about the LON-CAPA-cvs mailing list