(12-01-2014, 04:25 PM)sysdrum link Wrote: I am working on clean up, did you ever look at the code I updated here:
https://www.freecinema2022.gq/forums/index...pic=1145.0
Sorry I didn't have much time.
When I had free time I worked on Create System Report GUI
LL 2.2 will be out very soon and we want to include this.
So I've made a few changes.
-Swithed list to radiolist
-The first option is set to default
-Added optional save location
-Script changes the ownership of the report file
Code:
#!/bin/bash
# Linux Lite System Information Report Tool for Ubuntu based systems
# Dependencies - lshw, dmidecode, hdparm
# Developer - Misko_2083, Jerry Bezencon
# Creation Date - 30th November, 2013
# Website - http://www.freecinema2022.gq
DATE=$(date +"%A-%d-%B-%Y-%T")
rm -rf /tmp/systeminfo*
# Script start
if zenity --question --title="Create System Report" --text="Click Yes to proceed or No to cancel"; then
# Create file and insert date
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Report Date: "$(date +"%r, %d - %m - %Y") >> /tmp/systeminfo-"${DATE}".txt
now=$(date +"%r, %d - %m - %Y") >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
# Begin reporting information
(
echo "1"
echo "#This Report may take a while to generate..."
sleep 2
echo "5"
echo "#Collecting Bios & Motherboard Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Bios & Motherboard Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo " BIOS:" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
sudo dmidecode -t 0 >> /tmp/systeminfo-"${DATE}".txt
echo " MOTHERBOARD:" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
sudo dmidecode -t 2 >> /tmp/systeminfo-"${DATE}".txt
sudo dmidecode -t 3 >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "10"
echo "#CPU Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "CPU Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
grep "model name" /proc/cpuinfo >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
lscpu >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "17"
echo "#Collecting Memory Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Memory Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo " RAM SPEED:" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
sudo dmidecode --type 17 | grep -i speed >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo " PHYSICAL RAM DETAILS (one section per ram slot):" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
sudo dmidecode --type 17 >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "25"
echo "#Collecting Graphics Chip Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Graphics Chip Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
sudo lshw -C display >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "40"
echo "#Collecting Sound Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Sound Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
aplay --list-devices >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "45"
echo "#Collecting Hard Drive/SSD Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Hard Drive/SSD Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
df -T >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo " MOUNT:" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
mount >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo " FDISK:" >> /tmp/systeminfo-"${DATE}".txt
sudo fdisk -l /dev/sda >> /tmp/systeminfo-"${DATE}".txt
sudo fdisk -l /dev/sdb >> /tmp/systeminfo-"${DATE}".txt
sudo fdisk -l /dev/sdc >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo " HDPARM:" >> /tmp/systeminfo-"${DATE}".txt
sudo hdparm -i /dev/sda >> /tmp/systeminfo-"${DATE}".txt
sudo hdparm -i /dev/sdb >> /tmp/systeminfo-"${DATE}".txt
sudo hdparm -i /dev/sdc >> /tmp/systeminfo-"${DATE}".txt
echo "50"
echo "#Collecting Groups Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Groups Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
groups $USER >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "55"
echo "#Collecting PCI Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "PCI Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
lspci >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "60"
echo "#Collecting USB Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "USB Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
lsusb >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "65"
echo "#Collecting Kernel Modules Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Kernel Modules Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
lsmod >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "70"
echo "#Collecting Kernel & OS Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Kernel & Operating System Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
uname -a >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
lsb_release -d >> /tmp/systeminfo-"${DATE}".txt
lsb_release -i >> /tmp/systeminfo-"${DATE}".txt
lsb_release -c >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "Based on:" >> /tmp/systeminfo-"${DATE}".txt
cat /etc/issue.net >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "75"
echo "#Collecting Network Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Network Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
ifconfig >> /tmp/systeminfo-"${DATE}".txt
more /etc/network/interfaces >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
sudo lshw -C network >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "80"
echo "#Collecting Environment Variables..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Environment Variables Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
printenv >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "85"
echo "#Collecting Software Information..."
sleep 1
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "Software Installed Information" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
dpkg --list >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "End of Report" >> /tmp/systeminfo-"${DATE}".txt
echo "===========================================================" >> /tmp/systeminfo-"${DATE}".txt
echo "" >> /tmp/systeminfo-"${DATE}".txt
echo "#Done"
echo "100"
) | zenity --progress --auto-close --title="Collecting System Information..." --no-cancel
else
exit
fi
# Prompt user to open report
if zenity --question --title="Create System Report" --text="Click View Report or Quit" --ok-label="View Report" --cancel-label="Quit" ; then
zenity --text-info --width=800 --height=700 --ok-label="Save" --cancel-label="Quit" < /tmp/systeminfo-"${DATE}".txt
if [ $? -ne 0 ]; then
exit
else
#get normal users
# User id MIN and MAX: grep "^UID_MIN" /etc/login.defs; grep "^UID_MAX" /etc/login.defs
# Print users and groups: awk -F':' '$3>=1000 && $3<=60000 {print $1" "$3}' /etc/passwd
#Generate the save list and on the first occurance of "FALSE" change it to "TRUE"
LL_LIST_D=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1}' /etc/passwd |sed '0,/FALSE/s/FALSE/TRUE/'`)
#Add optional save location
LL_LIST_H=(`awk -F':' '$3>=1000 && $3<=60000 {print "FALSE","/home/"$1"/Desktop"}' /etc/passwd`)
save_location=$(zenity --list --radiolist --text="Select the save location" --column="1" --column="2" "${LL_LIST_D[@]}" "${LL_LIST_H[@]}")
if [ $? -ne 0 ]; then
exit
else
#Extract username
LL_USER=$(echo "$save_location" | cut -d'/' -f3)
# Add filename to the save path
SAVE_PATH=$(echo $save_location| sed 's,.*,&\/systeminfo-'"${DATE}"'.txt,g')
# copy the file from /tmp
cp /tmp/systeminfo-"${DATE}".txt $save_location
#Change owner of the file to LL_USER
sudo chown $LL_USER $SAVE_PATH
fi
fi
else
exit
fi
exit