1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-12-04 14:46:37 -05:00

Fix platform detection for Slackware (and possibly others)

This commit is contained in:
Kim Holviala 2014-05-15 06:42:43 +03:00
parent 0a42061b05
commit b9b38a7b40
2 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,10 @@
[ Automatically generated from git log ] [ Automatically generated from git log ]
2014-02-01 Kim Holviala <kim@holviala.com>
* Add license header to bin2c.c
* Up version number to 1.6-whatever
2014-01-25 Kim Holviala <kim@holviala.com> 2014-01-25 Kim Holviala <kim@holviala.com>
* Remove 'only tested with GCC' from INSTALL * Remove 'only tested with GCC' from INSTALL

View File

@ -69,7 +69,6 @@ void platform(state *st)
pclose(fp); pclose(fp);
strreplace(machine, ' ', '_'); strreplace(machine, ' ', '_');
chomp(machine);
} }
/* Get hardware name using shell uname */ /* Get hardware name using shell uname */
@ -94,7 +93,6 @@ void platform(state *st)
/* Get OS X version */ /* Get OS X version */
if ((fp = popen("/usr/bin/sw_vers -productVersion", "r"))) { if ((fp = popen("/usr/bin/sw_vers -productVersion", "r"))) {
fgets(release, sizeof(release), fp); fgets(release, sizeof(release), fp);
chomp(release);
pclose(fp); pclose(fp);
} }
@ -166,13 +164,11 @@ void platform(state *st)
if (!*sysname && (fp = popen("/usr/bin/lsb_release -i -s", "r"))) { if (!*sysname && (fp = popen("/usr/bin/lsb_release -i -s", "r"))) {
fgets(sysname, sizeof(sysname), fp); fgets(sysname, sizeof(sysname), fp);
chomp(sysname);
pclose(fp); pclose(fp);
} }
if (!*release && (fp = popen("/usr/bin/lsb_release -r -s", "r"))) { if (!*release && (fp = popen("/usr/bin/lsb_release -r -s", "r"))) {
fgets(release, sizeof(release), fp); fgets(release, sizeof(release), fp);
chomp(release);
pclose(fp); pclose(fp);
} }
} }
@ -184,7 +180,6 @@ void platform(state *st)
if ((c = strchr(sysname, ' '))) *c = '\0'; if ((c = strchr(sysname, ' '))) *c = '\0';
if ((c = strchr(sysname, '\\'))) *c = '\0'; if ((c = strchr(sysname, '\\'))) *c = '\0';
chomp(sysname);
} }
/* Debian version should be in /etc/debian_version */ /* Debian version should be in /etc/debian_version */
@ -193,7 +188,6 @@ void platform(state *st)
fclose(fp); fclose(fp);
if ((c = strchr(release, '/'))) *c = '\0'; if ((c = strchr(release, '/'))) *c = '\0';
chomp(release);
} }
#endif #endif
@ -209,6 +203,11 @@ void platform(state *st)
if (!*release) sstrlcpy(release, name.release); if (!*release) sstrlcpy(release, name.release);
if (!*machine) sstrlcpy(machine, name.machine); if (!*machine) sstrlcpy(machine, name.machine);
/* I always liked weird Perl-only functions */
chomp(sysname);
chomp(release);
chomp(machine);
/* We're only interested in major.minor version */ /* We're only interested in major.minor version */
if ((c = strchr(release, '.'))) if ((c = strchr(c + 1, '.'))) *c = '\0'; if ((c = strchr(release, '.'))) if ((c = strchr(c + 1, '.'))) *c = '\0';
if ((c = strchr(release, '-'))) *c = '\0'; if ((c = strchr(release, '-'))) *c = '\0';