Pofig
Portable Figure Out system properties
pofig - portable shell script for probing base system properties: OS, OS version, kernel version, distro, distro version, architecture.
It detects: 19 operating systems, 11 major linux distros, 13 CPU types.
See wiki for more information and examples.