Sysinfo: Fix gentoo detection
This commit is contained in:
parent
4e775df156
commit
b5b547abb6
@ -379,21 +379,8 @@ int xs_parse_distro(char *name)
|
|||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
char buffer[bsize], *pos = NULL;
|
char buffer[bsize], *pos = NULL;
|
||||||
|
|
||||||
if((fp = fopen("/etc/lsb-release", "r")) != NULL)
|
if((fp = fopen("/etc/portage/make.conf", "r")) != NULL ||
|
||||||
{
|
(fp = fopen("/etc/make.conf", "r")) != NULL)
|
||||||
char id[bsize], codename[bsize], release[bsize];
|
|
||||||
strcpy(id, "?");
|
|
||||||
strcpy(codename, "?");
|
|
||||||
strcpy(release, "?");
|
|
||||||
while(fgets(buffer, bsize, fp) != NULL)
|
|
||||||
{
|
|
||||||
find_match_char(buffer, "DISTRIB_ID", id);
|
|
||||||
find_match_char(buffer, "DISTRIB_CODENAME", codename);
|
|
||||||
find_match_char(buffer, "DISTRIB_RELEASE", release);
|
|
||||||
}
|
|
||||||
snprintf(buffer, bsize, "%s \"%s\" %s", id, codename, release);
|
|
||||||
}
|
|
||||||
else if((fp = fopen("/etc/make.conf", "r")) != NULL)
|
|
||||||
{
|
{
|
||||||
char keywords[bsize];
|
char keywords[bsize];
|
||||||
while(fgets(buffer, bsize, fp) != NULL)
|
while(fgets(buffer, bsize, fp) != NULL)
|
||||||
@ -424,6 +411,20 @@ int xs_parse_distro(char *name)
|
|||||||
fgets(buffer, bsize, fp);
|
fgets(buffer, bsize, fp);
|
||||||
else if((fp = fopen("/etc/arch-release", "r")) != NULL)
|
else if((fp = fopen("/etc/arch-release", "r")) != NULL)
|
||||||
snprintf(buffer, bsize, "ArchLinux");
|
snprintf(buffer, bsize, "ArchLinux");
|
||||||
|
else if((fp = fopen("/etc/lsb-release", "r")) != NULL)
|
||||||
|
{
|
||||||
|
char id[bsize], codename[bsize], release[bsize];
|
||||||
|
strcpy(id, "?");
|
||||||
|
strcpy(codename, "?");
|
||||||
|
strcpy(release, "?");
|
||||||
|
while(fgets(buffer, bsize, fp) != NULL)
|
||||||
|
{
|
||||||
|
find_match_char(buffer, "DISTRIB_ID", id);
|
||||||
|
find_match_char(buffer, "DISTRIB_CODENAME", codename);
|
||||||
|
find_match_char(buffer, "DISTRIB_RELEASE", release);
|
||||||
|
}
|
||||||
|
snprintf(buffer, bsize, "%s \"%s\" %s", id, codename, release);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
snprintf(buffer, bsize, "Unknown Distro");
|
snprintf(buffer, bsize, "Unknown Distro");
|
||||||
if(fp != NULL) fclose(fp);
|
if(fp != NULL) fclose(fp);
|
||||||
|
Loading…
Reference in New Issue
Block a user