#!/bin/sh ## ## NAUTILUS ## SCRIPT: 00_anyfile_list_softwarePackages_dpgk-l.sh ## ## PURPOSE: Lists (Debian) software packages installed on the host computer ## running this script. ## ## METHOD: Uses 'dpkg -l'. ## (Or could use 'dpkg --get-selections', which gives a listing ## without package descriptions.) ## ## Puts the output of 'dpkg -l' in a text file. ## ## Shows the text file using a text-file viewer of the user's ## choice. ## ## HOW TO USE: In the Nautilus file manager, right-click on the name of ## ANY file (or directory) in ANY Nautilus directory list. ## Then choose this script to run (name above). ## ## Created: 2010may12 ## Changed: 2011may02 Add $USER to a temp filename. ## Changed: 2011may11 Get 'nautilus-scripts' directory via an include script. ## Changed: 2012feb29 Changed the script name in the comment above. ## FOR TESTING: (show statements as they execute) # set -x ############################################################## ## Prep a temporary filename, to hold the list of filenames. ## We put the output 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. ############################################################# OUTFILE="/tmp/${USER}_list_softwarePackages_dfk-l.lis" if test -f "$OUTFILE" then rm -f "$OUTFILE" fi ##################################### ## Prepare a HEADING for the listing. ##################################### THISHOST=`hostname` echo "\ ................ `date '+%Y %b %d %a %T%p %Z'` ...................... Software Packages (per 'dpkg -l) --- for host: $THISHOST Some more information is at the bottom of this list. ------------------------------------------------------------------------------ " > "$OUTFILE" ##################################### ## Prepare the 'guts' of the listing. ##################################### EXECHECK=`which dpkg` if test -f "$EXECHECK" then echo " #### dpkg : #### " >> "$OUTFILE" dpkg -l >> "$OUTFILE" fi ## COULD USE: ## dpkg --get-selections ## to list currently installed packages. ############################### ## ADD a trailer to the listing. ############################### 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 software info via more commands, you can simply edit the script. ------------------------------------------------------------------------------ FOR MORE INFO ON THESE EXECUTABLES: For some of these topics (or commands like 'dpkg'), you can type 'man ' to see details on the topic. ('man' stands for Manual. It gives you a user manual for a 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 --- on 'dpkg' or any other command or topic. ******* END OF LIST of hardware info on host $THISHOST ******* " >> "$OUTFILE" ######################################################### ## Show the listing. ######################################################### ## . $HOME/.gnome2/nautilus-scripts/.set_VIEWERvars.shi . $HOME/.freedomenv/feNautilusScripts/set_DIR_NautilusScripts.shi . $DIR_NautilusScripts/.set_VIEWERvars.shi $TXTVIEWER "$OUTFILE" &