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

2006-01-01 Thread Hugo Vanwoerkom

OxyOss wrote:

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, AIXetc 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



G'day

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...

[EMAIL PROTECTED]:~# cat /etc/issue
Debian GNU/Linux 3.1 \n \l



It seems you have to:
1. check /etc/issue
2. if Debian then also check /etc/apt/sources.list for the right 
distribution.


Because my Sid partition has the same in /etc/issue and 
/etc/debian_version as Sarge.


H










--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




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

2006-01-01 Thread Joe Smith


OxyOss [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]




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...

[EMAIL PROTECTED]:~# cat /etc/issue
Debian GNU/Linux 3.1 \n \l

The problem is that that is almost certainly a conffile. It is the system 
logon message, and sysadmins are free to change it at will. 




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




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

2006-01-01 Thread David Kirchner
On 12/30/05, Matt England [EMAIL PROTECTED] wrote:
 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).

I don't know of an API method for this (it may be that there is none)
but one way you can try to tell is by running:

strings /lib/libc.so.6 | egrep ^Compiled by. On Debian sarge you see:

Compiled by GNU CC version 3.3.5 (Debian 1:3.3.5-12).

and on RedHat 7.3:

Compiled by GNU CC version 2.96 2731 (Red Hat Linux 7.3 2.96-113).

Dunno about the rest of the distributions.



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

2006-01-01 Thread Cybe R. Wizard
On Sun, 1 Jan 2006 15:10:23 -0800
David Kirchner [EMAIL PROTECTED] wrote:

 I don't know of an API method for this (it may be that there is none)
 but one way you can try to tell is by running:
 
 strings /lib/libc.so.6 | egrep ^Compiled by. On Debian sarge you
 see:
 
 Compiled by GNU CC version 3.3.5 (Debian 1:3.3.5-12).
 
 and on RedHat 7.3:
 
 Compiled by GNU CC version 2.96 2731 (Red Hat Linux 7.3 2.96-113).
 
 Dunno about the rest of the distributions.

Good call.  Here's what Ubuntu Breezy tells me:
Compiled by GNU CC version 3.4.5 20050809 (prerelease) (Ubuntu
3.4.4-6ubuntu8).

Cybe R. Wizard
-- 
Linux -- It's computing, Jim, but not as we know it


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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

2005-12-30 Thread Chris Howie
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Matt England wrote:
 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).

If /etc/debian_version exists, then it's debian, and the file contents should
be the version number (which will be testing/unstable if the user is not
running a stable release).

- --
Chris Howie
http://www.chrishowie.com

- -BEGIN GEEK CODE BLOCK-
Version: 3.1
GCS/IT d-(--) s:- a---? C++(+++)$ UL P$ L+++ E---
W++ N o++ K? w--$ O M- V- PS--(---) PE++ Y+ PGP++ t+ 5? X-
R(+)- tv-(--) b- DI+ D++ G+++ e++ h(--)--- !r+++ y-+++
- --END GEEK CODE BLOCK--
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDtZwPqlk5sZw9W7kRAodaAKCmDbp3MM60oB69qolr9VeBB6lo9wCffM0l
QKgZSD5q6eve9kbzfPR0zrA=
=82bv
-END PGP SIGNATURE-


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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

2005-12-30 Thread John Hasler
Matt writes:
 Thing is, I don't even know where to start. 

apt-get install automake autoconf autobook
-- 
John Hasler


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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

2005-12-30 Thread Paul E Condon
On Fri, Dec 30, 2005 at 03:43:59PM -0500, Chris Howie wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Matt England wrote:
  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).
 
 If /etc/debian_version exists, then it's debian, and the file contents should
 be the version number (which will be testing/unstable if the user is not
 running a stable release).
 

The situation is, i beleive, somewhat more complicated for Debian: 

If /etc/debian_version exists, then the system is very probably
debian.  

The file contents are (if it IS debian) either the version number,
which is placed there by the install scripts, or whatever the local
sysadmin has decided to put there. This file IS available for local
sysadmin use. Also, i believe, dist-upgrade from stable to testing/
unstable does not change the contents. (But I'm not willing to 
dist-upgrade just to make sure, i'm right, so check what i'm saying
yourself if it really matters.)

-- 
Paul E Condon   
[EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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

2005-12-30 Thread OxyOss
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, AIXetc 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
 
 
G'day

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...

[EMAIL PROTECTED]:~# cat /etc/issue
Debian GNU/Linux 3.1 \n \l

Regards,

Russell


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]