1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-06-16 06:25:23 +00:00

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")
This commit is contained in:
Zachary Lee Andrews 2024-02-28 10:19:03 -05:00 committed by GitHub
parent 4e06fd96ba
commit f9fe06fadf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {