alaurie / rpms / plymouth

Forked from rpms/plymouth 4 days ago
Clone

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

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