(Sent this on Friday, without the actual patch, naturally - here's the resend)

Hi,

I was monkeying around to add in support for Scientific Linux so that 'scientific' would be set as a class, when I realized that the SL folks capitalize the 'R' in the word 'release' in /etc/redhat-release. This caused neither vendor or release to be set.

Here's a patch (against 2.1.13) that converts to lowercase the relstring (once the vendor has been discovered) to solve this. At the same time, it adds in support for Scientific Linux.

Hope this helps!
Erik.

--
e r i k   w i l l i a m s o n                     [EMAIL PROTECTED]
 system admin . department of computer science . university of calgary
--- misc.c.orig 2005-03-04 10:44:05.416968528 -0700
+++ misc.c      2005-03-04 15:12:53.683099392 -0700
@@ -972,6 +972,7 @@
 #define MANDRAKE_10_1_ID "Mandrakelinux"
 #define FEDORA_ID "Fedora Core"
 #define WHITEBOX_ID "White Box Enterprise Linux"
+#define SCIENTIFIC_ID "Scientific Linux SL"
  
 #define RELEASE_FLAG "release "
 
@@ -985,6 +986,7 @@
  * Red Hat Enterprise Linux ES release 2.1 (Panama)
  * Fedora Core release 1 (Yarrow)
  * White Box Enterprise linux release 3.0 (Liberation)
+ * Scientific Linux SL Release 4.0 (Beryllium)
  */
 
 #define RH_REL_FILENAME "/etc/redhat-release"
@@ -1059,6 +1061,10 @@
     {
     vendor = "whitebox";
     }
+ else if(!strncmp(relstring, SCIENTIFIC_ID, strlen(SCIENTIFIC_ID)))
+    {
+    vendor = "scientific";
+    }
  else
     {
     Verbose("Could not identify OS distro from %s\n", RH_REL_FILENAME);
@@ -1071,6 +1077,15 @@
   * have the word 'release' before the numerical release.
   */
  
+  /* Convert relstring to lowercase so that vendors like
+    Scientific Linux don't fall through the cracks.
+  */
+ int i;
+ for (i = 0; i < strlen(relstring); i++)
+   {
+   relstring[i] = tolower(relstring[i]);
+   }
+ 
  release = strstr(relstring, RELEASE_FLAG);
  if(release == NULL)
     {
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine

Reply via email to