From f9fe06fadfac109a87cb664dea6435a38b0612fc Mon Sep 17 00:00:00 2001 From: Zachary Lee Andrews Date: Wed, 28 Feb 2024 10:19:03 -0500 Subject: [PATCH] Update platform.c: Detect Alpine Linux properly. Gophernicus currently thinks that Alpine Linux is called "Welcome/6.7" (seems to be extracting the OS name from /etc/issue and the version it's grabbing the kernel version) This commit allows gophernicus to read /etc/alpine-release and display the OS name and version correctly (e.g. "Alpine Linux/3.20") --- src/platform.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/platform.c b/src/platform.c index c4f23d5..2794203 100644 --- a/src/platform.c +++ b/src/platform.c @@ -230,6 +230,14 @@ void platform(state *st) } } + /* Alpine Linux version should be in /etc/alpine-release */ + if (!*release && (fp = fopen("/etc/alpine-release", "r"))) { + sstrlcpy(sysname, "Alpine Linux"); + if (fgets (release, sizeof(release), fp) != NULL) + if ((c = strchr(release, '/'))) *c = '\0'; + fclose(fp); + } + /* OK, nothing worked - let's try /etc/issue for sysname */ if (!*sysname && (fp = fopen("/etc/issue", "r"))) { if (fgets(sysname, sizeof(sysname), fp) != NULL) {