Is there a way to positively, uniquely identify which Debian release a program is running on?
I've been writing custom utilities and libraries for various systems at
work, and with one particular project recently it's become (more)
important to know exactly which Debian release it's running on (at some
stage or other between version-controlled-code and installed-"binary")
so that I don't try to call a missing binary or create a .deb that
requires a package that doesn't actually exist in the target dist.
(Apache's suexec is one particular example; it's
/usr/lib/apache2/suexec2 on sarge, but /usr/lib/apache2/suexec on etch.
I could solve that particular case with some hackery in one of several
possible places, but it's a little harder for things like package
dependencies that have to change a little between different releases or
However, there doesn't seem to be any single, consistent,
doesn't-change-for-the-life-of-the-release, programmatically possible
(never mind *easy* just yet...) method to find out if I'm on Debian
sarge, etch, lenny, or some third-party Debian-derived distribution.
Nor does there seem to be any similar indicator to see if I'm on Debian
3.0, 3.1, 4.0, or whatever version list a third-party distro is up to
this week. (Side note: When is the number version of a new release
On RHEL and derived distros, there's usually a file /etc/redhat-release
(sometimes renamed, but usually trivially enough that it can be found
with little trouble) containing both the distro code name and the
version number. It may change a little on point releases, but it's
stable, consistent, and unique to each release.
Some searching turned up a suggestion to use the glibc version as a
reference... which might be OK if there weren't so much overlap between
releases. :( (I checked woody, sarge, etch, and lenny. There was
overlap between woody and *etch*, IIRC. Ewww.)