Re: [Discuss] Getting OS/HW details?
On Nov 2, 2012, at 1:09 PM, Scott Ehrlich wrote: 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? My approach would be to use something that's already available, unless there was a pressing need otherwise. I'd suggest facter by folks at the Puppet labs: http://www.puppetlabs.com/puppet/related-projects/facter/ # facter operatingsystem CentOS # facter operatingsystemrelease 6.2 # facter productname X8DTT-INF There are a lot more facts built-in: # facter | wc -l 75 ~irl ___ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss
Re: [Discuss] Getting OS/HW details?
On Sat, Nov 03, 2012 at 12:27:48PM -0400, Kurt Keville wrote: root@J1:~# uname -a Linux J1 3.0.0-9-generic #14-Ubuntu SMP Tue Aug 23 17:02:50 UTC 2011 i686athlon i386 GNU/Linux since it is Ubuntu and I have a date, I should be able to divine the distro... but 3.0.0-9-generic is unique to 11.10... and noone ever dowrevs a kernel, do they? The other methods are faster and more reliable, and pretty ubiquitous, so there's not a lot of incentive for someone to compile such a database. Distros probably never downgrade, but older distros may well upgrade, and that doesn't take into account if (you are not the admin of the box, and) the admin installs a custom kernel. -- Derek D. Martinhttp://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02 -=-=-=-=- This message is posted from an invalid address. Replying to it will result in undeliverable mail due to spam prevention. Sorry for the inconvenience. ___ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss
Re: [Discuss] Getting OS/HW details?
On Sun, Nov 4, 2012 at 4:36 AM, Derek Martin inva...@pizzashack.org wrote: On Sat, Nov 03, 2012 at 12:27:48PM -0400, Kurt Keville wrote: root@J1:~# uname -a Linux J1 3.0.0-9-generic #14-Ubuntu SMP Tue Aug 23 17:02:50 UTC 2011 i686athlon i386 GNU/Linux since it is Ubuntu and I have a date, I should be able to divine the distro... but 3.0.0-9-generic is unique to 11.10... and noone ever dowrevs a kernel, do they? The other methods are faster and more reliable, and pretty ubiquitous, so there's not a lot of incentive for someone to compile such a database. Distros probably never downgrade, but older distros may well upgrade, and that doesn't take into account if (you are not the admin of the box, and) the admin installs a custom kernel. Where custom can be very strange. I force installed a 64-bit stock Ubuntu kernel on a working 32-bit install. (I was tired of running a PAE kernel and wanted to stick with a 32-bit user space.) Turns out it actually ran fairly well.Unfortunately, I seem to recall that Ubuntu's update manager was confused by this setup. In addition, getting Virtualbox working in that environment didn't look to be easy... Bill Bogstad ___ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss
Re: [Discuss] Getting OS/HW details?
It is the rare install indeed that won't be well-described by the command line calls you have identified... on the remote chance you don't have an /etc/issue you should be able to grep dmesg for some keyword like version ... and if lspci doesn't tell you the exact motherboard you have, you can probably get enough info to Google with... but I'd be surprised if you have to go off-board for 1 out of 100 arbitrary installs. Still, it would be nice if there was a 1 stop shop, maybe a web page, where you could type in a kernel name and it would tell you the distro is most likely associated with. Take, for instance, root@J1:~# uname -a Linux J1 3.0.0-9-generic #14-Ubuntu SMP Tue Aug 23 17:02:50 UTC 2011 i686athlon i386 GNU/Linux since it is Ubuntu and I have a date, I should be able to divine the distro... but 3.0.0-9-generic is unique to 11.10... and noone ever dowrevs a kernel, do they? (seriously, do they? I've never seen it) ___ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss
Re: [Discuss] Getting OS/HW details?
On Fri, Nov 2, 2012 at 1:09 PM, Scott Ehrlich srehrl...@gmail.com wrote: 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? For systems that support the Linux Standard Base (LSB), the /etc/lsb-release file and lsb_release command are good ways to get OS information. For hardware, if you are running as root and it is installed; the dmidecode command is a good start. Good Luck, Bill Bogstad ___ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss
Re: [Discuss] Getting OS/HW details?
I'd take a look at the perl script memconf and see how it works. Even though it was written for Solaris, it does a decent job on Linux. It does like to be run as root, however. http://www.4schmidts.com/unix.html There is a package lshw on Fedora (among others) you could look at the source. decode-dimms, a perl script in lm-sensors, is another good source. It also wants to be run as root, and requires eeprom to be loaded. Jerry Natowitz ===j.natowitz (at) gmail.com On 11/02/12 13:09, Scott Ehrlich wrote: 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 ___ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss ___ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss
Re: [Discuss] Getting OS/HW details?
Noah Friedman friedman aaat splode dawt com maintains a shell script that is basically GNU autoconf's hosttype detection logic, standalone. It doesn't need root, but in some obscure situations may require a C compiler. It is certainly thermonuclear overkill for your situation, but will offer plenty of hints at technique if you really do feel the need to trim it down. ftp://ftp.splode.com/pub/users/friedman/inits/init-7.4.tar.gz contains a copy in init-7.4/bin/hosttype . ___ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss