On Mon, 2005-09-19 at 17:11 -0400, Robert G. Brown wrote: > Once upon a time > > `yum list installed | sed '/.*-release/!d;s/-release.*//'` > > was a way to determine a distro name in scriptlets. However, not that it > has become fairly common to add e.g. livna repo stuff on top of fedora repo > stuff, it is likely that one will get e.g. > > rgb@lilith|B:1027>yum list installed | sed '/.*-release/!d;s/-release.*//' > fedora > freshrpms > livna > > which won't do it. Alternatives to this such as: > > rgb@lilith|B:1040>ls /etc/*-release | sed 's/\/etc\/\(.*\)-release/\1/'; > fedora > lsb > redhat > warewulf > > are even worse. One thing that works on at least Fedora or Centos or > Red Hat systems is: > > rgb@lilith|B:1060>cat /etc/issue | sed '1q'| sed 's/ \(.*\)$//'; > Fedora > > but I don't know how ultimately portable this is. Ugh. Whatever you do, don't use that, it's by far the worst way to try to identify a distribution. To quote the manpage: "The file /etc/issue is a text file which contains a message or system identification to be printed before the login prompt." - it can contain any arbitrary message put there by sysadmins instead of whatever the distro makers happened to stuff in there. > > Is there a good, or at least better, way to set a "distribution" > variable for use in scripts or in yum itself? Realizing that getting > all of the linux distro producers to do something consistently is like > herding cats? [pmatilai@weasel ~]$ lsb_release -a LSB Version: 1.3 Distributor ID: FedoraCore Description: Fedora Core release 4 (Stentz) Release: 4 Codename: Stentz ..is as portable as it gets AFAIK. You didn't mention what exactly are you using the info for so difficult to say if that's the best way to accomplish that. - Panu -