[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Determine system ver (Debian vs. other Linuxes) at runtime?

Matt England wrote:
> In my cross-platform-programming quests, I'm looking for ways to
> determine via my Makefiles which system/platform said build process is
> running on, so I can automatically pull in the correct libraries, build
> to the correct target directories, use the correct platform-specific
> code, etc.
> Back in the "old days" for me (mid 1990s), the Unix builds I was making
> were mostly Solaris, HP-UX, Irix, Digital-Unix, AIX....etc etc.  In such
> cases, 'uname -rs' all had distinctly different outputs.
> Now, 'uname -rs' (and the newer 'uname -o') all say "Linux" or
> "GNU/Linux" for all the Linux distributions.
> So I'm left with figuring out much harder ways to tell system revs
> apart.  I'm guessing I'm going to have to make an application which does
> nothing but evaluate a system and report it's variant (Redhat vs SuSE
> vs. Debian) and revision (Debian Woody/3.0, Sarge/3.1, etc).
> Thing is, I don't even know where to start.  Will some uname-based
> analysis work by itself?  Haven't seen anything yet that will
> distinguish between the different Linux distros.  I suspect there will
> be other cmds/APIs I can use to do stuff.  I'm looking for suggestions.
> -Matt

Have you tried to use the contents of /etc/issue ?  Typically for
RedHat/Fedora this will have the release in it, and (for Sarge at least)
this is also the case for Debian.  I've done a dist-upgrade on this box
and the file shows the correct version number at least...

user@debian:~# cat /etc/issue
Debian GNU/Linux 3.1 \n \l



Reply to: