diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 18:07:37 -0300 | 
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 18:07:37 -0300 | 
| commit | 41b6cd0cf9e885faf45f0d0a4fa35055495279d7 (patch) | |
| tree | 09dd3d3e220b058a9aa6762dfc60411be2ac2046 /modules/computer | |
| parent | 61a81feb3a316ea18b37ba0142fe895e714d10e5 (diff) | |
| parent | 5bba5c481d7273b475a39eb61e5eacec65d3c8e5 (diff) | |
Update upstream source from tag 'upstream/2.0.5pre'
Update to upstream version '2.0.5pre'
with Debian dir 9973fc57c4c67d50c40723e3e88c9b1c8e78f684
Diffstat (limited to 'modules/computer')
| -rw-r--r-- | modules/computer/os.c | 30 | 
1 files changed, 16 insertions, 14 deletions
| diff --git a/modules/computer/os.c b/modules/computer/os.c index 7648eef3..508f0fa0 100644 --- a/modules/computer/os.c +++ b/modules/computer/os.c @@ -369,8 +369,10 @@ parse_os_release(void)      for (line = split; *line; line++) {          if (!strncmp(*line, "ID=", sizeof("ID=") - 1)) {              id = g_strdup(*line + strlen("ID=")); -        } else if (!strncmp(*line, "CODENAME=", sizeof("CODENAME=") - 1)) { +        } else if (!strncmp(*line, "CODENAME=", sizeof("CODENAME=") - 1) && codename == NULL) {              codename = g_strdup(*line + strlen("CODENAME=")); +        } else if (!strncmp(*line, "VERSION_CODENAME=", sizeof("VERSION_CODENAME=") - 1) && codename == NULL) { +            codename = g_strdup(*line + strlen("VERSION_CODENAME="));          } else if (!strncmp(*line, "PRETTY_NAME=", sizeof("PRETTY_NAME=") - 1)) {              pretty_name = g_strdup(*line +                                     strlen("PRETTY_NAME=\"")); @@ -387,7 +389,7 @@ parse_os_release(void)      return (Distro) {};  } -static Distro +/*static Distro  parse_lsb_release(void)  {      gchar *pretty_name = NULL; @@ -395,7 +397,7 @@ parse_lsb_release(void)      gchar *codename = NULL;      gchar **split, *contents, **line; -    if (!hardinfo_spawn_command_line_sync("/usr/bin/lsb_release -di", &contents, NULL, NULL, NULL)) +    if (!hardinfo_spawn_command_line_sync("/usr/bin/lsb_release -dic", &contents, NULL, NULL, NULL))          return (Distro) {};      split = g_strsplit(idle_free(contents), "\n", 0); @@ -419,14 +421,14 @@ parse_lsb_release(void)      g_free(id);      return (Distro) {}; -} +    }*/  static Distro  detect_distro(void)  {      static const struct {          const gchar *file; -        const gchar *codename; +        const gchar *id;          const gchar *override;      } distro_db[] = {  #define DB_PREFIX "/etc/" @@ -471,9 +473,9 @@ detect_distro(void)      if (distro.distro)          return distro; -    distro = parse_lsb_release(); +    /*distro = parse_lsb_release();      if (distro.distro) -        return distro; +        return distro;*/      for (i = 0; distro_db[i].file; i++) {          if (!g_file_get_contents(distro_db[i].file, &contents, NULL, NULL)) @@ -482,27 +484,27 @@ detect_distro(void)          if (distro_db[i].override) {              g_free(contents);              return (Distro) { .distro = g_strdup(distro_db[i].override), -                              .codename = g_strdup(distro_db[i].codename) }; +                              .id = g_strdup(distro_db[i].id) };          } -        if (g_str_equal(distro_db[i].codename, "debian")) { +        if (g_str_equal(distro_db[i].id, "debian")) {              /* HACK: Some Debian systems doesn't include the distribuition               * name in /etc/debian_release, so add them here. */              if (isdigit(contents[0]) || contents[0] != 'D')                  return (Distro) {                      .distro = g_strdup_printf("Debian GNU/Linux %s", (char*)idle_free(contents)), -                    .codename = g_strdup(distro_db[i].codename) +                    .id = g_strdup(distro_db[i].id)                  };          } -        if (g_str_equal(distro_db[i].codename, "fatdog")) { +        if (g_str_equal(distro_db[i].id, "fatdog")) {              return (Distro) {                  .distro = g_strdup_printf("Fatdog64 [%.10s]", (char*)idle_free(contents)), -                .codename = g_strdup(distro_db[i].codename) +                .id = g_strdup(distro_db[i].id)              };          } -        return (Distro) { .distro = contents, .codename = g_strdup(distro_db[i].codename) }; +        return (Distro) { .distro = contents, .id = g_strdup(distro_db[i].id) };      }      return (Distro) { .distro = g_strdup(_("Unknown")) }; @@ -542,7 +544,7 @@ computer_get_os(void)      os->entropy_avail = computer_get_entropy_avail(); -    if (g_strcmp0(os->distrocode, "ubuntu") == 0) { +    if (g_strcmp0(os->distroid, "ubuntu") == 0) {          GSList *flavs = ubuntu_flavors_scan();          if (flavs) {              /* just use the first one */ | 
