mirror of
https://github.com/gophernicus/gophernicus.git
synced 2024-09-01 04:14:15 -04: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:
parent
4e06fd96ba
commit
f9fe06fadf
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user