Linux Lite Forums

Development => Scripting and Bash => Topic started by: anon222 on November 13, 2014, 09:17:40 PM

Title: Info tool
Post by: anon222 on November 13, 2014, 09:17:40 PM
This is a small info tool I've made. It displays some Hardware and System info.

Code: [Select]
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Info tool by Misko_2083
#--------------------------------------------------------------------------------------------------------

#inxi installed?
if [ -z "$(which inxi)"  ]; then

if zenity --title="Question" --question text="Inxi is not installed, do you want to install it?\nIf you choose No program will exit."
then
gksudo "sudo apt-get install inxi -y" | zenity --progress --title="Installing inxi" --text="please wait" --pulsate --auto-close
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
zenity --error --title="Error" --text="inxi could not be installed."
exit
fi
else
exit
fi
fi

disk_df=(FALSE "Fs disk space info" "df -Th | grep /dev/sd" "View filesystem disk space usage")

FDISK=(FALSE "List Partitions" "sudo fdisk -l" "List out the partition information (password required)")

BLOCKDEV=(FALSE "Display Block Devices" "lsblk" "List out information all block devices")

lspci_info=(FALSE "PCI info" "lspci -vnn" "View PCI devices info")

lspci_graph=(FALSE "Graphics" "lspci -vnn | grep VGA -A 12" "View graphics devices info")

lsusb_info=(FALSE "USB info" "lsusb" "View usb devices info")

CPU=(FALSE "32/64 bit CPU" " " "Find out is this 32 or 64 bit CPU")

CPUZ=(FALSE "Processor info" "lscpu" "Display detailed info on CPU")

OS=(FALSE "32/64 bit OS" "uname -a" "Find out is this 32 or 64 bit OS")

inxi_full=(FALSE "Full info" "inxi -Fxz" "View system info")

inxi_df=(FALSE "Partition info" "inxi -plu" "View partition info")

REPOS=(FALSE "View Repositories" "inxi -r" "View repositories on this sistem")

GRAPHICS=(FALSE "View Graphics" "inxi -Gxx" "View graphics on this sistem")

AUDIO=(FALSE "View Audio" "inxi -A" "View audio on this sistem")

NETWORK=(FALSE "View Network" "inxi -nz" "View network on this sistem")

NETWORKC=(FALSE "Network Configuration" "ifconfig -a" "View network  configuration on this sistem")

OPENGL=(FALSE "View OpenGL configuration" "glxinfo | grep OpenGL" "View OpenGL configuration on this sistem")

LSB=(FALSE "View lsb release" "lsb_release -dic" "View lsb release info")

ic="/usr/share/icons/zenity-llcc.png"
selection=$(zenity --window-icon="$ic" --list --radiolist --width=900 --height=700 --column="Select" --column="Name" --column="Command" \
--column="Description" --text="Select the info tool you wish to use, then click the Display button." --title="Info" --ok-label="Display" --cancel-label="Quit" --separator="\n" \
"${disk_df[@]}" \
"${FDISK[@]}" \
"${BLOCKDEV[@]}" \
"${lspci_info[@]}" \
"${lspci_graph[@]}" \
"${lsusb_info[@]}" \
"${CPU[@]}" \
"${CPUZ[@]}" \
"${OS[@]}" \
"${inxi_full[@]}" \
"${inxi_df[@]}" \
"${REPOS[@]}" \
"${GRAPHICS[@]}" \
"${AUDIO[@]}" \
"${NETWORK[@]}" \
"${NETWORKC[@]}" \
"${OPENGL[@]}" \
"${LSB[@]}" )

# If Quit is clicked then exit
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
exit 0
fi

# check if anything is selected
echo $selection | grep '[a-zA-Z0-9]'
if [ "${PIPESTATUS[1]}" -ne "0" ]; then
zenity --info --title='Info' --text='Nothing was selected.'
exit 0
fi

echo $selection | grep "^Fs disk space info" > /dev/null
if [ $? = 0 ];then
SOME_TEXT="df - View file system disk space usage\nYou can select the mount to open in the file manager"
SOME_TITLE="df"

df -h -T| tail -n+2 | while read fs type size used rest target; do
if [[ $rest ]] ; then
echo "$fs" "$type" "$size"B "$used"B "$rest"B "${target[@]}" |  grep /dev/sd | # remove "grep /dev/sd |" to show all
awk '{print $1,"\n",$2,"\n",$3,"\n",$4,"\n",$5,"\n",$6}BEGIN{ s = 7; e = 35; }{for (i=s; i<=e; i++) printf("%s%s", $(i), i<e ? OFS : "\n"); }' #Workaround for disk labels that contain whitespaces(number of characters that can be divided by whitespace =e-s)
fi
done | sed -e 's/[ \t]*$//' $1|zenity --list --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Device" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="7"| cut -d '|' -f2| tee /tmp/tempdf

#With radiolist is also an option
#done | sed -e 's/[ \t]*$//' $1| sed 's!^/dev/sd*!FALSE\n/dev/sd!g' | zenity --list --radiolist --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Select" --column="FS" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="8"| cut -d '|' -f2| tee /tmp/tempdf


if [ -z "$(cat /tmp/tempdf)" ]; then
exit 0
fi

xdg-open "$(cat /tmp/tempdf)"
rm -f /tmp/tempdf
fi

echo $selection | grep "List Partitions" > /dev/null
if [ $? = 0 ];then
gksudo --message 'To run this tool your password is required. Enter your password, or press Cancel.' 'sudo fdisk -l' |tee /tmp/lsblkinfo.txt| zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
leafpad /tmp/lsblkinfo.txt; rm /tmp/lsblkinfo.txt
else
exit 0
fi
fi

echo $selection | grep "Display Block Devices" > /dev/null
if [ $? = 0 ];then
lsblk | zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lsblk > /tmp/lsblkinfo.txt; leafpad /tmp/lsblkinfo.txt; rm /tmp/lsblkinfo.txt
else
exit 0
fi
fi

echo $selection | grep "PCI info" > /dev/null
if [ $? = 0 ];then
lspci -vnn | zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lspci -nn > /tmp/lspciinfo.txt; leafpad /tmp/lspciinfo.txt; rm /tmp/lspciinfo.txt
else
exit 0
fi
fi

echo $selection | grep "^Graphics$" > /dev/null
if [ $? = 0 ];then
lspci -vnn | grep VGA -A 12 | zenity --title="Graphics" --text-info --width=800 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
lspci -vnn | grep VGA -A 12  > /tmp/lspcigraph.txt; leafpad /tmp/lspcigraph.txt; rm /tmp/lspcigraph.txt
else
exit 0
fi
fi

echo $selection | grep "USB info" > /dev/null
if [ $? = 0 ];then
lsusb | zenity --title="USB info" --text-info --width=800 --height=400 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lsusb > /tmp/lsusbinfo.txt; leafpad /tmp/lsusbinfo.txt; rm /tmp/lsusbinfo.txt
else
exit 0
fi
fi

echo $selection | grep "32/64 bit CPU" > /dev/null
if [ $? = 0 ];then
if [ "$(egrep -c ' lm ' /proc/cpuinfo)" -lt "1" ]; then
bus_zen="32"
else
bus_zen="64"
fi
zenity --title="32/64 bit CPU" --info --text="This is $bus_zen bit CPU"
fi


echo $selection | grep "Processor info" > /dev/null
if [ $? = 0 ];then
lscpu | zenity --title="Processor info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lscpu > /tmp/processorinfo.txt; leafpad /tmp//tmp/processorinfo.txt; rm /tmp/processorinfo.txt
else
exit 0
fi
fi

echo $selection | grep "32/64 bit OS" > /dev/null
if [ $? = 0 ];then
if [ "$(uname -a | egrep -c 'i386|i486|i586|i686')" -eq "1" ]; then
os_zen="32"
else
os_zen="64"
fi
zenity --title="32/64 bit OS" --info --text="This is $os_zen bit OS"
fi

echo $selection | grep "Full info" > /dev/null
if [ $? = 0 ];then
inxi -Fxz -c 0 | zenity --title="Full info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -Fxz -c 0 > /tmp/inxifull.txt; leafpad /tmp/inxifull.txt; rm /tmp/inxifull.txt
else
exit 0
fi
fi

echo $selection | grep "Partition info" > /dev/null
if [ $? = 0 ];then
inxi -plu -c 0 | zenity --title="Partition info" --text-info --width=650 --height=400 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -plu -c 0 > /tmp/partitionsinfo.txt; leafpad /tmp/partitionsinfo.txt; rm /tmp/partitionsinfo.txt
else
exit 0
fi
fi

echo $selection | grep "View Repositories" > /dev/null
if [ $? = 0 ];then
inxi -r -c 0| zenity --title="Repositories" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -r -c 0 > /tmp/repositorieslist.txt; leafpad /tmp/repositorieslist.txt; rm /tmp/repositorieslist.txt
else
exit 0
fi
fi

echo $selection | grep "View Graphics" > /dev/null
if [ $? = 0 ];then
inxi -Gxx -c 0| zenity --title="Graphics info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -Gxx -c 0 > /tmp/graphicsinfo.txt; leafpad /tmp/graphicsinfo.txt; rm /tmp/graphicsinfo.txt
else
exit 0
fi
fi

echo $selection | grep "View Audio" > /dev/null
if [ $? = 0 ];then
inxi -A -c 0| zenity --title="Audio info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -A -c 0 > /tmp/audioinfo.txt; leafpad /tmp/audioinfo.txt; rm /tmp/audioinfo.txt
else
exit 0
fi
fi

echo $selection | grep "^View Network$" > /dev/null
if [ $? = 0 ];then
inxi -nz -c 0 | zenity --title="Network info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -nz -c 0 > /tmp/networkinfo.txt; leafpad /tmp/networkinfo.txt; rm /tmp/networkinfo.txt
else
exit 0
fi
fi

echo $selection | grep "Network Configuration" > /dev/null
if [ $? = 0 ];then
ifconfig -a | zenity --title="Network info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
ifconfig -a > /tmp/networkconfinfo.txt; leafpad /tmp/networkconfinfo.txt; rm /tmp/networkconfinfo.txt
else
exit 0
fi
fi

echo $selection | grep "View OpenGL configuration" > /dev/null
if [ $? = 0 ];then
glxinfo | grep OpenGL| zenity --title="View OpenGL configuration" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
glxinfo | grep OpenGL > /tmp/openglinfo.txt; leafpad /tmp/openglinfo.txt; rm /tmp/openglinfo.txt
else
exit 0
fi
fi

echo $selection | grep "View lsb release" > /dev/null
if [ $? = 0 ];then
lsb_release -dic| zenity --title="lsb_release" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lsb_release -dic > /tmp/lsbinfo.txt; leafpad /tmp/lsbinfo.txt; rm /tmp/lsbinfo.txt
else
exit 0
fi
fi
Title: Re: Info tool
Post by: rokytnji on November 14, 2014, 11:49:56 AM
I'd help if I knew how to write code.

My linux skills are I know how to converse in Linux.

When it gets to like, "Now open the language book <insert preferred languge here> and this is how the syntax goes.
I get lost because I do not know python, c, c++, or anything for that matter.

More of a monkey see, monkey do kinda of user.
I have a good memory and know how Linux file structure is laid out.

So. Here is what I did. I copied your text file and named it
Quote
inxi.sh
and saveed it in ~/Documents
Made it executable.

(http://thumbnails110.imagebam.com/36443/e38acf364422680.jpg) (http://www.imagebam.com/image/e38acf364422680)

Let me know if I am following your idea OK so far. I will check out all the functions later on as this is a busy part of my day
working on motorcycles because the weather is getting warmer in my shop.

Title: Re: Info tool
Post by: rokytnji on November 14, 2014, 02:09:30 PM
Lunch Time. !st button

(http://thumbnails111.imagebam.com/36445/7b1f0e364445581.jpg) (http://www.imagebam.com/image/7b1f0e364445581)

The next are in a text file I made

Code: [Select]
#####List Partitions button#########
Disk /dev/sda: 121.3 GB, 121332826112 bytes
255 heads, 63 sectors/track, 14751 cylinders, total 236978176 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1   236978175   118489087+  ee  GPT

#########Above readout Does not show my /home partition. Since fdisk -l is invoked. Shouldn't it.
 Block device button below does though###########

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   113G  0 disk
├─sda1   8:1    0   8.8G  0 part /
└─sda2   8:2    0 104.2G  0 part /home
sr0     11:0    1  1024M  0 rom 

#########PCI Info button (lspci -vnn)########

00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 14h Processor Root Complex [1022:1510]
Subsystem: Advanced Micro Devices, Inc. [AMD] Family 14h Processor Root Complex [1022:1510]
Flags: bus master, 66MHz, medium devsel, latency 32

00:01.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Wrestler [Radeon HD 6250] [1002:9804] (prog-if 00 [VGA controller])
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, fast devsel, latency 0, IRQ 45
Memory at c0000000 (32-bit, prefetchable) [size=256M]
I/O ports at 4000 [size=256]
Memory at d0400000 (32-bit, non-prefetchable) [size=256K]
Expansion ROM at <unassigned> [disabled]
Capabilities: <access denied>
Kernel driver in use: radeon

00:11.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] [1002:4391] (prog-if 01 [AHCI 1.0])
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 19
I/O ports at 4118 [size=8]
I/O ports at 4124 [size=4]
I/O ports at 4110 [size=8]
I/O ports at 4120 [size=4]
I/O ports at 4100 [size=16]
Memory at d0449000 (32-bit, non-prefetchable) [size=1K]
Capabilities: <access denied>
Kernel driver in use: ahci

00:12.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller [1002:4397] (prog-if 10 [OHCI])
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 18
Memory at d0448000 (32-bit, non-prefetchable) [size=4K]
Kernel driver in use: ohci-pci

00:12.2 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller [1002:4396] (prog-if 20 [EHCI])
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 17
Memory at d0447000 (32-bit, non-prefetchable) [size=256]
Capabilities: <access denied>
Kernel driver in use: ehci-pci

00:14.0 SMBus [0c05]: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 SMBus Controller [1002:4385] (rev 42)
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: 66MHz, medium devsel
Kernel driver in use: piix4_smbus

00:14.2 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) [1002:4383] (rev 40)
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, slow devsel, latency 32, IRQ 16
Memory at d0440000 (64-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: snd_hda_intel

00:14.3 ISA bridge [0601]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 LPC host controller [1002:439d] (rev 40)
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, 66MHz, medium devsel, latency 0

00:14.4 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 PCI to PCI Bridge [1002:4384] (rev 40) (prog-if 01 [Subtractive decode])
Flags: bus master, 66MHz, medium devsel, latency 64
Bus: primary=00, secondary=01, subordinate=01, sec-latency=64

00:14.5 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller [1002:4399] (prog-if 10 [OHCI])
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 18
Memory at d0446000 (32-bit, non-prefetchable) [size=4K]
Kernel driver in use: ohci-pci

00:15.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] SB700/SB800/SB900 PCI to PCI bridge (PCIE port 0) [1002:43a0] (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=02, subordinate=05, sec-latency=0
I/O behind bridge: 00003000-00003fff
Memory behind bridge: d0300000-d03fffff
Prefetchable memory behind bridge: 00000000d0000000-00000000d00fffff
Capabilities: <access denied>
Kernel driver in use: pcieport

00:15.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] SB700/SB800/SB900 PCI to PCI bridge (PCIE port 1) [1002:43a1] (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=06, subordinate=06, sec-latency=0
I/O behind bridge: 00002000-00002fff
Prefetchable memory behind bridge: 00000000d0100000-00000000d01fffff
Capabilities: <access denied>
Kernel driver in use: pcieport

00:15.3 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] SB900 PCI to PCI bridge (PCIE port 3) [1002:43a3] (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=07, subordinate=07, sec-latency=0
Memory behind bridge: d0200000-d02fffff
Capabilities: <access denied>
Kernel driver in use: pcieport

00:16.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller [1002:4397] (prog-if 10 [OHCI])
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 18
Memory at d0445000 (32-bit, non-prefetchable) [size=4K]
Kernel driver in use: ohci-pci

00:16.2 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller [1002:4396] (prog-if 20 [EHCI])
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 17
Memory at d0444000 (32-bit, non-prefetchable) [size=256]
Capabilities: <access denied>
Kernel driver in use: ehci-pci

00:18.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 0 [1022:1700] (rev 43)
Flags: fast devsel

00:18.1 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 1 [1022:1701]
Flags: fast devsel

00:18.2 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 2 [1022:1702]
Flags: fast devsel

00:18.3 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 3 [1022:1703]
Flags: fast devsel
Capabilities: <access denied>
Kernel driver in use: k10temp

00:18.4 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 4 [1022:1704]
Flags: fast devsel

00:18.5 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 6 [1022:1718]
Flags: fast devsel

00:18.6 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 5 [1022:1716]
Flags: fast devsel

00:18.7 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 7 [1022:1719]
Flags: fast devsel

02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader [10ec:5209] (rev 01)
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, fast devsel, latency 0, IRQ 43
Memory at d0300000 (32-bit, non-prefetchable) [size=4K]
Capabilities: <access denied>
Kernel driver in use: rtsx_pci

06:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller [10ec:8136] (rev 05)
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, fast devsel, latency 0, IRQ 44
I/O ports at 2000 [size=256]
Memory at d0104000 (64-bit, prefetchable) [size=4K]
Memory at d0100000 (64-bit, prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: r8169

07:00.0 Network controller [0280]: Ralink corp. RT5390 Wireless 802.11n 1T/1R PCIe [1814:5390]
Subsystem: Hewlett-Packard Company U98Z077.00 Half-size Mini PCIe Card [103c:1636]
Flags: bus master, fast devsel, latency 0, IRQ 23
Memory at d0200000 (32-bit, non-prefetchable) [size=64K]
Capabilities: <access denied>
Kernel driver in use: rt2800pci

#########Graphics button#################

00:01.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Wrestler [Radeon HD 6250] [1002:9804] (prog-if 00 [VGA controller])
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, fast devsel, latency 0, IRQ 45
Memory at c0000000 (32-bit, prefetchable) [size=256M]
I/O ports at 4000 [size=256]
Memory at d0400000 (32-bit, non-prefetchable) [size=256K]
Expansion ROM at <unassigned> [disabled]
Capabilities: <access denied>
Kernel driver in use: radeon

00:11.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] [1002:4391] (prog-if 01 [AHCI 1.0])
Subsystem: Hewlett-Packard Company Device [103c:3577]
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 19

########USB Button##############

Bus 002 Device 002: ID 04f2:b293 Chicony Electronics Co., Ltd
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


Cpu Button below

(http://thumbnails109.imagebam.com/36445/eba83e364445864.jpg) (http://www.imagebam.com/image/eba83e364445864)

@misko. The inxi.sh script gui script closes after every info check. i have to reopen it for the next check to be done.
The one we use in AntiX. Yes we have one also. Stays open. It returns you to the menu gui to check the next item.
The one in AntiX spits out the readout in roxterm (rox terminal) so when you close the terminal. It returns you to the menu GUI.

Lunchtime. Time to eat.

Laterz, Rok

Title: Re: Info tool
Post by: anon222 on November 14, 2014, 03:06:42 PM
Thank you Rok,  :)
The second button was using wrong text file. That could be it. Try sudo fdisk -l
here is the new script
Code: [Select]
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Info tool by Misko_2083
#--------------------------------------------------------------------------------------------------------

#inxi installed?
if [ -z "$(which inxi)"  ]; then

if zenity --title="Question" --question text="Inxi is not installed, do you want to install it?\nIf you choose No program will exit."
then
gksudo "sudo apt-get install inxi -y" | zenity --progress --title="Installing inxi" --text="please wait" --pulsate --auto-close
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
zenity --error --title="Error" --text="inxi could not be installed."
exit
fi
else
exit
fi
fi

disk_df=(FALSE "Fs disk space info" "df -Th | grep /dev/sd" "View filesystem disk space usage")

FDISK=(FALSE "List Partitions" "sudo fdisk -l" "List out the partition information (password required)")

BLOCKDEV=(FALSE "Display Block Devices" "lsblk" "List out information all block devices")

lspci_info=(FALSE "PCI info" "lspci -vnn" "View PCI devices info")

lspci_graph=(FALSE "Graphics" "lspci -vnn | grep VGA -A 12" "View graphics devices info")

lsusb_info=(FALSE "USB info" "lsusb" "View usb devices info")

CPU=(FALSE "32/64 bit CPU" " " "Find out is this 32 or 64 bit CPU")

CPUZ=(FALSE "Processor info" "lscpu" "Display detailed info on CPU")

OS=(FALSE "32/64 bit OS" "uname -a" "Find out is this 32 or 64 bit OS")

inxi_full=(FALSE "Full info" "inxi -Fxz" "View system info")

inxi_df=(FALSE "Partition info" "inxi -plu" "View partition info")

REPOS=(FALSE "View Repositories" "inxi -r" "View repositories on this sistem")

GRAPHICS=(FALSE "View Graphics" "inxi -Gxx" "View graphics on this sistem")

AUDIO=(FALSE "View Audio" "inxi -A" "View audio on this sistem")

NETWORK=(FALSE "View Network" "inxi -nz" "View network on this sistem")

NETWORKC=(FALSE "Network Configuration" "ifconfig -a" "View network  configuration on this sistem")

OPENGL=(FALSE "View OpenGL configuration" "glxinfo | grep OpenGL" "View OpenGL configuration on this sistem")

LSB=(FALSE "View lsb release" "lsb_release -dic" "View lsb release info")

ic="/usr/share/icons/zenity-llcc.png"
selection=$(zenity --window-icon="$ic" --list --radiolist --width=900 --height=700 --column="Select" --column="Name" --column="Command" \
--column="Description" --text="Select the info tool you wish to use, then click the Display button." --title="Info" --ok-label="Display" --cancel-label="Quit" --separator="\n" \
"${disk_df[@]}" \
"${FDISK[@]}" \
"${BLOCKDEV[@]}" \
"${lspci_info[@]}" \
"${lspci_graph[@]}" \
"${lsusb_info[@]}" \
"${CPU[@]}" \
"${CPUZ[@]}" \
"${OS[@]}" \
"${inxi_full[@]}" \
"${inxi_df[@]}" \
"${REPOS[@]}" \
"${GRAPHICS[@]}" \
"${AUDIO[@]}" \
"${NETWORK[@]}" \
"${NETWORKC[@]}" \
"${OPENGL[@]}" \
"${LSB[@]}" )

# If Quit is clicked then exit
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
exit 0
fi

# check if anything is selected
echo $selection | grep '[a-zA-Z0-9]'
if [ "${PIPESTATUS[1]}" -ne "0" ]; then
zenity --info --title='Info' --text='Nothing was selected.'
exit 0
fi

echo $selection | grep "^Fs disk space info" > /dev/null
if [ $? = 0 ];then
SOME_TEXT="df - View file system disk space usage\nYou can select the mount to open in the file manager"
SOME_TITLE="df"

df -h -T| tail -n+2 | while read fs type size used rest target; do
if [[ $rest ]] ; then
echo "$fs" "$type" "$size"B "$used"B "$rest"B "${target[@]}" |  grep /dev/sd | # remove "grep /dev/sd |" to show all
awk '{print $1,"\n",$2,"\n",$3,"\n",$4,"\n",$5,"\n",$6}BEGIN{ s = 7; e = 35; }{for (i=s; i<=e; i++) printf("%s%s", $(i), i<e ? OFS : "\n"); }' #Workaround for disk labels that contain whitespaces(number of characters that can be divided by whitespace =e-s)
fi
done | sed -e 's/[ \t]*$//' $1|zenity --list --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Device" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="7"| cut -d '|' -f2| tee /tmp/tempdf

#With radiolist is also an option
#done | sed -e 's/[ \t]*$//' $1| sed 's!^/dev/sd*!FALSE\n/dev/sd!g' | zenity --list --radiolist --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Select" --column="FS" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="8"| cut -d '|' -f2| tee /tmp/tempdf


if [ -z "$(cat /tmp/tempdf)" ]; then
exit 0
fi

xdg-open "$(cat /tmp/tempdf)"
rm -f /tmp/tempdf
fi

echo $selection | grep "List Partitions" > /dev/null
if [ $? = 0 ];then
gksudo --message 'To run this tool your password is required. Enter your password, or press Cancel.' 'sudo fdisk -l' |tee /tmp/fdiskinfo.txt| zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
leafpad /tmp/fdiskinfo.txt
rm /tmp/fdiskinfo.txt
else
exit 0
fi
fi

echo $selection | grep "Display Block Devices" > /dev/null
if [ $? = 0 ];then
lsblk | zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lsblk > /tmp/lsblkinfo.txt; leafpad /tmp/lsblkinfo.txt; rm /tmp/lsblkinfo.txt
else
exit 0
fi
fi

echo $selection | grep "PCI info" > /dev/null
if [ $? = 0 ];then
lspci -vnn | zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lspci -nn > /tmp/lspciinfo.txt; leafpad /tmp/lspciinfo.txt; rm /tmp/lspciinfo.txt
else
exit 0
fi
fi

echo $selection | grep "^Graphics$" > /dev/null
if [ $? = 0 ];then
lspci -vnn | grep VGA -A 12 | zenity --title="Graphics" --text-info --width=800 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
lspci -vnn | grep VGA -A 12  > /tmp/lspcigraph.txt; leafpad /tmp/lspcigraph.txt; rm /tmp/lspcigraph.txt
else
exit 0
fi
fi

echo $selection | grep "USB info" > /dev/null
if [ $? = 0 ];then
lsusb | zenity --title="USB info" --text-info --width=800 --height=400 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lsusb > /tmp/lsusbinfo.txt; leafpad /tmp/lsusbinfo.txt; rm /tmp/lsusbinfo.txt
else
exit 0
fi
fi

echo $selection | grep "32/64 bit CPU" > /dev/null
if [ $? = 0 ];then
if [ "$(egrep -c ' lm ' /proc/cpuinfo)" -lt "1" ]; then
bus_zen="32"
else
bus_zen="64"
fi
zenity --title="32/64 bit CPU" --info --text="This is $bus_zen bit CPU"
fi


echo $selection | grep "Processor info" > /dev/null
if [ $? = 0 ];then
lscpu | zenity --title="Processor info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lscpu > /tmp/processorinfo.txt; leafpad /tmp//tmp/processorinfo.txt; rm /tmp/processorinfo.txt
else
exit 0
fi
fi

echo $selection | grep "32/64 bit OS" > /dev/null
if [ $? = 0 ];then
if [ "$(uname -a | egrep -c 'i386|i486|i586|i686')" -eq "1" ]; then
os_zen="32"
else
os_zen="64"
fi
zenity --title="32/64 bit OS" --info --text="This is $os_zen bit OS"
fi

echo $selection | grep "Full info" > /dev/null
if [ $? = 0 ];then
inxi -Fxz -c 0 | zenity --title="Full info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -Fxz -c 0 > /tmp/inxifull.txt; leafpad /tmp/inxifull.txt; rm /tmp/inxifull.txt
else
exit 0
fi
fi

echo $selection | grep "Partition info" > /dev/null
if [ $? = 0 ];then
inxi -plu -c 0 | zenity --title="Partition info" --text-info --width=650 --height=400 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -plu -c 0 > /tmp/partitionsinfo.txt; leafpad /tmp/partitionsinfo.txt; rm /tmp/partitionsinfo.txt
else
exit 0
fi
fi

echo $selection | grep "View Repositories" > /dev/null
if [ $? = 0 ];then
inxi -r -c 0| zenity --title="Repositories" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -r -c 0 > /tmp/repositorieslist.txt; leafpad /tmp/repositorieslist.txt; rm /tmp/repositorieslist.txt
else
exit 0
fi
fi

echo $selection | grep "View Graphics" > /dev/null
if [ $? = 0 ];then
inxi -Gxx -c 0| zenity --title="Graphics info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -Gxx -c 0 > /tmp/graphicsinfo.txt; leafpad /tmp/graphicsinfo.txt; rm /tmp/graphicsinfo.txt
else
exit 0
fi
fi

echo $selection | grep "View Audio" > /dev/null
if [ $? = 0 ];then
inxi -A -c 0| zenity --title="Audio info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -A -c 0 > /tmp/audioinfo.txt; leafpad /tmp/audioinfo.txt; rm /tmp/audioinfo.txt
else
exit 0
fi
fi

echo $selection | grep "^View Network$" > /dev/null
if [ $? = 0 ];then
inxi -nz -c 0 | zenity --title="Network info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
inxi -nz -c 0 > /tmp/networkinfo.txt; leafpad /tmp/networkinfo.txt; rm /tmp/networkinfo.txt
else
exit 0
fi
fi

echo $selection | grep "Network Configuration" > /dev/null
if [ $? = 0 ];then
ifconfig -a | zenity --title="Network info" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
ifconfig -a > /tmp/networkconfinfo.txt; leafpad /tmp/networkconfinfo.txt; rm /tmp/networkconfinfo.txt
else
exit 0
fi
fi

echo $selection | grep "View OpenGL configuration" > /dev/null
if [ $? = 0 ];then
glxinfo | grep OpenGL| zenity --title="View OpenGL configuration" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
glxinfo | grep OpenGL > /tmp/openglinfo.txt; leafpad /tmp/openglinfo.txt; rm /tmp/openglinfo.txt
else
exit 0
fi
fi

echo $selection | grep "View lsb release" > /dev/null
if [ $? = 0 ];then
lsb_release -dic| zenity --title="lsb_release" --text-info --width=850 --height=600 --ok-label="Open in Leafpad" --cancel-label="Close"
if [ "${PIPESTATUS[1]}" -ne "1" ]; then
lsb_release -dic > /tmp/lsbinfo.txt; leafpad /tmp/lsbinfo.txt; rm /tmp/lsbinfo.txt
else
exit 0
fi
fi
I think I can make the script to use check boxes instead of radio buttons. That way you can select multiple items.
The other option is to reopen the gui after each check. The AntiX way. :) I didn't know you have one there.
Do you have any commands to recommend? inxi or something else
Title: Re: Info tool
Post by: rokytnji on November 14, 2014, 03:36:55 PM
Quote
inxireadout.txt.zip.
You cannot upload that type of file. The only allowed extensions are txt,pdf.

I forgot the forum limitations here. My Bad.  ???

The rest of the buttons worked OK as far as the test went. For full readout. I like

Code: [Select]
inxi -zv7
instead of

Code: [Select]
inxi -Fxz
when I post. Also for troubleshooting inxi on any new install. I run

Code: [Select]
inxi --recommends
to see what I am missing for a better inxi report.

I will delete the old inxi.sh I made from your previous script and test out the new one later on.

Happy Trails, Rok
Title: Re: Info tool
Post by: rokytnji on November 14, 2014, 03:53:08 PM
Another tool we use in our control center for applications like this one. Localizing all things like this in a control center since we use
Window Managers in AntiX instead of Desktop Enviornments.

Well we  have a button in the control center for editing config files. Named "Edit Config Files"
What it does. It asks for your password of course. Then opens geany. In Geany.
/etc/apt/sources.lstiles
/etc/default/grub
/etc/fstab
I can't remember the others right now because I am not on my AntiX computer right now.
But to give you a general idea of our control center.

(http://4.bp.blogspot.com/-HDrxvH6C8iQ/UqD8fK7_FRI/AAAAAAAAB7U/4qBDZ7oq--Y/s1600/antixcontrolcentre.jpg)

Pretty spiffy for a non Desktop Enviornment, Debian Based, Fits on a CD distro.
We run a lot of personal scripts in our distro like you are attempting to do.

Problem is. systemd is playing hell with some of those scripts  since the switch to systemd was made.
Which is making it hell trying to get AntiX 14 out the door.
I am also busy helping working out those bugs also.
So I will be stepping out from here from time to time.



Title: Re: Info tool
Post by: rokytnji on November 14, 2014, 04:01:46 PM
Quote
Thank you Rok,  :)
The second button was using wrong text file. That could be it. Try sudo fdisk -l
here is the new script

Brain Fart on my end miscko. The problem is not your button. It is the way I have this partitioned. It slipped my mind I am using gpt instead of msdos in my partition layout.
I forgot.

Code: [Select]
harry@biker1:~$ sudo fdisk -l
[sudo] password for harry:

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 121.3 GB, 121332826112 bytes
255 heads, 63 sectors/track, 14751 cylinders, total 236978176 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1   236978175   118489087+  ee  GPT
harry@biker1:~$ sudo parted -l
Model: ATA APPLE SSD SM128 (scsi)
Disk /dev/sda: 121GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  9438MB  9437MB  ext4
 2      9438MB  121GB   112GB   ext3

Sorry, My Bad again.  ???

Title: Re: Info tool
Post by: gold_finger on November 14, 2014, 06:56:38 PM
Great job again misko_2083!

Just tested it out on my system (64-bit LL 2.0) and all categories worked well.

Title: Re: Info tool
Post by: rbdflyboy on November 14, 2014, 07:09:04 PM
Nice script...works great...nice output and quick...Thanks


[sudo] password for rick:

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeb2deb2d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63    85851388    42925663    7  HPFS/NTFS/exFAT
/dev/sda2        85852158   156301311    35224577    5  Extended
/dev/sda5       155258880   156301311      521216   82  Linux swap / Solaris
/dev/sda6        85852160   155258879    34703360   83  Linux

Title: Re: Info tool
Post by: shengchieh on November 14, 2014, 10:17:48 PM
Personally, there is no need to "reinvent the wheel".  I just add a few codes and be done with it.  See

[size=-1]http://www.webupd8.org/2011/07/how-to-get-hardware-information-in.html (http://www.webupd8.org/2011/07/how-to-get-hardware-information-in.html) (How To Get Hardware Information In Linux; 7/27/11)
  http://maketecheasier.com/gather-hardware-information-in-linux/2011/05/12 (http://maketecheasier.com/gather-hardware-information-in-linux/2011/05/12) (http://maketecheasier.com/gather-hardware-information-in-linux/2011/05/12)
  http://www.linux.com/learn/tutorials/620416:discovering-and-monitoring-hardware-in-linux- (http://www.linux.com/learn/tutorials/620416:discovering-and-monitoring-hardware-in-linux-) (Discovering and Monitoring Hardware in Linux; 8/17/12)
  http://www.binarytides.com/inxi-system-information-linux/ (http://www.binarytides.com/inxi-system-information-linux/) (Inxi is an amazing tool to check hardware information on Linux; 1/8/14)
  http://www.zdnet.co.uk/blogs/the-open-source-revolution-10014902/is-your-pc-slowing-down-10018071/ (http://www.zdnet.co.uk/blogs/the-open-source-revolution-10014902/is-your-pc-slowing-down-10018071/) Is your PC slowing down?; 7/20/10)
  http://www.binarytides.com/linux-cpu-information/ (http://www.binarytides.com/linux-cpu-information/) (8 commads to check cpu information on Linux; 3/16/14)
  http://www.binarytides.com/linux-commands-hardware-info/ (http://www.binarytides.com/linux-commands-hardware-info/) (16 commands to check hardware information on Linux; 4/8/14)
  http://www.itworld.com/virtualization/419480/how-interpret-cpu-load-linux (http://www.itworld.com/virtualization/419480/how-interpret-cpu-load-linux) (How to interpret CPU load on Linux; 5/19/14)

Sheng-Chieh
 [/size]
Title: Re: Info tool
Post by: anon222 on November 15, 2014, 05:30:21 PM
The rest of the buttons worked OK as far as the test went. For full readout. I like
Code: [Select]
inxi -zv7instead of
Code: [Select]
inxi -Fxz
Thank you you Rok
I see, it gives more info
Nice script...works great...nice output and quick...Thanks
You are welcome. :)
Personally, there is no need to "reinvent the wheel".  I just add a few codes and be done with it.  See
:)
It's not about reinventing the wheel, it's about making thing easier.
Title: Re: Info tool
Post by: Mike on November 28, 2014, 09:23:48 AM
Personally, there is no need to "reinvent the wheel".
Not all wheels are created equal.
Title: Re: Info tool
Post by: TMG1961 on November 28, 2014, 11:55:39 AM
Question..how do you use this? I havent got a clue what to do with it or even how to get it working.
Could someone explain to me how to use these scripts?
Title: Re: Info tool
Post by: rokytnji on November 28, 2014, 12:34:53 PM
Just do like I did in the 2nd post and then left click it.
Title: Re: Info tool
Post by: TMG1961 on November 28, 2014, 04:52:59 PM
Just do like I did in the 2nd post and then left click it.

Thanks..did that but had no idea how to make it executable. Did google it but didnt understand it at first. Tried several times before i finally got it to work.
Title: Re: Info tool
Post by: sysdrum on November 28, 2014, 05:09:50 PM
The only issue I have is in the dependency on Leafpad is there a way you could set it to run a check for dependency when it is run with a notice. I had to edit it to use mousepad as I don't use leafpad.
Title: Re: Info tool
Post by: Mike on November 28, 2014, 11:00:02 PM
Great job misko! I like it.

Based on sysdrum's feedback, could you perhaps utilize the $EDITOR system variable? Unfortunately it wasn't set in LL so I had to do export EDITOR = leafpad. Maybe you could do an if statement to see if leafpad or mousepad is installed. If not then default to nano. Just a thought.
Title: Re: Info tool
Post by: sysdrum on November 28, 2014, 11:59:00 PM

Updated the code for those that use mousepad. I may try and tweak it to add switch for leafpad or mousepad or if neither are installed to pick one. But for now it will install mousepad if it is not installed.

Code: [Select]
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Info tool by Misko_2083 Update Sysdrum
#--------------------------------------------------------------------------------------------------------


#inxi installed?
if [ -z "$(which inxi)"  ]; then


   if zenity --title="Question" --question text="Inxi is not installed, do you want to install it?\nIf you choose No program will exit."
   then
      gksudo "sudo apt-get install inxi -y" | zenity --progress --title="Installing inxi" --text="please wait" --pulsate --auto-close
            if [ "${PIPESTATUS[0]}" -ne "0" ]; then
               zenity --error --title="Error" --text="inxi could not be installed."
               exit
            fi
   
   else
      exit
   fi
fi
#mousepad installed?
if [ $(dpkg-query -W -f='${Status}' mousepad 2>/dev/null | grep -c "ok installed") -eq 0 ];then


   if zenity --title="Question" --question text="Mousepad is not installed, do you want to install it?\nIf you choose No program will exit."
   then
      gksudo "sudo apt-get install mousepad -y" | zenity --progress --title="Installing Mousepad" --text="please wait" --pulsate --auto-close     
            if [ "${PIPESTATUS[0]}" -ne "0" ]; then
               zenity --error --title="Error" --text="Mousepad could not be installed."
               exit
            fi
   else
      exit
   fi
fi


disk_df=(FALSE "Fs disk space info" "df -Th | grep /dev/sd" "View filesystem disk space usage")


FDISK=(FALSE "List Partitions" "sudo fdisk -l" "List out the partition information (password required)")


BLOCKDEV=(FALSE "Display Block Devices" "lsblk" "List out information all block devices")


lspci_info=(FALSE "PCI info" "lspci -vnn" "View PCI devices info")


lspci_graph=(FALSE "Graphics" "lspci -vnn | grep VGA -A 12" "View graphics devices info")


lsusb_info=(FALSE "USB info" "lsusb" "View usb devices info")


CPU=(FALSE "32/64 bit CPU" " " "Find out is this 32 or 64 bit CPU")


CPUZ=(FALSE "Processor info" "lscpu" "Display detailed info on CPU")


OS=(FALSE "32/64 bit OS" "uname -a" "Find out is this 32 or 64 bit OS")


inxi_full=(FALSE "Full info" "inxi -Fxz" "View system info")


inxi_df=(FALSE "Partition info" "inxi -plu" "View partition info")


REPOS=(FALSE "View Repositories" "inxi -r" "View repositories on this sistem")


GRAPHICS=(FALSE "View Graphics" "inxi -Gxx" "View graphics on this sistem")


AUDIO=(FALSE "View Audio" "inxi -A" "View audio on this sistem")


NETWORK=(FALSE "View Network" "inxi -nz" "View network on this sistem")


NETWORKC=(FALSE "Network Configuration" "ifconfig -a" "View network  configuration on this sistem")


OPENGL=(FALSE "View OpenGL configuration" "glxinfo | grep OpenGL" "View OpenGL configuration on this sistem")


LSB=(FALSE "View lsb release" "lsb_release -dic" "View lsb release info")


ic="/usr/share/icons/zenity-llcc.png"
selection=$(zenity --window-icon="$ic" --list --radiolist --width=900 --height=700 --column="Select" --column="Name" --column="Command" \
--column="Description" --text="Select the info tool you wish to use, then click the Display button." --title="Info" --ok-label="Display" --cancel-label="Quit" --separator="\n" \
"${disk_df[@]}" \
"${FDISK[@]}" \
"${BLOCKDEV[@]}" \
"${lspci_info[@]}" \
"${lspci_graph[@]}" \
"${lsusb_info[@]}" \
"${CPU[@]}" \
"${CPUZ[@]}" \
"${OS[@]}" \
"${inxi_full[@]}" \
"${inxi_df[@]}" \
"${REPOS[@]}" \
"${GRAPHICS[@]}" \
"${AUDIO[@]}" \
"${NETWORK[@]}" \
"${NETWORKC[@]}" \
"${OPENGL[@]}" \
"${LSB[@]}" )


# If Quit is clicked then exit
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
exit 0
fi


# check if anything is selected
echo $selection | grep '[a-zA-Z0-9]'
if [ "${PIPESTATUS[1]}" -ne "0" ]; then
zenity --info --title='Info' --text='Nothing was selected.'
exit 0
fi


echo $selection | grep "^Fs disk space info" > /dev/null
if [ $? = 0 ];then
   SOME_TEXT="df - View file system disk space usage\nYou can select the mount to open in the file manager"
   SOME_TITLE="df"


   df -h -T| tail -n+2 | while read fs type size used rest target; do
      if [[ $rest ]] ; then
         echo "$fs" "$type" "$size"B "$used"B "$rest"B "${target[@]}" |  grep /dev/sd | # remove "grep /dev/sd |" to show all
         awk '{print $1,"\n",$2,"\n",$3,"\n",$4,"\n",$5,"\n",$6}BEGIN{ s = 7; e = 35; }{for (i=s; i<=e; i++) printf("%s%s", $(i), i<e ? OFS : "\n"); }' #Workaround for disk labels that contain whitespaces(number of characters that can be divided by whitespace =e-s)
      fi
   done | sed -e 's/[ \t]*$//' $1|zenity --list --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Device" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="7"| cut -d '|' -f2| tee /tmp/tempdf


   #With radiolist is also an option
   #done | sed -e 's/[ \t]*$//' $1| sed 's!^/dev/sd*!FALSE\n/dev/sd!g' | zenity --list --radiolist --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Select" --column="FS" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="8"| cut -d '|' -f2| tee /tmp/tempdf




   if [ -z "$(cat /tmp/tempdf)" ]; then
   exit 0
   fi


   xdg-open "$(cat /tmp/tempdf)"
   rm -f /tmp/tempdf
fi


echo $selection | grep "List Partitions" > /dev/null
if [ $? = 0 ];then
   gksudo --message 'To run this tool your password is required. Enter your password, or press Cancel.' 'sudo fdisk -l' |tee /tmp/lsblkinfo.txt| zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[2]}" -ne "1" ]; then
       mousepad /tmp/lsblkinfo.txt; rm /tmp/lsblkinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "Display Block Devices" > /dev/null
if [ $? = 0 ];then
   lsblk | zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lsblk > /tmp/lsblkinfo.txt; mousepad /tmp/lsblkinfo.txt; rm /tmp/lsblkinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "PCI info" > /dev/null
if [ $? = 0 ];then
   lspci -vnn | zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lspci -nn > /tmp/lspciinfo.txt; mousepad /tmp/lspciinfo.txt; rm /tmp/lspciinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "^Graphics$" > /dev/null
if [ $? = 0 ];then
   lspci -vnn | grep VGA -A 12 | zenity --title="Graphics" --text-info --width=800 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[2]}" -ne "1" ]; then
      lspci -vnn | grep VGA -A 12  > /tmp/lspcigraph.txt; mousepad /tmp/lspcigraph.txt; rm /tmp/lspcigraph.txt
   else
      exit 0
   fi
fi


echo $selection | grep "USB info" > /dev/null
if [ $? = 0 ];then
   lsusb | zenity --title="USB info" --text-info --width=800 --height=400 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lsusb > /tmp/lsusbinfo.txt; mousepad /tmp/lsusbinfo.txt; rm /tmp/lsusbinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "32/64 bit CPU" > /dev/null
if [ $? = 0 ];then
   if [ "$(egrep -c ' lm ' /proc/cpuinfo)" -lt "1" ]; then
      bus_zen="32"
   else
      bus_zen="64"
   fi
      zenity --title="32/64 bit CPU" --info --text="This is $bus_zen bit CPU"
fi




echo $selection | grep "Processor info" > /dev/null
if [ $? = 0 ];then
   lscpu | zenity --title="Processor info" --text-info --width=850 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lscpu > /tmp/processorinfo.txt; mousepad /tmp//tmp/processorinfo.txt; rm /tmp/processorinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "32/64 bit OS" > /dev/null
if [ $? = 0 ];then
   if [ "$(uname -a | egrep -c 'i386|i486|i586|i686')" -eq "1" ]; then
      os_zen="32"
   else
      os_zen="64"
   fi
      zenity --title="32/64 bit OS" --info --text="This is $os_zen bit OS"
fi


echo $selection | grep "Full info" > /dev/null
if [ $? = 0 ];then
   inxi -Fxz -c 0 | zenity --title="Full info" --text-info --width=850 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -Fxz -c 0 > /tmp/inxifull.txt; mousepad /tmp/inxifull.txt; rm /tmp/inxifull.txt
   else
      exit 0
   fi
fi


echo $selection | grep "Partition info" > /dev/null
if [ $? = 0 ];then
   inxi -plu -c 0 | zenity --title="Partition info" --text-info --width=650 --height=400 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -plu -c 0 > /tmp/partitionsinfo.txt; mousepad /tmp/partitionsinfo.txt; rm /tmp/partitionsinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "View Repositories" > /dev/null
if [ $? = 0 ];then
   inxi -r -c 0| zenity --title="Repositories" --text-info --width=850 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -r -c 0 > /tmp/repositorieslist.txt; mousepad /tmp/repositorieslist.txt; rm /tmp/repositorieslist.txt
   else
      exit 0
   fi   
fi


echo $selection | grep "View Graphics" > /dev/null
if [ $? = 0 ];then
   inxi -Gxx -c 0| zenity --title="Graphics info" --text-info --width=850 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -Gxx -c 0 > /tmp/graphicsinfo.txt; mousepad /tmp/graphicsinfo.txt; rm /tmp/graphicsinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "View Audio" > /dev/null
if [ $? = 0 ];then
   inxi -A -c 0| zenity --title="Audio info" --text-info --width=850 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -A -c 0 > /tmp/audioinfo.txt; mousepad /tmp/audioinfo.txt; rm /tmp/audioinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "^View Network$" > /dev/null
if [ $? = 0 ];then
   inxi -nz -c 0 | zenity --title="Network info" --text-info --width=850 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -nz -c 0 > /tmp/networkinfo.txt; mousepad /tmp/networkinfo.txt; rm /tmp/networkinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "Network Configuration" > /dev/null
if [ $? = 0 ];then
   ifconfig -a | zenity --title="Network info" --text-info --width=850 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      ifconfig -a > /tmp/networkconfinfo.txt; mousepad /tmp/networkconfinfo.txt; rm /tmp/networkconfinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "View OpenGL configuration" > /dev/null
if [ $? = 0 ];then
   glxinfo | grep OpenGL| zenity --title="View OpenGL configuration" --text-info --width=850 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[2]}" -ne "1" ]; then
      glxinfo | grep OpenGL > /tmp/openglinfo.txt; mousepad /tmp/openglinfo.txt; rm /tmp/openglinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "View lsb release" > /dev/null
if [ $? = 0 ];then
   lsb_release -dic| zenity --title="lsb_release" --text-info --width=850 --height=600 --ok-label="Open in Mousepad" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lsb_release -dic > /tmp/lsbinfo.txt; mousepad /tmp/lsbinfo.txt; rm /tmp/lsbinfo.txt
   else
      exit 0
   fi
fi
Title: Re: Info tool
Post by: anon222 on November 29, 2014, 02:57:46 AM
Hi sysdrum,
You have "fifi" in the last line :) Type enter in the middle to make it work.

I gave up from text editors in the script because I can't make it work with gedit.
Now there is a "Save" button instead of "Open in Leafpad".
Script is more efficient, and now uses checklists.
This way it is possible to select multiple items in the list.

Code: [Select]
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Info tool by Misko_2083
#--------------------------------------------------------------------------------------------------------

#inxi installed?
if [ -z "$(which inxi)"  ]; then

if zenity --title="Question" --question text="Inxi is not installed, do you want to install it?\nIf you choose No program will exit."
then
gksudo "sudo apt-get install inxi -y" | zenity --progress --title="Installing inxi" --text="please wait" --pulsate --auto-close
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
zenity --error --title="Error" --text="inxi could not be installed."
exit
fi
else
exit
fi
fi

disk_df=(FALSE "Fs disk space info" "df -Th | grep /dev/sd" "View filesystem disk space usage")

FDISK=(FALSE "List Partition Tables" "sudo fdisk -l" "List out the partition information (password required)")

BLOCKDEV=(FALSE "Display Block Devices" "lsblk" "List out information of all block devices")

PARTED=(FALSE "List Partition Layout" "sudo parted -l" "List partition layout on all block devices")

lspci_info=(FALSE "PCI info" "lspci -vnn" "View PCI devices info")

lspci_graph=(FALSE "Graphics" "lspci -vnn | grep VGA -A 12" "View graphics devices info")

lsusb_info=(FALSE "USB info" "lsusb" "View usb devices info")

CPU=(FALSE "32/64 bit CPU" "egrep -c ' lm ' /proc/cpuinfo" "Find out is this 32 or 64 bit CPU")

CPUZ=(FALSE "Processor info" "lscpu" "Display detailed info on CPU")

OS=(FALSE "32/64 bit OS" "uname -a" "Find out is this 32 or 64 bit OS")

inxi_full=(FALSE "Full info" "inxi -Fxz" "View system info")

inxi_df=(FALSE "Partition info" "inxi -plu" "View partition info")

REPOS=(FALSE "View Repositories" "inxi -r" "View repositories on this sistem")

GRAPHICS=(FALSE "View Graphics" "inxi -Gxx" "View graphics on this sistem")

AUDIO=(FALSE "View Audio" "inxi -A" "View audio on this sistem")

NETWORK=(FALSE "View Network" "inxi -nz" "View network on this sistem")

NETWORKC=(FALSE "Network Configuration" "ifconfig -a" "View network  configuration on this sistem")

OPENGL=(FALSE "View OpenGL configuration" "glxinfo | grep OpenGL" "View OpenGL configuration on this sistem")

LSB=(FALSE "View lsb release" "lsb_release -dic" "View lsb release info")

ic="/usr/share/icons/zenity-llcc.png"
selection=$(zenity --window-icon="$ic" --list --checklist --width=900 --height=700 --column="Select" --column="Name" --column="Command" \
--column="Description" --text="Select the info tool you wish to use, then click the Display button.\nYou can select multiple tools." --title="Info" --ok-label="Display" --cancel-label="Quit" --separator="\n" \
"${disk_df[@]}" \
"${FDISK[@]}" \
"${BLOCKDEV[@]}" \
"${PARTED[@]}" \
"${lspci_info[@]}" \
"${lspci_graph[@]}" \
"${lsusb_info[@]}" \
"${CPU[@]}" \
"${CPUZ[@]}" \
"${OS[@]}" \
"${inxi_full[@]}" \
"${inxi_df[@]}" \
"${REPOS[@]}" \
"${GRAPHICS[@]}" \
"${AUDIO[@]}" \
"${NETWORK[@]}" \
"${NETWORKC[@]}" \
"${OPENGL[@]}" \
"${LSB[@]}" )

# If Quit is clicked then exit
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
exit 0
fi

# check if anything is selected
echo $selection | grep '[a-zA-Z0-9]'
if [ "${PIPESTATUS[1]}" -ne "0" ]; then
zenity --info --title='Info' --text='Nothing was selected.'
exit 0
fi

echo $selection | grep "^Fs disk space info" > /dev/null
if [ $? = 0 ];then
SOME_TEXT="df - View file system disk space usage\nYou can select the mount to open in the file manager"
SOME_TITLE="df"

df -h -T| tail -n+2 | while read fs type size used rest target; do
if [[ $rest ]] ; then
echo "$fs" "$type" "$size"B "$used"B "$rest"B "${target[@]}" |  grep /dev/sd | # remove "grep /dev/sd |" to show all
awk '{print $1,"\n",$2,"\n",$3,"\n",$4,"\n",$5,"\n",$6}BEGIN{ s = 7; e = 35; }{for (i=s; i<=e; i++) printf("%s%s", $(i), i<e ? OFS : "\n"); }' #Workaround for disk labels that contain whitespaces(number of characters that can be divided by whitespace =e-s)
fi
done | sed -e 's/[ \t]*$//' $1|zenity --list --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Device" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="7"| cut -d '|' -f2| tee /tmp/tempdf

#With radiolist is also an option
#done | sed -e 's/[ \t]*$//' $1| sed 's!^/dev/sd*!FALSE\n/dev/sd!g' | zenity --list --radiolist --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Select" --column="FS" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="8"| cut -d '|' -f2| tee /tmp/tempdf


if [ -z "$(cat /tmp/tempdf)" ]; then
rm -f /tmp/tempdf
exit 0
fi

xdg-open "$(cat /tmp/tempdf)"
rm -f /tmp/tempdf
fi

echo $selection | grep "^List Partition Tables$" > /dev/null
if [ $? = 0 ];then
gksudo --message 'To run this tool your password is required. Enter your password, or press Cancel.' 'sudo fdisk -l' |tee /tmp/fdiskinfo| zenity --title="Partition Tables (sudo fdisk -l)" --text-info --width=800 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/fdiskinfo.txt)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Partition_Tables.txt" --title="Save List of the Partition Tables")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/fdiskinfo
fi

echo $selection | grep "Display Block Devices" > /dev/null
if [ $? = 0 ];then
lsblk  |tee /tmp/lsblkinfo | zenity --title="Block Devices (lsblk)" --text-info --width=800 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/lsblkinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Block_Devices.txt" --title="Save Block Devices info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/lsblkinfo
fi

echo $selection | grep "^List Partition Layout$" > /dev/null
if [ $? = 0 ];then
gksudo --message 'To run this tool your password is required. Enter your password, or press Cancel.' 'sudo parted -l'|tee /tmp/partedinfo | zenity --title="Partition Layout (sudo parted -l)" --text-info --width=800 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/partedinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Partition_layout.txt" --title="Save Partition Layout info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/partedinfo
fi

echo $selection | grep "^PCI info$" > /dev/null
if [ $? = 0 ];then
lspci -vnn | tee /tmp/lspciinfo | zenity --title="PCI info (lspci -vnn)" --text-info --width=800 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/lspciinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="PCI_Devices.txt" --title="Save PCI Devices info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/lspciinfo
fi

echo $selection | grep "^Graphics$" > /dev/null
if [ $? = 0 ];then
lspci -vnn | grep VGA -A 12 | tee /tmp/lspcigraph| zenity --title="Graphics (lspci -vnn | grep VGA -A 12)" --text-info --width=800 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[3]}" -ne "1" ]; then
zNewData=$(cat /tmp/lspcigraph)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Graphics_info.txt" --title="Save Graphics info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/lspcigraph
fi

echo $selection | grep "USB info" > /dev/null
if [ $? = 0 ];then
lsusb | tee /tmp/lsusbinfo | zenity --title="USB info (lsusb)" --text-info --width=800 --height=400 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/lsusbinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="USB_info.txt" --title="Save USB info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/lsusbinfo
fi

echo $selection | grep "32/64 bit CPU" > /dev/null
if [ $? = 0 ];then
if [ "$(egrep -c ' lm ' /proc/cpuinfo)" -lt "1" ]; then
bus_zen="32"
else
bus_zen="64"
fi
zenity --title="32/64 bit CPU" --info --text="This is $bus_zen bit CPU"
fi


echo $selection | grep "Processor info" > /dev/null
if [ $? = 0 ];then
lscpu | tee /tmp/processorinfo | zenity --title="Processor info (lscpu)" --text-info --width=850 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/processorinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="CPU_info.txt" --title="Save Processor info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/processorinfo
fi

echo $selection | grep "32/64 bit OS" > /dev/null
if [ $? = 0 ];then
if [ "$(uname -a | egrep -c 'i386|i486|i586|i686')" -eq "1" ]; then
os_zen="32"
else
os_zen="64"
fi
zenity --title="32/64 bit OS" --info --text="This is $os_zen bit OS"
fi

echo $selection | grep "Full info" > /dev/null
if [ $? = 0 ];then
inxi -Fxz -c 0 | tee /tmp/inxifull | zenity --title="Full info (inxi -Fxz)" --text-info --width=850 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/inxifull)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Full_info.txt" --title="Save Full Computer info")")
echo -n "$zNewData" > "$zSavePath"

fi
rm /tmp/inxifull
fi

echo $selection | grep "Partition info" > /dev/null
if [ $? = 0 ];then
inxi -plu -c 0 | tee /tmp/partitionsinfo| zenity --title="Partition info (inxi -plu)" --text-info --width=650 --height=400 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/partitionsinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Partition_info.txt" --title="Save Partition info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/partitionsinfo
fi

echo $selection | grep "View Repositories" > /dev/null
if [ $? = 0 ];then
inxi -r -c 0 | tee /tmp/repositorieslist | zenity --title="Repositories (inxi -r)" --text-info --width=850 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/repositorieslist)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Repositories.txt" --title="Save List Of The Repositories")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/repositorieslist
fi

echo $selection | grep "View Graphics" > /dev/null
if [ $? = 0 ];then
inxi -Gxx -c 0 | tee /tmp/graphicsinfo | zenity --title="Graphics info (inxi -Gxx)" --text-info --width=850 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/graphicsinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Graphics_inxi.txt" --title="Save Graphic information (inxi)")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/graphicsinfo
fi

echo $selection | grep "View Audio" > /dev/null
if [ $? = 0 ];then
inxi -A -c 0 | tee /tmp/audioinfo | zenity --title="Audio info (inxi -A)" --text-info --width=850 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/audioinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Audio_info.txt" --title="Save Audio information (inxi)")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/audioinfo
fi

echo $selection | grep "^View Network$" > /dev/null
if [ $? = 0 ];then
inxi -nz -c 0 | tee /tmp/networkinfo | zenity --title="Network info (inxi -nz)" --text-info --width=850 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/networkinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Network_inxi.txt" --title="Save Network information (inxi)")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/networkinfo
fi

echo $selection | grep "Network Configuration$" > /dev/null
if [ $? = 0 ];then
ifconfig -a | tee /tmp/networkconfinfo | zenity --title="Network info (ifconfig -a)" --text-info --width=850 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/networkconfinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Network_conf.txt" --title="Save Network Configuration Info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/networkconfinfo
fi

echo $selection | grep "View OpenGL configuration" > /dev/null
if [ $? = 0 ];then
glxinfo | grep OpenGL | tee /tmp/openglinfo | zenity --title="View OpenGL configuration (glxinfo | grep OpenGL)" --text-info --width=850 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[3]}" -ne "1" ]; then
zNewData=$(cat /tmp/openglinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="OpenGL_info.txt" --title="Save OpenGL Info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/openglinfo
fi

echo $selection | grep "View lsb release" > /dev/null
if [ $? = 0 ];then
lsb_release -dic| tee /tmp/lsbinfo | zenity --title="View lsb release (lsb_release -dic)" --text-info --width=850 --height=600 --ok-label="Save" --cancel-label="Close"
if [ "${PIPESTATUS[2]}" -ne "1" ]; then
zNewData=$(cat /tmp/lsbinfo)
zSavePath=$(echo -n "$(zenity --file-selection --save --confirm-overwrite --filename="Network_conf.txt" --title="Save ls_ release Info")")
echo -n "$zNewData" > "$zSavePath"
fi
rm /tmp/lsbinfo
fi
Title: Re: Info tool
Post by: sysdrum on November 29, 2014, 03:50:49 AM

This works on both xubuntu and LL 2.0 and 2.2 with Gedit

Code: [Select]
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Info tool working with Gedit by Misko_2083 Update Sysdrum
#--------------------------------------------------------------------------------------------------------


#inxi installed?
if [ -z "$(which inxi)"  ]; then


   if zenity --title="Question" --question text="Inxi is not installed, do you want to install it?\nIf you choose No program will exit."
   then
      gksudo "sudo apt-get install inxi -y" | zenity --progress --title="Installing inxi" --text="please wait" --pulsate --auto-close
            if [ "${PIPESTATUS[0]}" -ne "0" ]; then
               zenity --error --title="Error" --text="inxi could not be installed."
               exit
            fi
   
   else
      exit
   fi
fi
#gedit installed?
if [ $(dpkg-query -W -f='${Status}' gedit 2>/dev/null | grep -c "ok installed") -eq 0 ];then


   if zenity --title="Question" --question text="Gedit is not installed, do you want to install it?\nIf you choose No program will exit."
   then
      gksudo "sudo apt-get install gedit -y" | zenity --progress --title="Installing Gedit" --text="please wait" --pulsate --auto-close     
            if [ "${PIPESTATUS[0]}" -ne "0" ]; then
               zenity --error --title="Error" --text="Gedit could not be installed."
               exit
            fi
   else
      exit
   fi
fi


disk_df=(FALSE "Fs disk space info" "df -Th | grep /dev/sd" "View filesystem disk space usage")


FDISK=(FALSE "List Partitions" "sudo fdisk -l" "List out the partition information (password required)")


BLOCKDEV=(FALSE "Display Block Devices" "lsblk" "List out information all block devices")


lspci_info=(FALSE "PCI info" "lspci -vnn" "View PCI devices info")


lspci_graph=(FALSE "Graphics" "lspci -vnn | grep VGA -A 12" "View graphics devices info")


lsusb_info=(FALSE "USB info" "lsusb" "View usb devices info")


CPU=(FALSE "32/64 bit CPU" " " "Find out is this 32 or 64 bit CPU")


CPUZ=(FALSE "Processor info" "lscpu" "Display detailed info on CPU")


OS=(FALSE "32/64 bit OS" "uname -a" "Find out is this 32 or 64 bit OS")


inxi_full=(FALSE "Full info" "inxi -Fxz" "View system info")


inxi_df=(FALSE "Partition info" "inxi -plu" "View partition info")


REPOS=(FALSE "View Repositories" "inxi -r" "View repositories on this sistem")


GRAPHICS=(FALSE "View Graphics" "inxi -Gxx" "View graphics on this sistem")


AUDIO=(FALSE "View Audio" "inxi -A" "View audio on this sistem")


NETWORK=(FALSE "View Network" "inxi -nz" "View network on this sistem")


NETWORKC=(FALSE "Network Configuration" "ifconfig -a" "View network  configuration on this sistem")


OPENGL=(FALSE "View OpenGL configuration" "glxinfo | grep OpenGL" "View OpenGL configuration on this sistem")


LSB=(FALSE "View lsb release" "lsb_release -dic" "View lsb release info")


ic="/usr/share/icons/zenity-llcc.png"
selection=$(zenity --window-icon="$ic" --list --checklist --width=900 --height=700 --column="Select" --column="Name" --column="Command" \
--column="Description" --text="Select the info tool you wish to use, then click the Display button." --title="Info" --ok-label="Display" --cancel-label="Quit" --separator="\n" \
"${disk_df[@]}" \
"${FDISK[@]}" \
"${BLOCKDEV[@]}" \
"${lspci_info[@]}" \
"${lspci_graph[@]}" \
"${lsusb_info[@]}" \
"${CPU[@]}" \
"${CPUZ[@]}" \
"${OS[@]}" \
"${inxi_full[@]}" \
"${inxi_df[@]}" \
"${REPOS[@]}" \
"${GRAPHICS[@]}" \
"${AUDIO[@]}" \
"${NETWORK[@]}" \
"${NETWORKC[@]}" \
"${OPENGL[@]}" \
"${LSB[@]}" )


# If Quit is clicked then exit
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
exit 0
fi


# check if anything is selected
echo $selection | grep '[a-zA-Z0-9]'
if [ "${PIPESTATUS[1]}" -ne "0" ]; then
zenity --info --title='Info' --text='Nothing was selected.'
exit 0
fi


echo $selection | grep "^Fs disk space info" > /dev/null
if [ $? = 0 ];then
   SOME_TEXT="df - View file system disk space usage\nYou can select the mount to open in the file manager"
   SOME_TITLE="df"


   df -h -T| tail -n+2 | while read fs type size used rest target; do
      if [[ $rest ]] ; then
         echo "$fs" "$type" "$size"B "$used"B "$rest"B "${target[@]}" |  grep /dev/sd | # remove "grep /dev/sd |" to show all
         awk '{print $1,"\n",$2,"\n",$3,"\n",$4,"\n",$5,"\n",$6}BEGIN{ s = 7; e = 35; }{for (i=s; i<=e; i++) printf("%s%s", $(i), i<e ? OFS : "\n"); }' #Workaround for disk labels that contain whitespaces(number of characters that can be divided by whitespace =e-s)
      fi
   done | sed -e 's/[ \t]*$//' $1|zenity --list --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Device" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="7"| cut -d '|' -f2| tee /tmp/tempdf


   #With radiolist is also an option
   #done | sed -e 's/[ \t]*$//' $1| sed 's!^/dev/sd*!FALSE\n/dev/sd!g' | zenity --list --radiolist --width=685 --height=350 --title="${SOME_TITLE}" --text="${SOME_TEXT}" --column="Select" --column="FS" --column="Type" --column="Size" --column="Used" --column="Free" --column="%Used" --column="Mount" --print-column="8"| cut -d '|' -f2| tee /tmp/tempdf




   if [ -z "$(cat /tmp/tempdf)" ]; then
   exit 0
   fi


   xdg-open "$(cat /tmp/tempdf)"
   rm -f /tmp/tempdf
fi


echo $selection | grep "List Partitions" > /dev/null
if [ $? = 0 ];then
   gksudo --message 'To run this tool your password is required. Enter your password, or press Cancel.' 'sudo fdisk -l' |tee /tmp/lsblkinfo.txt| zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[2]}" -ne "1" ]; then
       gedit /tmp/lsblkinfo.txt; rm /tmp/lsblkinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "Display Block Devices" > /dev/null
if [ $? = 0 ];then
   lsblk | zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lsblk > /tmp/lsblkinfo.txt; gedit /tmp/lsblkinfo.txt; rm /tmp/lsblkinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "PCI info" > /dev/null
if [ $? = 0 ];then
   lspci -vnn | zenity --title="PCI info" --text-info --width=800 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lspci -nn > /tmp/lspciinfo.txt; gedit /tmp/lspciinfo.txt; rm /tmp/lspciinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "^Graphics$" > /dev/null
if [ $? = 0 ];then
   lspci -vnn | grep VGA -A 12 | zenity --title="Graphics" --text-info --width=800 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[2]}" -ne "1" ]; then
      lspci -vnn | grep VGA -A 12  > /tmp/lspcigraph.txt; gedit /tmp/lspcigraph.txt; rm /tmp/lspcigraph.txt
   else
      exit 0
   fi
fi


echo $selection | grep "USB info" > /dev/null
if [ $? = 0 ];then
   lsusb | zenity --title="USB info" --text-info --width=800 --height=400 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lsusb > /tmp/lsusbinfo.txt; gedit /tmp/lsusbinfo.txt; rm /tmp/lsusbinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "32/64 bit CPU" > /dev/null
if [ $? = 0 ];then
   if [ "$(egrep -c ' lm ' /proc/cpuinfo)" -lt "1" ]; then
      bus_zen="32"
   else
      bus_zen="64"
   fi
      zenity --title="32/64 bit CPU" --info --text="This is $bus_zen bit CPU"
fi




echo $selection | grep "Processor info" > /dev/null
if [ $? = 0 ];then
   lscpu | zenity --title="Processor info" --text-info --width=850 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lscpu > /tmp/processorinfo.txt; gedit /tmp//tmp/processorinfo.txt; rm /tmp/processorinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "32/64 bit OS" > /dev/null
if [ $? = 0 ];then
   if [ "$(uname -a | egrep -c 'i386|i486|i586|i686')" -eq "1" ]; then
      os_zen="32"
   else
      os_zen="64"
   fi
      zenity --title="32/64 bit OS" --info --text="This is $os_zen bit OS"
fi


echo $selection | grep "Full info" > /dev/null
if [ $? = 0 ];then
   inxi -Fxz -c 0 | zenity --title="Full info" --text-info --width=850 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -Fxz -c 0 > /tmp/inxifull.txt; gedit /tmp/inxifull.txt; rm /tmp/inxifull.txt
   else
      exit 0
   fi
fi


echo $selection | grep "Partition info" > /dev/null
if [ $? = 0 ];then
   inxi -plu -c 0 | zenity --title="Partition info" --text-info --width=650 --height=400 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -plu -c 0 > /tmp/partitionsinfo.txt; gedit /tmp/partitionsinfo.txt; rm /tmp/partitionsinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "View Repositories" > /dev/null
if [ $? = 0 ];then
   inxi -r -c 0| zenity --title="Repositories" --text-info --width=850 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -r -c 0 > /tmp/repositorieslist.txt; gedit /tmp/repositorieslist.txt; rm /tmp/repositorieslist.txt
   else
      exit 0
   fi   
fi


echo $selection | grep "View Graphics" > /dev/null
if [ $? = 0 ];then
   inxi -Gxx -c 0| zenity --title="Graphics info" --text-info --width=850 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -Gxx -c 0 > /tmp/graphicsinfo.txt; gedit /tmp/graphicsinfo.txt; rm /tmp/graphicsinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "View Audio" > /dev/null
if [ $? = 0 ];then
   inxi -A -c 0| zenity --title="Audio info" --text-info --width=850 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -A -c 0 > /tmp/audioinfo.txt; gedit /tmp/audioinfo.txt; rm /tmp/audioinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "^View Network$" > /dev/null
if [ $? = 0 ];then
   inxi -nz -c 0 | zenity --title="Network info" --text-info --width=850 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      inxi -nz -c 0 > /tmp/networkinfo.txt; gedit /tmp/networkinfo.txt; rm /tmp/networkinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "Network Configuration" > /dev/null
if [ $? = 0 ];then
   ifconfig -a | zenity --title="Network info" --text-info --width=850 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      ifconfig -a > /tmp/networkconfinfo.txt; gedit /tmp/networkconfinfo.txt; rm /tmp/networkconfinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "View OpenGL configuration" > /dev/null
if [ $? = 0 ];then
   glxinfo | grep OpenGL| zenity --title="View OpenGL configuration" --text-info --width=850 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[2]}" -ne "1" ]; then
      glxinfo | grep OpenGL > /tmp/openglinfo.txt; gedit /tmp/openglinfo.txt; rm /tmp/openglinfo.txt
   else
      exit 0
   fi
fi


echo $selection | grep "View lsb release" > /dev/null
if [ $? = 0 ];then
   lsb_release -dic| zenity --title="lsb_release" --text-info --width=850 --height=600 --ok-label="Open in Gedit" --cancel-label="Close"
   if [ "${PIPESTATUS[1]}" -ne "1" ]; then
      lsb_release -dic > /tmp/lsbinfo.txt; gedit /tmp/lsbinfo.txt; rm /tmp/lsbinfo.txt
   else
      exit 0
   fi
fi