| View previous topic :: View next topic |
| Author |
Message |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Wed Oct 15, 2008 2:13 am Post subject: |
|
|
Update 3: I managed to get Mandriva 2009 running and lo-and-behold, it has the lshw package as well Ran the latest version (0.003 as per the link) w/o any problems. Good, even 1sf (troll) can use it now Can somebody confirm that Fedora and Suse has the lshw package in their repo's as well? If that's the case it's safe to assume (IMO!) that the lshw package is generally available for Linux and the script doesn't need tweaking in that respect.
Suggestions and contributions are still welcome! (and properly credited if you put your real name in your message!) |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8002 Location: Warrington, UK
|
Posted: Wed Oct 15, 2008 9:23 am Post subject: |
|
|
lshw is pretty standard, but if you use something like the code in my first reply you're covered either way. _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
AdamW
Joined: Thu Apr 17, 2008 12:45 am Posts: 51
|
Posted: Thu Oct 23, 2008 4:48 am Post subject: |
|
|
Mandriva also provides lspcidrake , which will give you the Mandriva driver mappings, device description, and (with -v) the USB or PCI ID in a fairly concise and parseable form. _________________ Adam Williamson
Mandriva
Community manager | Newsletter editor | Bugmaster | Proofreader | Translator | Packager |
|
| Back to top |
|
 |
ollie Moderator

Joined: Mon Jul 25, 2005 12:26 pm Posts: 2749 Location: Bathurst NSW Australia
|
Posted: Fri Oct 24, 2008 2:30 am Post subject: |
|
|
Hi Dutch_Master,
I've been playing around with your script and realised I may have introduced a slight error with the code snippet I introduced.
The out put of the script is much more useful if it is continually appended to the "mysystem.txt" file. I missed a ">" with my code when setting the date/time the script was run. The full script should be:
| Code: | #! /bin/bash
#
# script to collect hardware and software data on your system
# you'll need to be root to get proper results
# currently only works in Debian based systems, with the lshw package installed
# with contributions by Nelz and Ollie from the LXF forums
# when did you last run this script?
echo ========= >> mysystem.txt
echo "System info at:" `date` >> mysystem.txt
echo ========= >> mysystem.txt
# what kernel are you running?
echo "uname -a:" >> mysystem.txt
uname -a >> mysystem.txt
echo ========= >> mysystem.txt
# check if lshw is installed, then find out all you want from your hardware with lshw
if which lshw &>/dev/null; then
lshw >> mysystem.txt
else
echo "You need to install lshw to use this script!"
fi
echo ========= >> mysystem.txt
chmod 644 mysystem.txt
echo "done! read the file mysystem.txt in the current directory"
echo "use the cat and grep commands to select sections of interest if you're on the commandline"
exit 0 |
PS - I also recommend adding a version number to the comments at the top of the script  |
|
| Back to top |
|
 |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Fri Oct 24, 2008 3:42 am Post subject: |
|
|
Ah, I see your change. Well, it works w/o the extra > which really is only cosmetic, isn't it? Version inclusion makes sense: it's in. I'll add the extra > though
Version 0.004 is available on the link in my original post on page 1
@AdamW: good to know, but that wasn't the intention of my script. This one is purely for gathering info on one's hardware as sometimes we get questions that require a bit more knowledge on the questionaire's hardware. I'm sure you, as a Mandriva dev, has experience with similar situations too, so feel free to use the script in Mandriva. Not yet decided on a licence, but it's free now and in the future. Hmm, given it relies on GPL software, there's an obvious choice here I guess? GPL then it is  |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8002 Location: Warrington, UK
|
Posted: Fri Oct 24, 2008 8:55 am Post subject: |
|
|
It's more than cosmetic, if you use > and the file already exists, it will be overwritten, unless you have the noclobber option set in your shell. In which case the script will bomb out with an error. _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
AdamW
Joined: Thu Apr 17, 2008 12:45 am Posts: 51
|
Posted: Fri Oct 24, 2008 8:59 pm Post subject: |
|
|
Dutch: yep, I was just adding it for information. Your script is neat, but I'm used to just using the output of lspcidrake -v. It provides everything I need to know for most issues - a vague idea of what the hardware actually is, its PCI / USB ID (always the most important thing, and the reason I hate lspci - neither lspci nor lspci -v lists the PCI ID by default, only lspci -n does...I mean, sheesh), and its default driver mapping. Of course, for a cross-distro effort, something generic like your script is needed. _________________ Adam Williamson
Mandriva
Community manager | Newsletter editor | Bugmaster | Proofreader | Translator | Packager |
|
| Back to top |
|
 |
SMcE

Joined: Sun Jul 31, 2005 8:23 am Posts: 10
|
Posted: Tue Jan 06, 2009 4:21 pm Post subject: |
|
|
Thanks Dutch_Master&friends for a very useful script. Now, if it just told me what version of Ubuntu I am using, it would be just perfect (at least I think it's Ubuntu, should never have changed that desktop wallpaper...)
A quick&dirty google gives me:
| Quote: |
$ cat /etc/issue
Ubuntu 8.04 \n \l
|
Which is pretty much what I needed to know, apart from the annoying formatting characters. lsb-release goes a bit futher for me:
| Quote: |
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04"
|
(so it's Hardy!!) but funnily running lsb_release gives me:
| Quote: |
$ lsb_release -v
No LSB modules are available.
|
Can anybody improve on these?? |
|
| Back to top |
|
 |
ollie Moderator

Joined: Mon Jul 25, 2005 12:26 pm Posts: 2749 Location: Bathurst NSW Australia
|
Posted: Sun Mar 08, 2009 5:46 am Post subject: |
|
|
I was starting to play around with getting more distro details as well SMcE and looked at "cat /etc/issue" and "cat /proc/version" instead of "uname -a" and "cat/lsb-release" provides more detail that is useful. So I have changed the script to:
| Code: | #! /bin/bash
#
# script to collect hardware and software data on your system
# you'll need to be root to get proper results
# tested on Debian based systems, with the required lshw package
# installed and Mandriva 2009, who has the lshw package as well
# other distributions may work, if the lshw package is avalable and installed
# with contributions by Nelz and Ollie from the LXF forums
# see http://www.linuxformat.co.uk/index.php?name=PNphpBB2&file=viewtopic&t=8332
# this script is released under the GPL: http://www.gnu.org/copyleft/gpl.html
# current version: 0.005
# when did you last run this script?
echo ========= >> mysystem.txt
echo "System info at:" `date` >> mysystem.txt
echo ========= >> mysystem.txt
# what kernel are you running?
echo "Kernel details:" >> mysystem.txt
cat /proc/version >>mysystem.txt
echo "Distro LSB details:" >> mysystem.txt
cat /etc/lsb-release >> mysystem.txt
echo ========= >> mysystem.txt
# check if lshw is installed, then find out all you want from your hardware with lshw
if which lshw &>/dev/null; then
lshw >> mysystem.txt
else
echo "You need to install lshw to use this script!"
fi
echo ========= >> mysystem.txt
chmod 644 mysystem.txt
echo "Done! Read the file mysystem.txt in the current directory"
echo "Use the cat and grep commands to select sections of interest if you're on the commandline"
echo "Or open this file in a graphical editor like Kwrite or Gedit. Please, do not use Notepad!!"
exit 0 |
Do you think this is a useful update DM? |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8002 Location: Warrington, UK
|
Posted: Sun Mar 08, 2009 10:34 am Post subject: |
|
|
/etc/lsb-release isn't always there. Some distros install the LSB stuff as a separate, optional, package and for other distros it is just not relevant. To avoid the script aborting when the file isn't found, use
| Code: | | [[ -f /etc/lsb-release ]] && cat /etc/lsb-release >> mysystem.txt |
_________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Sat Oct 09, 2010 4:58 am Post subject: |
|
|
Admittedly "a tad" late, but version 0.006 as per Ollie and Nelz's suggestions can be found on the link in the original post on page 1. Unless some-one has a serious issue with it, it might be worth putting a Sticky on this thread for future (pun intended) visitors. (Mike, that's a hint ) And moving it to the Help section might improve its usage too  |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|