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

Re: distro name



On Tue, 3 Aug 2004, Enrique Perez-Terron wrote:

> On Tue, 2004-08-03 at 00:53, Jim C. wrote:
> > > rpm -q --queryformat "%{DISTRIBUTION}\n" glibc
> > 
> > Actually this is not what I had in mind.  I dno't want to query the rpm 
> > database.  I want to query the system during an rpm install, i.e. in the 
> > spec file: "If this is the correct version of Linux, install otherwise 
> > fail."
> 
> The closest thing I know of is "rpm -qa \*-release", but I don't know if
> that works for anything not redhat-related.
> 
>   $ rpm -qa \*-release
>   fedora-release-2-4

..except he didn't want to query rpmdb.

>   $ cat /etc/fedora-release
>   Fedora Core release 2 (Tettnang)
>   $ ls -l /etc/redhat-release
>   lrwxrwxrwx  1 root root 14 May 29 18:49 /etc/redhat-release -> fedora-release

IIRC pretty much all linux distros have /etc/<distroname>-release in 
place, at least Debian, RH-variants (RHL, RHEL+rebuilds, FC), SuSE and 
Mandrake have it, making it probably the best option.

>   $ cat /etc/issue
>   Fedora Core release 2 (Tettnang)
>   Kernel \r on an \m
> 
> Perhaps /etc/issue is more generic? getty outputs this file with
> uname -x replacing \x.

Looking at /etc/issue is a BAD idea because that's a system configuration
file. People put legalese ("unauthorized use prohibited")  and such in
there, can't be depended on.

	- Panu -



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