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