help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Relstring / Scientific Linux patch - this time with the patch...


From: Erik Williamson
Subject: Relstring / Scientific Linux patch - this time with the patch...
Date: Sun, 06 Mar 2005 09:35:47 -0700
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

(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                     erik@cpsc.ucalgary.ca
 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)
     {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]