diff options
author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 18:07:32 -0300 |
---|---|---|
committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 18:07:32 -0300 |
commit | 5bba5c481d7273b475a39eb61e5eacec65d3c8e5 (patch) | |
tree | 514a1919f16464138651f925bb64eac3aa5cd7f9 /modules/computer/os.c | |
parent | 5f01c706267c595de92406a32e7f31ef5056c2d0 (diff) |
New upstream version 2.0.5preupstream/2.0.5pre
Diffstat (limited to 'modules/computer/os.c')
-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 */ |