#!/bin/sh ## ## NAUTILUS ## SCRIPT: 00_anyfile_LIST-HAL-DEVICES-ABBREVIATED_lshal-grep.sh ## ## PURPOSE: List HAL (Hardware Abstraction Layer) devices for this computer ## --- using 'lshal' --- selecting out records having to do ## with 'human-readable' data. ## ## 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: 2012apr06 ## Changed: 2012apr18 Touched up the comments above. ############################################################################ ## FOR TESTING: (show statements as they execute) # set -x ################################################################## ## Prep a temporary filename, to hold the list. ## 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_HAL_devices_abbrev.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'` ...................... HAL (Hardware Abstraction Layer) devices - ABBREVIATED LISTING ('human readable' info) --- for host: $THISHOST This data, extracted from the 'lshal' command, is especially useful for finding mount info for BLOCK (disk) devices and USB devices. Some more information is at the bottom of this list. ------------------------------------------------------------------------------ " > "$OUTLIST" ################################################# ## Use 'lshal' to make the main part of the list. ################################################# EXECHECK=`which lshal` if test -f "$EXECHECK" then echo " ##### lshal : ##### " >> $OUTLIST lshal | \ egrep '^$|^udi = |\.fstype|\.fsusage|\.device |\.major |\.minor |\.device_file|\.device_number|\.mount_point|\.mount_type|\.automount|\.hotpluggable|.\partitioning|\.partition.scheme|\.partition.number|\.removable|\.requires_eject|\.is_disc|\.is_mounted|\.is_partition|.\volume.uuid|vendor =|product =|\.file|\.type' \ >> "$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 HAL device info via more commands, you can simply edit the script. ------------------------------------------------------------------------------ FOR MORE INFO ON THESE EXECUTABLES: For some of these topics (or commands like 'lshal'), 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. ******* END OF LIST of hardware info on host $THISHOST ******* " >> "$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" exit ## SAMPLE lshal OUTPUT: udi = '/org/freedesktop/Hal/devices/volume_uuid_3b1d999f_0306_4bc5_af1f_477fc4fa3734' block.device = '/dev/sda5' (string) block.is_volume = true (bool) block.major = 8 (0x8) (int) block.minor = 5 (0x5) (int) block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_Hitachi_HTS545016B9A300_100329PBPB06ECC4ZDML' (string) info.capabilities = {'volume', 'block'} (string list) info.category = 'volume' (string) info.interfaces = {'org.freedesktop.Hal.Device.Volume'} (string list) info.parent = '/org/freedesktop/Hal/devices/storage_serial_Hitachi_HTS545016B9A300_100329PBPB06ECC4ZDML' (string) info.product = 'Volume (ext3)' (string) info.udi = '/org/freedesktop/Hal/devices/volume_uuid_3b1d999f_0306_4bc5_af1f_477fc4fa3734' (string) linux.hotplug_type = 3 (0x3) (int) linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5' (string) org.freedesktop.Hal.Device.Volume.method_argnames = {'mount_point fstype extra_options', 'extra_options', 'extra_options'} (string list) org.freedesktop.Hal.Device.Volume.method_execpaths = {'hal-storage-mount', 'hal-storage-unmount', 'hal-storage-eject'} (string list) org.freedesktop.Hal.Device.Volume.method_names = {'Mount', 'Unmount', 'Eject'} (string list) org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'} (string list) volume.block_size = 512 (0x200) (int) volume.fstype = 'ext3' (string) volume.fsusage = 'filesystem' (string) volume.fsversion = '1.0' (string) volume.ignore = false (bool) volume.is_disc = false (bool) volume.is_mounted = true (bool) volume.is_mounted_read_only = false (bool) volume.is_partition = true (bool) volume.label = '' (string) volume.linux.is_device_mapper = false (bool) volume.mount.valid_options = {'ro', 'sync', 'dirsync', 'noatime', 'nodiratime', 'noexec', 'quiet', 'remount', 'exec', 'acl', 'user_xattr', 'data='} (string list) volume.mount_point = '/home' (string) volume.num_blocks = 154368522 (0x9337a0a) (uint64) volume.partition.media_size = 160041885696 (0x25433d6000) (uint64) volume.partition.number = 5 (0x5) (int) volume.partition.start = 79999105536 (0x12a0517a00) (uint64) volume.size = 79036683264 (0x1266f41400) (uint64) volume.unmount.valid_options = {'lazy'} (string list) volume.uuid = '3b1d999f-0306-4bc5-af1f-477fc4fa3734' (string)