#!/bin/sh ## ## NAUTILUS ## SCRIPT: 00_anyfile_LIST-HARDWARE_lsusb-lspci-lshw-etc.sh ## ## PURPOSE: List hardware info for this computer --- using ## 'lsusb', 'lspci', 'lshw', 'lscpu', 'lsb_release', 'uname'. ## ## METHOD: Puts the output in a text file and shows the text file in ## a text-viewer of the user's choice. ## ## HOW TO USE: In Nautilus, select ANY file in ANY directory. ## Then right-click and choose this script to run (name above). ## ############################################################################## ## Script ## Created: 2010may12 ## Changed: 2011may02 Add $USER to a temp filename. ## Changed: 2011may11 Get 'nautilus-scripts' directory via an include script. ## Changed: 2012apr18 Changed script name in comments above and touched up ## the comments. Changed some indenting below. ## Changed: 2012jun21 Changed order of commands and script name to match. ############################################################################# ## FOR TESTING: (show statements as they execute) # set -x ################################################################## ## Prep a temporary filename, to hold the list of filenames. ## We put the outlist file in /tmp, in case the user ## does not have write-permission in the current directory, ## and because the output does not, usually, have anything ## to do with the current directory. ################################################################## OUTLIST="/tmp/${USER}_list_hardware_ls_usb_pci_hw_etc.lis" if test -f "$OUTLIST" then rm -f "$OUTLIST" fi ################################ ## Make the HEADER for the list. ################################ THISHOST=`hostname` echo "\ ................ `date '+%Y %b %d %a %T%p %Z'` ...................... Hardware info (via 'lsusb', 'lspci', 'lshw', 'lscpu', 'lsb_release', 'uname') --- for host: $THISHOST Some more information is at the bottom of this list. ------------------------------------------------------------------------------ " > "$OUTLIST" ############################################################## ## Add 'lsusb' output to the report. ############################################################## EXECHECK=`which lsusb` if test -f "$EXECHECK" then echo " ##### lsusb : ##### " >> $OUTLIST lsusb >> "$OUTLIST" fi ############################################################## ## Add 'lspci' and 'lspci -vv' output to the report. ############################################################## EXECHECK=`which lspci` if test -f "$EXECHECK" then echo " ##### lspci : ##### " >> $OUTLIST lspci >> "$OUTLIST" echo " ######### lspci -vv : ######### " >> $OUTLIST lspci -vv >> "$OUTLIST" fi ############################################################## ## Add 'lshw' output to the report. ############################################################## EXECHECK=`which lshw` if test -f "$EXECHECK" then echo " #### lshw : #### " >> $OUTLIST lshw >> "$OUTLIST" fi ############################################################## ## Add 'lsdvd' output to the report. ## Shows error: Can't find device /dev/dvd ############################################################## # EXECHECK=`which lsdvd` # # if test -f "$EXECHECK" # then # echo " # ##### # lsdvd : # ##### # " >> $OUTLIST # lsdvd >> "$OUTLIST" # fi echo " ................ `date '+%Y %b %d %a %T%p %Z'` ...................... " >> "$OUTLIST" ############################################################## ## Add 'lscpu' output to the report. ############################################################## EXECHECK=`which lscpu` if test -f "$EXECHECK" then echo " ##### lscpu : ##### " >> $OUTLIST lscpu >> "$OUTLIST" fi ############################################################## ## Add 'uname' output to the report. ############################################################## EXECHECK=`which uname` if test -f "$EXECHECK" then echo " ##### uname -a : ##### " >> $OUTLIST uname -a >> "$OUTLIST" fi ############################################################## ## Add 'lsb_release' output to the report. ############################################################## EXECHECK=`which lsb_release` if test -f "$EXECHECK" then echo " ########### lsb_release -a : ########### " >> $OUTLIST lsb_release -a >> "$OUTLIST" fi ################################# ## Make the TRAILER for the list. ################################# SCRIPT_BASENAME=`basename $0` SCRIPT_DIRNAME=`dirname $0` echo " ................ `date '+%Y %b %d %a %T%p %Z'` ...................... The list above was generated by the script $SCRIPT_BASENAME in directory $SCRIPT_DIRNAME If you want to add more host config info via more commands, you can simply edit the script. ------------------------------------------------------------------------------ FOR MORE INFO ON THESE EXECUTABLES: For some of these topics (or commands like 'lshw'), you can type 'man ' to see details on the topic. ('man' stands for Manual. It gives you a user manual for the command/utility/protocol/topic.) You can type 'man man' at a shell prompt to see a description of the 'man' command. Or use the 'show_manhelp_4topic' Nautilus script in the 'LinuxHELPS' group of Nautilus scripts. ******* END OF LIST of hardware info on host $THISHOST ******* ................ `date '+%Y %b %d %a %T%p %Z'` ...................... " >> "$OUTLIST" ############################### ## Show the listing. ############################### ## . $HOME/.gnome2/nautilus-scripts/.set_VIEWERvars.shi . $HOME/.freedomenv/feNautilusScripts/set_DIR_NautilusScripts.shi . $DIR_NautilusScripts/.set_VIEWERvars.shi $TXTVIEWER "$OUTLIST"