Blame SOURCES/fix-text-splash-os-string.patch

400165
From ae62b6013c3fd562659e59b517237d64bb0a12c6 Mon Sep 17 00:00:00 2001
e22087
From: Ray Strode <rstrode@redhat.com>
400165
Date: Wed, 25 May 2016 14:57:43 -0400
400165
Subject: [PATCH] text-progress-bar: munge os-release output
e22087
400165
RHEL uses the same /etc/os-release file in the installer for all
400165
variants.  This means we need to trim the variant out from the
400165
string, since it's not accurate.
400165
400165
dracut adds its own mark to the os-release file in the initramfs,
400165
we need to trim that out, too.
e22087
---
400165
 src/libply-splash-core/ply-text-progress-bar.c | 24 ++++++++++++++++++++++++
400165
 1 file changed, 24 insertions(+)
e22087
e22087
diff --git a/src/libply-splash-core/ply-text-progress-bar.c b/src/libply-splash-core/ply-text-progress-bar.c
400165
index 8c4e759..a5a6aff 100644
e22087
--- a/src/libply-splash-core/ply-text-progress-bar.c
e22087
+++ b/src/libply-splash-core/ply-text-progress-bar.c
400165
@@ -121,60 +121,84 @@ get_os_string (void)
e22087
     {
400165
       char key[] = "PRETTY_NAME=";
400165
 
400165
       for (pos = strstr (buf, key);
400165
            pos != NULL;
400165
            pos = strstr (pos, key))
400165
         {
400165
           if (pos == buf || pos[-1] == '\n')
400165
             break;
400165
         }
e22087
 
400165
       if (pos != NULL)
e22087
         {
400165
           pos += strlen (key);
400165
           pos2 = strstr (pos, "\n");
e22087
 
400165
           if (pos2 != NULL)
400165
             *pos2 = '\0';
400165
           else
400165
             pos2 = pos + strlen(pos) - 1;
e22087
 
400165
           if ((*pos == '\"' && pos2[-1] == '\"') ||
400165
               (*pos == '\'' && pos2[-1] == '\''))
e22087
             {
400165
               pos++;
400165
               pos2--;
e22087
 
400165
               *pos2 = '\0';
400165
             }
400165
           asprintf (&os_string, " %s", pos);
400165
+
400165
+          /* For RHEL, overwrite variant because it's not reliable, see
400165
+           * bug 911553
400165
+           */
400165
+          pos = strstr (os_string, "Red Hat Enterprise Linux ");
400165
+
e22087
+          if (pos != NULL)
e22087
+            {
400165
+              pos += strlen ("Red Hat Enterprise Linux ");
e22087
+
400165
+              pos2 = strstr (pos, " ");
e22087
+
400165
+              if (pos2 != NULL)
e22087
+                {
400165
+                  pos2++;
400165
+                  memmove (pos, pos2, strlen (pos2));
e22087
+                }
400165
+            }
400165
+
400165
+          /* Trim out code names and dracut gook
400165
+           */
400165
+          pos = strstr (os_string, " (");
400165
+          if (pos != NULL)
400165
+            *pos = '\0';
e22087
         }
e22087
       goto out;
e22087
     }
e22087
 
e22087
   pos = strstr (buf, " release ");
e22087
 
e22087
   if (pos == NULL)
e22087
     goto out;
e22087
 
e22087
   pos2 = strstr (pos, " (");
e22087
 
e22087
   if (pos2 == NULL)
e22087
     goto out;
e22087
 
e22087
   *pos = '\0';
e22087
   pos += strlen (" release ");
e22087
 
e22087
   *pos2 = '\0';
e22087
   asprintf (&os_string, " %s %s", buf, pos);
e22087
 
e22087
 out:
e22087
   free (buf);
e22087
 
e22087
   if (os_string == NULL)
e22087
     os_string = strdup ("");
e22087
 }
e22087
 
e22087
 void
e22087
 ply_text_progress_bar_draw (ply_text_progress_bar_t *progress_bar)
e22087
 {
e22087
-- 
400165
2.8.1
e22087