[Discuss] Getting OS/HW details?

Scott Ehrlich srehrlich at gmail.com
Fri Nov 2 13:09:54 EDT 2012


If I wanted to write a script to obtain distro flavor (Ubuntu, CentOS,
RH, Mint, BSD, Solaris, etc), major/minor version (5.3, 10.6, etc),
hardware brand/make/model, at least for starters, what would be the
best way to attack it?

This script may or may not assume being run as root.

Environment is completely heterogeneous, so while I may be using an
OEM system, my officemate might be using a white box system.

I think the only assurance might be it be run as /bin/sh so we don't
have to worry about shells.

We cannot assume /etc/motd, /etc/issue, or anything else exists in its
out-of-box state (they could have been replaced with other text).

I thought about uname -a, but it does not indicate OS distro nor
version.   Arch can only assist with 32/64 bit.

Thanks for leads and ideas.

Scott



More information about the Discuss mailing list