[gdm] Use lsb_release if available to determine system description



commit 6ebab35125484d092745a1620021f7d40ff38187
Author: William Jon McCann <jmccann redhat com>
Date:   Wed Jun 16 23:35:22 2010 -0400

    Use lsb_release if available to determine system description
    
    https://bugzilla.gnome.org/show_bug.cgi?id=589549

 gui/simple-greeter/gdm-greeter-login-window.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 0b05609..47a8eb6 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -82,6 +82,8 @@
 #define KEY_LOGO                    KEY_GREETER_DIR "/logo_icon_name"
 #define KEY_DISABLE_USER_LIST       "/apps/gdm/simple-greeter/disable_user_list"
 
+#define LSB_RELEASE_COMMAND "lsb_release -d"
+
 #define GDM_GREETER_LOGIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_LOGIN_WINDOW, GdmGreeterLoginWindowPrivate))
 
 enum {
@@ -1046,10 +1048,24 @@ static char *
 get_system_version (void)
 {
         char *version;
+        char *output;
         int i;
 
         version = NULL;
 
+        output = NULL;
+        if (g_spawn_command_line_sync (LSB_RELEASE_COMMAND, &output, NULL, NULL, NULL)) {
+                if (g_str_has_prefix (output, "Description:")) {
+                        version = g_strdup (output + strlen ("Description:"));
+                } else {
+                        version = g_strdup (output);
+                }
+                version = g_strstrip (version);
+                g_free (output);
+
+                goto out;
+        }
+
         for (i = 0; known_etc_info_files [i]; i++) {
                 char *path1;
                 char *path2;
@@ -1069,13 +1085,12 @@ get_system_version (void)
         }
 
         if (version == NULL) {
-                char *output;
                 output = NULL;
                 if (g_spawn_command_line_sync ("uname -sr", &output, NULL, NULL, NULL)) {
                         version = g_strchomp (output);
                 }
         }
-
+ out:
         return version;
 }
 



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