Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Reveal Bash Script Development Thread


  • Please log in to reply
322 replies to this topic

#316 NickAu

NickAu

    Bleepin Grumpy Aussie


  •  Avatar image
  • Members
  • 26,114 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Australia
  • Local time:10:09 PM

Posted 13 September 2015 - 08:46 PM

 

I'm assuming you don't have Cd-drive installed

No I dont.

nick@Unimatrix-1:~/Documents$ wc -l /proc/cpuinfo
104 /proc/cpuinfo

nick@Unimatrix-1:~$ inxi --version
inxi 1.9.17-00 (2013-12-02)
 
Program Location: /usr/bin
Website: http://inxi.goooglecode.com - IRC: irc.oftc.net channel: #smxi
Forums: http://techpatterns.com/forums/forum-33.html
 
inxi - the universal, portable, system information tool for console and irc.
This program is a fork of Infobash 3.02:
Copyright (C) 2005-2007  Michiel de Boer a.k.a. locsmif
Subsequent changes and modifications (after Infobash 3.02):
Copyright (C) 2008-2013-12-02 Scott Rogers, Harald Hope, aka trash80 & h2
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. (http://www.gnu.org/licenses/gpl.html)


Edited by NickAu, 13 September 2015 - 08:47 PM.

"When God shuts a Window, he opens a Linux." —Linus 8:7

 

 

 

 


BC AdBot (Login to Remove)

 


#317 Guest_hollowface_*

Guest_hollowface_*

  •  Avatar image
  • Guests
  • OFFLINE
  •  

Posted 13 September 2015 - 11:44 PM

[DISCUSSION #19: Are There any issues with the new testing release?]

 

The dep3 error was caused by the fact that on your system the cpuinfo file is significanly longer than on mine.I created an elif statement that should fix it. Your version of inxi is significantly newer, and doesn't display it's version info the same way. Since it's working I've created an elif statement for it that should fix it.

 

Fix Workfile1:

#!/bin/bash
#Fix Workfile1
#Throughout the code the Reveal release and a progress message are displayed.
#Check for dependencies.
revealrelease="Reveal For Linux Mint 17.1 Cinnamon 64bit 0.13 Testing"
depprog="Checking for dependencies. Progress:"
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [                            ]."
##Checking for Sed.
dep1=$(sed --version | head --lines=1 | sed 's/.*(GNU sed) //g')
if [[ "$dep1" == "4.2.2" ]]; then
    dep1="dep1_working"
else
    dep1="dep1_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=                           ]."
##Checking for Grep.
dep2=$(grep --version | head --lines=1 | sed 's/.*(GNU grep) //g')
if [[ "$dep2" == "2.16" ]]; then
    dep2="dep2_working"
else
    dep2="dep2_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==                          ]."
##Checking for "/proc/cpuinfo".
dep3=$(wc -l /proc/cpuinfo)
if [[ "${dep3:4:4}" == "proc" ]]; then
    dep3="dep3_working"
elif [[ "$dep3:5:4}" == "proc" ]]; then
    dep3="dep3_working"
else
    dep3="dep3_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===                         ]."
##Checking for Bash.
dep4=$(bash --version | head --lines=1 | sed 's/.*version //g' | sed 's/(.*//g')
if [[ "$dep4" == "4.3.11" ]]; then
    dep4="dep4_working"
else
    dep4="dep4_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [====                        ]."
##Checking for CPUfreq-utils.
dep5=$(cpufreq-info -h | head --lines=1 | sed 's/.*cpufrequtils //g' | sed 's/: cpufreq-info.*//g')
if [[ "$dep5" == "008" ]]; then
    dep5="dep5_working"
else
    dep5="dep5_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=====                       ]."
##Checking for Echo.
dep6=$(head --lines=1 /bin/echo | wc -l)
if [[ "${dep6:0:1}" == "1" ]]; then
    dep6="dep6_working"
else
    dep6="dep6_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [======                      ]."
##Checking for Head.
dep7=$(head --version | head --lines=1 | sed 's/.*) //g')
if [[ "$dep7" == "8.21" ]]; then
    dep7="dep7_working"
else
    dep7="dep7_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=======                     ]."
##Checking for Tail.
dep8=$(tail --version | head --lines=1 | sed 's/.*) //g')
if [[ "$dep8" == "8.21" ]]; then
    dep8="dep8_working"
else
    dep8="dep8_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [========                    ]."
##Checking for Lscpu.
dep9=$(lscpu --help | grep [a-z] | head --lines=1)
if [[ "${dep9:0:5}" == "Usage" ]]; then
    dep9="dep9_working"
else
    dep9="dep9_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=========                   ]."
##Checking for Lshw.
dep10=$(lshw -v 2>&1 | grep lshw | head --lines=1 | sed 's/.*(lshw) - //g')
if [[ "$dep10" == "B.02.16" ]]; then
    dep10="dep10_working"
else
    dep10="dep10_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==========                  ]"
##Checking for Sudo.
dep11=$(sudo --version | head --lines=1 | sed 's/.*version //g')
if [[ "$dep11" == "1.8.9p5" ]]; then
    dep11="dep11_working"
else
    dep11="dep11_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===========                 ]."
##Checking for "/dev/null".
dep12=$(ls /dev/null | head --lines=1)
if [[ "${dep12:5:4}" == "null" ]]; then
    dep12="dep12_working"
else
    dep12="dep12_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============                ]."
##Checking for Dmidecode.
dep13=$(dmidecode --version)
if [[ "$dep13" == "2.12" ]]; then
    dep13="dep13_working"
else
    dep13="dep13_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=============               ]."
##Checking for Bc.
dep14=$(bc --version | head --lines=1 | sed 's/.*bc //g')
if [[ "$dep14" == "1.06.95" ]]; then
    dep14="dep14_working"
else
    dep14="dep14_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==============              ]."
##Checking for Inxi.
dep15=$(inxi --version | head --lines=2 | tail --lines=1 | sed 's/.*: //g')
if [[ "$dep15" == "1.8.4-00" ]]; then
    dep15="dep15_working"
elif [[ "${dep15:5:9}" == "1.9.17-00" ]]; then
    dep15="dep15_working"
else
    dep15="dep15_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===============             ]."
##Checking for Tac.
dep16=$(tac --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep16" == "8.21" ]]; then
    dep16="dep16_working"
else
    dep16="dep16_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [================            ]."
##Checking for Paste.
dep17=$(paste --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep17" == "8.21" ]]; then
    dep17="dep17_working"
else
    dep17="dep17_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=================           ]."
##Checking for Ls.
dep18=$(ls --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep18" == "8.21" ]]; then
    dep18="dep18_working"
else
    dep18="dep18_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==================          ]."
##Checking for Wc.
dep19=$(wc --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep19" == "8.21" ]]; then
    dep19="dep19_working"
else
    dep19="dep19_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===================         ]."
##Checking for Seq.
dep20=$(seq --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep20" == "8.21" ]]; then
    dep20="dep20_working"
else
    dep20="dep20_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [====================        ]."
##Checking for Parted.
dep21=$(parted --version | sed 's/.*(GNU parted) //g' | head --lines=1)
if [[ "$dep21" == "2.3" ]]; then
    dep21="dep21_working"
else
    dep21="dep21_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=====================       ]."
##Checking for Tr.
dep22=$(tr --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep22" == "8.21" ]]; then
    dep22="dep22_working"
else
    dep22="dep22_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [======================      ]."
##Checking for Lsblk.
dep23=$(lsblk -h | head --lines=2 | tail --lines=1)
if [[ "${dep23:0:5}" == "Usage" ]]; then
    dep23="dep23_working"
else
    dep23="dep23_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=======================     ]."
##Checking for Cd-drive.
dep24=$(cd-drive --version | head --lines=1 | sed 's/.*version //g' | sed 's/ x86.*//g')
if [[ "$dep24" == "0.83" ]]; then
    dep24="dep24_working"
else
    dep24="dep24_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [========================    ]."
##Checking for Sort.
dep25=$(sort --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep25" == "8.21" ]]; then
    dep25="dep25_working"
else
    dep25="dep25_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=========================   ]."
##Checking for Uname.
dep26=$(uname --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep26" == "8.21" ]]; then
    dep26="dep26_working"
else
    dep26="dep26_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==========================  ]."
##Checking for Cat.
dep27=$(cat --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep27" == "8.21" ]]; then
    dep27="dep27_working"
else
    dep27="dep27_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=========================== ]."
##Checking for Dmesg.
dep28=$(dmesg --version | head --lines=1 | sed 's/.*from //g')
if [[ "$dep28" == "util-linux 2.20.1" ]]; then
    dep28="dep28_working"
else
    dep28="dep28_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
##The depency checks are combined.
deps=$(echo "Dependency Check Results:" && echo "$dep1 $dep2 $dep3 $dep4 $dep5 $dep6 $dep7 $dep8 $dep9 $dep10 $dep11 $dep12 $dep13 $dep14 $dep15 $dep16 $dep17 $dep18 $dep19 $dep20 $dep21 $dep22 $dep23 $dep24 $dep25 $dep26 $dep27 $dep28")
##The results of the dependency check is outputted.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
infoprog=$(echo "Collecting information about your system. Progress:")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [        ]."
#Get CPU model and trim excess text.
##Cat reads data to a pipe, grep finds lines starting with "model name", sed trims text from the beginning of the line so that just the actual model name remains, and lastly head and tail trim the output to a single line as on mult-CPU systems there will be more than one line. This output is set to the variable "cpu_model". If statements specific to certain cpus are then run to trim excess text from the model name for cleaner formatting.
cpu_model=$(cat /proc/cpuinfo | grep -a "model name" | sed 's/^.............//' | head --lines=1 | tail --lines=1)
if [[ "$cpu_model" == "AMD A10-4600M APU with Radeon(tm) HD Graphics" ]]; then
    cpu_model="AMD A10-4600M"
fi
if [[ "$cpu_model" == "Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz" ]]; then
    cpu_model="Intel Core i5-4460"
fi
if [[ "$cpu_model" == "AMD Athlon(tm) 64 X2 Dual Core Processor 4200+" ]]; then
    cpu_model="AMD Athlon 64 X2 4200+"
fi
if [[ "$cpu_model" == "AMD A4-3305M APU with Radeon(tm) HD Graphics" ]]; then
    cpu_model="AMD A4-3305M"
fi
#Get CPU core running clock-rates and trim excess text.
##CPUFreqUtils gets the CPU core clock-rates, grep is used to detect the clock rate-lines, Sed trims excess text from the front, Sed trims the period from the end, Sed adds a space to the front of each line. This output is set to the variable which is then echoed so that clock-rates can be compressed to a single line.
cpu_core_clock_rates_raw=$(cpufreq-info | grep -a "current CPU frequency" | sed 's/(asserted by call to hardware)//g' | sed 's/^...........................//' | sed 's/\.$//' | sed 's/^/ /')
cpu_core_clock_rates=$(echo $cpu_core_clock_rates_raw)
#Get CPU rated-clock-rate and trim excess text.
##CPUFreqUtils gets the CPUs rated clock-rate, grep is used to detect the CPU clock rate-line, then head and tail trim the output to a single line. This output is set to the variable "cpu_rated_cock_rate_raw" which is then echoed so that rated clock-rate can be extracted from the range of clock-rates. This output is assigned to the variable "cpu_rated_clock_rate".
cpu_rated_clock_rate_raw=$(cpufreq-info | grep -a "hardware limits" | head --lines=1 | tail --lines=1)
cpu_rated_clock_rate=$(echo ${cpu_rated_clock_rate_raw:(-8)})
#Get CPU core count and trim excess text.
##The command lscpu is run, grep is used to detect the CPU cores line, sed trims text from the beginning so just the number is left, and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_core".
cpu_core=$(lscpu | grep -a "Core(s) per socket" | sed 's/^.......................//' | head --lines=1 | tail --lines=1)
##Some AMD Multi-core CPUs (eg: Bulldozer, Piledriver, Steamroller) have more than 1 core per module, because of this they are detected as having less cores than they have when using lscpu to detect cores on a per socket basis. To fix this, the below code scans for select models, and gets the correct value using the "CPU(s)" line from lscpu. Static values aren't used because this would result in incorrect values in virtual-machines where more cores are assigned than the host has. This may not function correctly on Multi-CPU systems (for which no testing has been done).
case $cpu_model in
  "AMD A10-4600M") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
case ${cpu_model:0:13} in
  "AMD A10-4655M" | "AMD A10-5745M" | "AMD A10-5757M" | "AMD A10-5750M" | "AMD A10-6800K" | "AMD A10-5800K") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
case ${cpu_model:0:12} in
  "AMD A4-4355M" | "AMD A4-5145M" | "AMD A6-4455M" | "AMD A6-5345M" | "AMD A6-5357M" | "AMD A8-4555M" | "AMD A8-5545M" | "AMD A8-5557M" | "AMD A4-4300M" | "AMD A4-5150M" | "AMD A6-4400M" | "AMD A6-5350M" | "AMD A8-4500M" | "AMD A8-5550M" | "AMD A10-6700" | "AMD A10-5700" | "AMD A8-6600K" | "AMD A8-5600K" | "AMD A6-6400K" | "AMD A6-5400K") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
case ${cpu_model:0:11} in
  "AMD FX-9590" | "AMD FX-9370" | "AMD FX-8350" | "AMD FX-8320" | "AMD FX-8300" | "AMD FX-6350" | "AMD FX-6300" | "AMD FX-4350" | "AMD FX-4320" | "AMD FX-4300" | "AMD A8-6500" | "AMD A8-5500" | "AMD A4-5300" | "AMD A4-4000" | "AMD FX-8150" | "AMD FX-8120" | "AMD FX-8100" | "AMD FX-6200" | "AMD FX-6120" | "AMD FX-6100" | "AMD FX-4170" | "AMD FX-4130" | "AMD FX-4100") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
#Detect CPU architecture. (The user will always be running an X86-64 CPU, because that's what Linux Mint Cinnamon 64bit requires.)
##The command lscpu is run, grep is used to detect the architecture line, sed trims text from the beginning so just the architecture is left, and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_arch". The variable is then checked using an if statement to see if the architecture is "x86_64", if it is the variable is reset to say "X86-64".
cpu_arch=$(lscpu | grep -a "Architecture" | sed 's/^.......................//' | head --lines=1 | tail --lines=1)
if [[ "$cpu_arch" == "x86_64" ]]; then
    cpu_arch=X86-64
fi
#Detect if CPU supports PAE.
##Cat reads from a file, grep is used to detect the flags entry, grep is used to search for the "pae" flag, sed trims text from the beginning so just the flag is left, and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_pae_raw". The variable is then checked using an if statement to see if the variable is empty or pae. If it is pae then the variable "cpu_pae" is set to "Yes", if it isn't then it's set to "No".
cpu_pae_raw=$(cat /proc/cpuinfo | grep -a "flags" | grep -a -o "pae" | head --lines=1 | tail --lines=1)
if [[ "$cpu_pae_raw" == "pae" ]]; then
    cpu_pae=Yes
else
    cpu_pae=No
fi
#Detect if CPUs have virtualization support
##Cat reads from a file, grep is used to detect the flags entry, grep is used to search for the "vmx" flag, sed replaces "vmx" with "Yes", and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_virt_raw_1". The same process is done for the "svm" flag, and assigned to "cpu_virt_raw_2". An if else statement is then used to set the variable "cpu_virt" as "Yes" if either of the other 2 variables is "Yes", or "No" if they aren't. Vmx is for Intel CPUs (VT-x), and svm is for AMD CPUs (AMD-V). This only indicates whether the CPU has virtualization support, not whether it's currently enabled.
cpu_virt_raw_1=$(cat /proc/cpuinfo | grep -a "flags" | grep -a -o "vmx" | sed 's/vmx/Yes/' | head --lines=1 | tail --lines=1)
cpu_virt_raw_2=$(cat /proc/cpuinfo | grep -a "flags" | grep -a -o "svm" | sed 's/svm/Yes/' | head --lines=1 | tail --lines=1)
if [[ "$cpu_virt_raw_1" == "Yes" ]]; then
    cpu_virt=Yes
elif [[ "$cpu_virt_raw_2" == "Yes" ]]; then
    cpu_virt=Yes
else
    cpu_virt=No
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [=       ]."
#Get GPU models, trims excess text, and adds a dash to the beginning of each line.
##Lshw is used to get the GPU models. Grep trims grabs just the lines with the model-names on them. Sed trims excess chracters and space from in front of the model-name, and then Sed is used again to add a dash to the beginning of each line. The output of all of this is assigned to the variable gpu_models_raw.
gpu_models_raw=$(lshw -C display 2>/dev/null | grep -a "product" | sed 's/^................//' | sed 's/^/-/')
#Fix GPU model names.
##The variable gpu_models_raw is echoed so that Sed can be used to search for matches to known model-names that use poor naming in the hopes of swapping them for cleaner names. The output is assigned to the variable gpu_models.
gpu_models=$(echo "$gpu_models_raw" | sed 's/Trinity \[Radeon HD 7660G]/Radeon HD 7660G/g' | sed 's/Whistler LE \[Radeon HD 6610M\/7610M]/Radeon HD 6610M\/7610M/g' | sed 's/SVGA II Adapter/VMware SVGA II Adapter/g' | sed 's/Xeon E3-1200 v3\/4th Gen Core Processor Integrated Graphics Controller/Intel HD Graphics 4600/g' | sed 's/Sumo \[Radeon HD 6480G\]/Radeon HD 6480G/g')
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [==      ]."
#Get RAM amount
##Get RAM amount in mebibytes (MiB)(1,048,576 bytes) from dmidecode, use Grep to extract the Size entry, use Sed to trim excess text from front and back, use head and tail to trim output to a the first line. This is all assigned to the variable "ram_raw".
ram_raw=$(sudo dmidecode --type memory | grep -a "Size: " | grep -a MB | sed 's/^.......//g' | sed 's/ MB.*//g' | sed '/.*a.*$/d' | sed '/.*b.*$/d' | sed '/.*c.*$/d' | sed '/.*d.*$/d' | sed '/.*e.*$/d' | sed '/.*f.*$/d' | sed '/.*g.*$/d' | sed '/.*h.*$/d' | sed '/.*i.*$/d' | sed '/.*j.*$/d' | sed '/.*k.*$/d' | sed '/.*l.*$/d' | sed '/.*m.*$/d' | sed '/.*n.*$/d' | sed '/.*o.*$/d' | sed '/.*p.*$/d' | sed '/.*q.*$/d' | sed '/.*r.*$/d' | sed '/.*s.*$/d' | sed '/.*t.*$/d' | sed '/.*u.*$/d' | sed '/.*v.*$/d' | sed '/.*w.*$/d' | sed '/.*x.*$/d' | sed '/.*y.*$/d' | sed '/.*z.*$/d' | sed 's/^/\+/g')
ram_working1=$(echo $ram_raw | sed 's/ +/+/g' | sed 's/^+//')
ram_working2=$(echo $ram_working1 | bc)
##Use Bc to convert the data in "ram_raw" from mebibytes (MiB)(1,048,576 bytes) to gibibytes (GiB)(1,073,741,824 bytes), by dividing by 1024, and calcuating to 2 decimal places. The result is assigned to the variable "ram".
ram=$(bc <<< "scale=2;$ram_working2/1024")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [===     ]."
#Get Network-adapter-models and trim excess text.
##INXI is used to get the model-names, grep extracts the card line (this is where the model-name is), and then Sed trims excess text from the front of each line, and removes the driver information from the end of the line. Tac reverses the output so it will match the order of later variables.
network_adapter_models_raw=$(inxi -c 0 -N | grep -a "Card" | sed 's/^................./-/g' | sed 's/driver:.*//g' | sed 's/-: /-/g' | tac)
##Sed is used to clean up model-name formatting for some model-names.
network_adapter_models=$(echo "$network_adapter_models_raw" | sed 's/Belkin F5D8053 N Wireless USB Adapter v3000 \[Ralink RT2870\]/Belkin F5D8053 N Wireless USB Adapter/g' | sed 's/ASUSTek USB-N13 802.11n Network Adapter (rev. A1) \[Ralink RT3072\]/ASUSTek USB-N13 802.11n Network Adapter/g' | sed 's/ ASUSTek USB-N13 802.11n Network Adapter (rev. A1) \[Ralink RT3072\]/ASUSTek USB-N13 802.11n Network Adapter/g' | sed 's/ Ralink RT5370 Wireless Adapter/Ralink RT5370 Wireless Adapter/g' | sed 's/Intel 82545EM Gigabit Ethernet Controller (Copper)/Intel 82545EM Gigabit Ethernet Controller/g')
#Get network-adapter types and trim excess text.
##Lshw is used to get the capabilities of each adapter, and then excess text is trimmed from the front of the line.
network_adapters_type_raw=$(lshw -class network 2>/dev/null | grep -a "capabilities" | sed 's/^...................//g')
##Sed is used to replace "ethernet" with text identifying the adapter as wired, and replace "wireless" with text identifying the adapter as wireless.
network_adapters_type=$(echo "$network_adapters_type_raw" | sed 's/.*wireless.*/Wireless/g'| sed 's/.*ethernet.*/Wired/g' | sed 's/^/ -Adapter type: /g')
#Detect if adapter is configured.
##Lshw is used to get the interface names for each adapter, and grep and sed are used to replace it with a confirmation.
network_adapters_configured=$(lshw -class network 2>/dev/null | grep -a "logical name" | sed 's/.*eth.*/Yes/g' | sed 's/.*wlan.*/Yes/g' | sed 's/^/ -Configured: /g')
#Detect if adapter's network interface has an IP address.
##Lshw is used to detect the network interface for each model, Sed trims the excess text, Sed adds the ifconfig command in front of each interface name, and then Sed adds head and tail trimming commands to each line. This creates a series of commands for each network interface.
ipaddress_raw_part=$(lshw -class network 2>/dev/null | grep -a "logical name" | sed 's/^....................//g' | sed 's/^/ifconfig/g' | sed 's/$/ \| head -n 2 \| tail -n 1/g')
##Eval is used to execute the commands created in the previous variable, then Sed is used to replace the existing lines with either text confirming it has an IP address or stating that it doesn't. A line that has an IP address will say inet, but one that doesn't will say BROADCAST, all thanks to using head and tail in the previous commands.
ipaddress=$(eval "$ipaddress_raw_part" | sed 's/.*inet.*/ -IP Address: Yes/g' | sed 's/.*BROADCAST.*/ -IP Address: No/g' )
#Combine variables
##Paste is used to combine the variables. All the information for each adapter is combined to it's own line.
network_results_raw=$(paste <(echo "$network_adapter_models") <(echo "$network_adapters_type") <(echo "$network_adapters_configured") <(echo "$ipaddress"))
##Echo is used to display the combined variables, then Sed is used to add in \n before each item. \n means new line, but Sed isn't going to interpret it, it sends the text.
network_results_working1=$(echo "$network_results_raw" | sed 's/ -Adapter type:/\\n -Adapter type:/g' | sed 's/ -Configured:/\\n -Configured:/g' | sed 's/ -IP Address:/\\n -IP Address:/g')
##Echo is used to send the previously combined variables into a new variable, this time the \n text that was added by Sed will be interpretted.
network_results=$(echo -e "$network_results_working1")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [====    ]."
#Detect number of storage devices.
number_of_storage_devices=$(ls -1 /dev/sd* | sed 's/.*[0-9].*//g' | grep -a dev | wc -l)
#Setup output variable layout
storage_devices_results_working1=$(echo "$number_of_storage_devices * 3" | bc -l)
storage_devices_results_working2=$(seq 1 1 $storage_devices_results_working1 | sed 's/.*[0-9].*/ REMOVE/g')
storage_devices_results_working3=$(echo -e "$storage_devices_results_working2")
#Get the model-names for the storage devices
storage_devices_model_names_raw=$(sudo parted -l | sed '/Error: \/dev\/sr.*/d' | sed 's/Warning.*\/dev\/sr.*(Read-only file system).*//g' | sed 's/.*read-only.*//g' | sed 's/.*Error: \/dev/Model: Unknown \/dev/g' | tr "\n" "#" | sed 's/#Disk \/dev/Disk \/dev/g' | tr "#" "\n" | sed 's/Model:.*Disk \/dev\/sr.*//g' | grep -a "Model:" | sed 's/^......./-/g' | sed 's/(scsi)//g' | sed 's/: unrecognised.*//g' | sed 's/Disk \/dev.*//g')
storage_devices_model_names_working1=$(echo "$storage_devices_model_names_raw" | sed 's/$/ \\n REMOVE \\n REMOVE/g')
storage_devices_model_names=$(echo -e "$storage_devices_model_names_working1")
#Get the partition-table types for storage devices.
storage_devices_partition_tables_raw=$(sudo parted -l | sed '/Error: \/dev\/sr.*/d' | sed 's/Warning.*\/dev\/sr.*(Read-only file system).*//g' | sed 's/.*read-only.*//g' | sed 's/.*Error: \/dev.*/Partition Table: No partition table is present/g' | tr "\n" "#" | sed 's/#Partition Table/Partition table/g' | sed 's/#Sector size/Sector size/g' | tr "#" "\n" | sed 's/Disk \/dev\/sr.*Partition table.*//g' | grep -a "Partition table:" | sed 's/.*Partition table: / -Partition-table type: /g' | sed 's/gpt/G.P.T./g' | sed 's/msdos/M.B.R.P.T./g')
storage_devices_partition_tables_working1=$(echo "$storage_devices_partition_tables_raw" | sed 's/$/ \\n REMOVE/g' | sed 's/^/ REMOVE \\n/g')
storage_devices_partition_tables=$(echo -e "$storage_devices_partition_tables_working1")
#Get the partitions.
storage_devices_partitions_working1=$(sudo parted -l | sed '/.*Sector.*$/d' | sed '/.*Partition Table.*$/d' | tr "\n" "#" | sed 's/Flags###Model/Flags#EmptyPart##Model/g' | tr "#" "\n" | sed '/.*Model.*$/d' | sed '/Error: \/dev\/sr.*/d' | sed 's/Warning.*\/dev\/sr.*(Read-only file system).*//g' | sed 's/.*read-only.*//g' | sed 's/Error: \/dev/Disk \/dev/g' | tr "\n" "#" | sed 's/Flags#EmptyPart/EmptyPart/g' | tr "#" "\n" | sed 's/.*EmptyPart.*/EmptyPart/g' | tr "\n" "#" | sed 's/##EmptyPart/EmptyPart/g' | tr "#" "\n" | grep -a "Disk" | sed 's/.*EmptyPart.*/None/g' | sed 's/.*unrecognised.*/None/g' | sed 's/:.*//g' | sed 's/Disk/ls -1/g' | sed 's/$/*/g' | sed 's/.*None.*/echo \"partitionless1\"/g' | sed 's/$/ | tr \"\\n\" \"#\"/g' | sed 's/$/ \&\& echo \" divide1\"/g' | sed '/.*\/dev\/sr.*/d')
storage_devices_partitions_working2=$(eval "$storage_devices_partitions_working1" | sed 's/#/ #1 /g' | sed 's/#1/\\n/g')
storage_devices_partitions=$(echo -e "$storage_devices_partitions_working2" | sed '/[0-9]/!d' |sed 's/ //g' | sed 's/$/:/g' | sed 's/^/  - /g')
#Get the storage device partition types.
storage_devices_partition_types_working1=$(sudo parted -l | tr "\r" "&" | tr "\t" "&" | sed 's/&//g' | tr "\n" "#" | sed 's/Flags###Model/Flags#EmptyPart##Model/g' | tr "#" "\n" | sed '/Error: \/dev\/sr.*/d' | sed '/Warning.*\/dev\/sr.*(Read-only file system).*/d' | sed '/.*read-only.*/d' | tr "\n" "#" | sed 's/\/dev\/sr.*###//g' | tr "#" "\n" | sed 's/.*Error: \/dev.*/Partition-type: Not Applicable # divide1/g' | sed 's/.*EmptyPart.*/Partition-type: Not Applicable # divide1/g' | sed '/Model.*/d' | sed '/Disk \/dev.*/d' | sed '/Sector.*/d' | sed '/Partition Table.*/d' | sed '/Number.*/d' | sed '/.*Disk.*/d' | sed 's/.*extended.*/Partition-type: Extended, /g' | sed 's/.*logical.*/Partition-type: Logical, /g' | sed 's/.*primary.*/Partition-type: Primary, /g' | sed 's/.*B.*/Partition-type: Primary, /g' | sed 's/^$/divide1/g' | sed '/.*Error:.*/d' | sed '/.*Warning:.*/d' | tr "\n" "#" | sed 's/#/ #1 /g' | sed 's/divide1 #1 divide1 #1 divide1/divide1/g' | sed 's/divide1 #1 divide1/divide1/g' | sed 's/divide1 #1//1')
storage_devices_partition_types_working2=$(echo "$storage_devices_partition_types_working1" | sed 's/ #1 /\\n/g')
storage_devices_partition_types=$(echo -e "$storage_devices_partition_types_working2" | sed 's/ //g')
#Merge partitions and details into a new variable.
storage_devices_partitions_and_types_working1=$(paste <(echo "$storage_devices_partitions") <(echo "$storage_devices_partition_types"))
storage_devices_partitions_and_types_working2=$(echo "$storage_devices_partitions_and_types_working1" | sed 's/.*divide1.*/divide1/g' | sed 's/Partition-type:NotApplicable/Partition-type: Not applicable, /g' | tr "\t" " " | sed 's/partitionless1/Partitionless/g' | tr "\r" "Q" | sed 's/Q//g')
storage_devices_partitions_and_types_working3=$(echo "$storage_devices_partitions_and_types_working2"| tr "\n" "#" | sed 's/divide1/\\n/g' | sed 's/...$//' | sed 's/^/#/g')
storage_devices_partitions_and_types_working4=$(echo -e "$storage_devices_partitions_and_types_working3" | sed 's/^/\\n \\n/g')
storage_devices_partitions_and_types=$(echo -e "$storage_devices_partitions_and_types_working4" | sed 's/.$//' | sed 's/^.//')
#Merge variables into results variable.
storage_devices_results_working4=$(paste <(echo "$storage_devices_results_working3") <(echo "$storage_devices_model_names") <(echo "$storage_devices_partition_tables") <(echo "$storage_devices_partitions_and_types"))
storage_devices_results_working5=$(echo "$storage_devices_results_working4" | tr "\t" " " | sed 's/ REMOVE //g' | tr "#" "\n")
storage_devices_results=$(echo -e "$storage_devices_results_working5")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [=====   ]."
#Get model names for media devices
##lsblkd is used to get a list of devices, sed is used to trim out non-Sr devices, and replace them with a removal reminder.
mediadevicemodelnames_working1=$(lsblk -o name | sed '/.*sd.*[0-9]/d' | sed 's/.*sd.*/REMOVE /g' | sed '/.*loop.*/d' | sed '/NAME/d')
##lsblk is used to get the model-names, and Sed is used to delete empty lines, and remove the line containing the word "MODEL".
mediadevicemodelnames_working2=$(lsblk -o model | sed '/^$/d' | sed '/MODEL/d')
##Paste is used to merge the 2 previously created variables, but the model-name variable is trimmed using Sed; Sed removes lines containing the removal reminder.
mediadevicemodelnames_working3=$(paste <(echo "$mediadevicemodelnames_working1") <(echo "$mediadevicemodelnames_working2") | sed '/REMOVE/d')
##Tr is used to get rid of tabs and then Sed is used to add a dash in front of the model-name. Since only 4 optical drives are supported, head is used to trim all but the first 4 lines. Sed is used to add an @ to the end of the modelname to help trim out blank space later on. Sed is used to change instances of the model-name "CD-ROM          @" to "CD-ROM@". This is needed for VirtualBox guests.
mediadevicemodelnames=$(echo "$mediadevicemodelnames_working3" | tr "\t" "@" | sed 's/.*sr.*@/-/g' | head --lines=4 | sed 's/$/@/g' | sed 's/CD-ROM          @/CD-ROM@/g')
#Get media device types
##Each device type is gotten seperately using cd-drive. Sed and grep are used to isolate the details, then sed removes excess text, and adds numerals based on type. Sort uses the numerals to re-order the types the drive supports, and then tail is used to get the highest type on the list.
mediadevice1type=$(cd-drive -i /dev/sr0 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive one was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice1type" == "" ]]; then
    mediadevice1type="Unknown"
fi
mediadevice2type=$(cd-drive -i /dev/sr1 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive 2 was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice2type" == "" ]]; then
    mediadevice2type="Unknown"
fi
mediadevice3type=$(cd-drive -i /dev/sr2 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive 3 was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice3type" == "" ]]; then
    mediadevice3type="Unknown"
fi
mediadevice4type=$(cd-drive -i /dev/sr3 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive 4 was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice4type" == "" ]]; then
    mediadevice4type="Unknown"
fi
##The device type variables are echoed and saved into a single variable.
mediadevicetypes_raw=$(echo "$mediadevice1type" && echo "$mediadevice2type" && echo "$mediadevice3type" && echo "$mediadevice4type")
mediadevicemodelnameslinecount=$(echo "$mediadevicemodelnames" | wc -l)
##The device types variable is trimmed to match the number of lines in the modelnames variable.
mediadevicetypes=$(echo "$mediadevicetypes_raw" | head --lines="$mediadevicemodelnameslinecount")
#Merge variables
##Paste is used to combine the model names and media types variables.
mediadevices_raw=$(paste <(echo "$mediadevicemodelnames") <(echo "$mediadevicetypes"))
##The mediadevices variable is echoed, then TR is used to remove tabs, and replace them with an @ symbol. Sed is used to trim extra space between the model-name and device-type using the added @ symbols.
mediadevices=$(echo "$mediadevices_raw" | tr "\t" "@" | sed 's/@.*@/ /g')
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [======  ]."
#List running OS
##The os variable is set to "Linux Mint Cinnamon".
os="Linux Mint Cinnamon"
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [======= ]."
#Detect running kernel
##Uname is used to get the kernel information. Sed is used to trim it to just the version number.
kernel=$(uname -r | sed 's/[a-z]//g' | sed 's/[A-Z]//g' | sed 's/-.*//g' | sed 's/$/@/g' | sed 's/.0@//g' | sed 's/@//g')
#Detect the active computer firmware interface (eg: BIOS, EFI, UEFI).
##Head is used to see if the efi folder is present, stderror is directed to stdout, then Sed removes excess text from the error message. The result is saved to a variable.
acfi_raw=$(head --lines=1 /sys/firmware/efi 2>&1 | sed 's/.*: //g')
##Dmesg is used to find the EFIorUEFI release number, grep and sed are used to isolate the release number.
efioruefiversion=$(dmesg | grep -a "EFI v" | sed 's/[a-z]//g' | sed 's/[A-Z]//g' | sed 's/.*:  //g' | sed 's/ .*//g')
##An if elif else statement is used to see if the first number of the EFI/UEFI release number is 1 or 2. It's one the variable "efioruefi" is set to EFI, if it's 2 then the variable is set to UEFI, and if it's something else then the variable is set to "EFI or UEFI".
if [[ "${efioruefiversion:0:1}" == "1" ]]; then
    efioruefi=EFI
elif [[ "${efioruefiversion:0:1}" == "2" ]]; then
    efioruefi=UEFI
else
    efioruefi="EFI or UEFI"
fi
##The variable acfi_raw is checked against expected outputs to determine if the EFI folder is present, and use that information to decide if the acfi variable should indicate BIOS, UEFI, or Unknown is active.
if [[ "$acfi_raw" == "Is a directory" ]]; then
    acfi=$(echo "$efioruefi")
elif [[ "$acfi_raw" == "No such file or directory" ]]; then
    acfi=BIOS
else
    acfi=Unknown
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [========]."
#Display results
##Echo is used to display the necessary text, in an organized manner, along with the gathered variables.
echo System Information
echo CPU:
echo "-$cpu_model $cpu_rated_clock_rate rated ($cpu_core_clock_rates) running $cpu_core core $cpu_arch"
echo " -Supports PAE: $cpu_pae"
echo " -Virtualization Support: $cpu_virt"
echo GPUs:
echo "$gpu_models"
echo RAM: $ram GiB
echo Network Adapters:
echo "$network_results"
echo Storage Devices:
echo "$storage_devices_results"
echo Media Devices:
echo "$mediadevices"
echo Operating System: "$os (Kernel:$kernel)"
echo Active Computer Firmware Interface: "$acfi"


#318 NickAu

NickAu

    Bleepin Grumpy Aussie


  •  Avatar image
  • Members
  • 26,114 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Australia

Posted 14 September 2015 - 12:26 AM

CPU:
-Intel Core i5-4460 3.20 GHz rated (1.30 GHz 1.10 GHz 1.10 GHz 1.70 GHz) running 4 core X86-64
 -Supports PAE: Yes
 -Virtualization Support: Yes
GPUs:
-Intel HD Graphics 4600
RAM: 8.00 GiB
Network Adapters:
-Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller 	
 -Adapter type: Wired	
 -Configured: Yes	
 -IP Address: Yes
Storage Devices:
-ATA SanDisk SDSSDHP2    
  -Partition-table type: G.P.T.  
  - /dev/sda1: Partition-type:Primary,
  - /dev/sda2: Partition-type:Primary,
  - /dev/sda3: Partition-type:Primary,
-ATA WDC WD10EZEX-00B    
  -Partition-table type: M.B.R.P.T.  
  - /dev/sdb1: Partition-type:Primary,
Media Devices:
-DVDRAM GH24NSB0  Unknown
Operating System: Linux Mint Cinnamon (Kernel:3.13)
Active Computer Firmware Interface: UEFI

Operating System: Linux Mint Cinnamon (Kernel:3.13)

Ummmm NO, Ubuntu 14.


Edited by NickAu, 14 September 2015 - 05:55 AM.

"When God shuts a Window, he opens a Linux." —Linus 8:7

 

 

 

 


#319 Al1000

Al1000

  •  Avatar image
  • Helper Emeritus
  • 8,519 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:10:09 PM

Posted 14 September 2015 - 05:35 AM

Output of Fix Workfile 1 on Mint Cinnamon 17.1 64 bit in VirtualBox:
 
System Information
CPU:
-AMD Athlon 64 X2 4200+  rated () running 1 core X86-64
 -Supports PAE: Yes
 -Virtualization Support: No
GPUs:
-VirtualBox Graphics Adapter
RAM: GiB
Network Adapters:
-Intel 82540EM Gigabit Ethernet Controller 	
 -Adapter type: Wired	
 -Configured: Yes	
 -IP Address: Yes
Storage Devices:
-ATA VBOX HARDDISK    
  -Partition-table type: M.B.R.P.T.  
  - /dev/sda1: Partition-type:Primary,
  - /dev/sda2: Partition-type:Extended,
  - /dev/sda5: Partition-type:Logical,
Media Devices:
-CD-ROM Unknown
Operating System: Linux Mint Cinnamon (Kernel:3.13)
Active Computer Firmware Interface: BIOS
al@al-VirtualBox ~ $ 
Output of Fix Workfile 1 on Lubuntu 15.04 64bit:
 
System Information
CPU:
-AMD Athlon 64 X2 4200+  rated () running 2 core X86-64
 -Supports PAE: Yes
 -Virtualization Support: Yes
GPUs:
-G84 [GeForce 8600 GT]
RAM: 3.00 GiB
Network Adapters:
-Realtek RTL8187 Wireless Adapter 	
 -Adapter type: Wireless	
 -Configured: Yes	
 -IP Address: No
-NVIDIA MCP55 Ethernet 			
Storage Devices:
-ATA ST500DM002-1BD14    
  -Partition-table type: M.B.R.P.T.  
  - /dev/sda1: Partition-type:Primary,
  - /dev/sda2: Partition-type:Extended,
  - /dev/sda5: Partition-type:Logical,
  - /dev/sda6: Partition-type:Logical,
  - /dev/sda7: Partition-type:Logical,
  - /dev/sda8: Partition-type:Logical,
  - /dev/sda9: Partition-type:Logical,
-ATA WDC WD10EZRX-00L    
  -Partition-table type: M.B.R.P.T.  
Media Devices:
-iHAS124   E      Unknown
Operating System: Linux Mint Cinnamon (Kernel:3.19)
Active Computer Firmware Interface: BIOS
al@my-desktop-pc:~$ 


#320 Guest_hollowface_*

Guest_hollowface_*

  •  Avatar image
  • Guests
  • OFFLINE
  •  

Posted 17 September 2015 - 02:27 PM

[DISCUSSION #19: Are There any issues with the new testing release?]

 

@NickAu

Ummmm NO, Ubuntu 14.


Remember, the OS isn't detected, it's declared. Nothing more than an echo job. There was no point in detecting it since the script is built for a specific OS (also detection codes aren't able to get as specific). The user knows which OS they are running, that's how they decide which Reveal script to use. Outputting the OS name is for the benefit of 3rd parties viewing the output.

@AI1000

The only issue new I see is the ram detection, which was previously discussed, but somehow never made it's way onto the known issues list. I'll be sure to add it this time.

#321 Guest_hollowface_*

Guest_hollowface_*

  •  Avatar image
  • Guests
  • OFFLINE
  •  

Posted 17 September 2015 - 02:30 PM

[DISCUSSION #19: Are There any issues with the new testing release?]

 

End of discussion. Vote N/A.

 

Results:

This is the code that will be implemented.

#!/bin/bash
#Fix Workfile1
#Throughout the code the Reveal release and a progress message are displayed.
#Check for dependencies.
revealrelease="Reveal For Linux Mint 17.1 Cinnamon 64bit 0.13 Testing"
depprog="Checking for dependencies. Progress:"
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [                            ]."
##Checking for Sed.
dep1=$(sed --version | head --lines=1 | sed 's/.*(GNU sed) //g')
if [[ "$dep1" == "4.2.2" ]]; then
    dep1="dep1_working"
else
    dep1="dep1_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=                           ]."
##Checking for Grep.
dep2=$(grep --version | head --lines=1 | sed 's/.*(GNU grep) //g')
if [[ "$dep2" == "2.16" ]]; then
    dep2="dep2_working"
else
    dep2="dep2_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==                          ]."
##Checking for "/proc/cpuinfo".
dep3=$(wc -l /proc/cpuinfo)
if [[ "${dep3:4:4}" == "proc" ]]; then
    dep3="dep3_working"
elif [[ "$dep3:5:4}" == "proc" ]]; then
    dep3="dep3_working"
else
    dep3="dep3_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===                         ]."
##Checking for Bash.
dep4=$(bash --version | head --lines=1 | sed 's/.*version //g' | sed 's/(.*//g')
if [[ "$dep4" == "4.3.11" ]]; then
    dep4="dep4_working"
else
    dep4="dep4_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [====                        ]."
##Checking for CPUfreq-utils.
dep5=$(cpufreq-info -h | head --lines=1 | sed 's/.*cpufrequtils //g' | sed 's/: cpufreq-info.*//g')
if [[ "$dep5" == "008" ]]; then
    dep5="dep5_working"
else
    dep5="dep5_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=====                       ]."
##Checking for Echo.
dep6=$(head --lines=1 /bin/echo | wc -l)
if [[ "${dep6:0:1}" == "1" ]]; then
    dep6="dep6_working"
else
    dep6="dep6_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [======                      ]."
##Checking for Head.
dep7=$(head --version | head --lines=1 | sed 's/.*) //g')
if [[ "$dep7" == "8.21" ]]; then
    dep7="dep7_working"
else
    dep7="dep7_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=======                     ]."
##Checking for Tail.
dep8=$(tail --version | head --lines=1 | sed 's/.*) //g')
if [[ "$dep8" == "8.21" ]]; then
    dep8="dep8_working"
else
    dep8="dep8_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [========                    ]."
##Checking for Lscpu.
dep9=$(lscpu --help | grep [a-z] | head --lines=1)
if [[ "${dep9:0:5}" == "Usage" ]]; then
    dep9="dep9_working"
else
    dep9="dep9_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=========                   ]."
##Checking for Lshw.
dep10=$(lshw -v 2>&1 | grep lshw | head --lines=1 | sed 's/.*(lshw) - //g')
if [[ "$dep10" == "B.02.16" ]]; then
    dep10="dep10_working"
else
    dep10="dep10_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==========                  ]"
##Checking for Sudo.
dep11=$(sudo --version | head --lines=1 | sed 's/.*version //g')
if [[ "$dep11" == "1.8.9p5" ]]; then
    dep11="dep11_working"
else
    dep11="dep11_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===========                 ]."
##Checking for "/dev/null".
dep12=$(ls /dev/null | head --lines=1)
if [[ "${dep12:5:4}" == "null" ]]; then
    dep12="dep12_working"
else
    dep12="dep12_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============                ]."
##Checking for Dmidecode.
dep13=$(dmidecode --version)
if [[ "$dep13" == "2.12" ]]; then
    dep13="dep13_working"
else
    dep13="dep13_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=============               ]."
##Checking for Bc.
dep14=$(bc --version | head --lines=1 | sed 's/.*bc //g')
if [[ "$dep14" == "1.06.95" ]]; then
    dep14="dep14_working"
else
    dep14="dep14_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==============              ]."
##Checking for Inxi.
dep15=$(inxi --version | head --lines=2 | tail --lines=1 | sed 's/.*: //g')
if [[ "$dep15" == "1.8.4-00" ]]; then
    dep15="dep15_working"
elif [[ "${dep15:5:9}" == "1.9.17-00" ]]; then
    dep15="dep15_working"
else
    dep15="dep15_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===============             ]."
##Checking for Tac.
dep16=$(tac --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep16" == "8.21" ]]; then
    dep16="dep16_working"
else
    dep16="dep16_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [================            ]."
##Checking for Paste.
dep17=$(paste --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep17" == "8.21" ]]; then
    dep17="dep17_working"
else
    dep17="dep17_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=================           ]."
##Checking for Ls.
dep18=$(ls --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep18" == "8.21" ]]; then
    dep18="dep18_working"
else
    dep18="dep18_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==================          ]."
##Checking for Wc.
dep19=$(wc --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep19" == "8.21" ]]; then
    dep19="dep19_working"
else
    dep19="dep19_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===================         ]."
##Checking for Seq.
dep20=$(seq --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep20" == "8.21" ]]; then
    dep20="dep20_working"
else
    dep20="dep20_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [====================        ]."
##Checking for Parted.
dep21=$(parted --version | sed 's/.*(GNU parted) //g' | head --lines=1)
if [[ "$dep21" == "2.3" ]]; then
    dep21="dep21_working"
else
    dep21="dep21_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=====================       ]."
##Checking for Tr.
dep22=$(tr --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep22" == "8.21" ]]; then
    dep22="dep22_working"
else
    dep22="dep22_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [======================      ]."
##Checking for Lsblk.
dep23=$(lsblk -h | head --lines=2 | tail --lines=1)
if [[ "${dep23:0:5}" == "Usage" ]]; then
    dep23="dep23_working"
else
    dep23="dep23_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=======================     ]."
##Checking for Cd-drive.
dep24=$(cd-drive --version | head --lines=1 | sed 's/.*version //g' | sed 's/ x86.*//g')
if [[ "$dep24" == "0.83" ]]; then
    dep24="dep24_working"
else
    dep24="dep24_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [========================    ]."
##Checking for Sort.
dep25=$(sort --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep25" == "8.21" ]]; then
    dep25="dep25_working"
else
    dep25="dep25_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=========================   ]."
##Checking for Uname.
dep26=$(uname --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep26" == "8.21" ]]; then
    dep26="dep26_working"
else
    dep26="dep26_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==========================  ]."
##Checking for Cat.
dep27=$(cat --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep27" == "8.21" ]]; then
    dep27="dep27_working"
else
    dep27="dep27_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=========================== ]."
##Checking for Dmesg.
dep28=$(dmesg --version | head --lines=1 | sed 's/.*from //g')
if [[ "$dep28" == "util-linux 2.20.1" ]]; then
    dep28="dep28_working"
else
    dep28="dep28_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
##The depency checks are combined.
deps=$(echo "Dependency Check Results:" && echo "$dep1 $dep2 $dep3 $dep4 $dep5 $dep6 $dep7 $dep8 $dep9 $dep10 $dep11 $dep12 $dep13 $dep14 $dep15 $dep16 $dep17 $dep18 $dep19 $dep20 $dep21 $dep22 $dep23 $dep24 $dep25 $dep26 $dep27 $dep28")
##The results of the dependency check is outputted.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
infoprog=$(echo "Collecting information about your system. Progress:")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [        ]."
#Get CPU model and trim excess text.
##Cat reads data to a pipe, grep finds lines starting with "model name", sed trims text from the beginning of the line so that just the actual model name remains, and lastly head and tail trim the output to a single line as on mult-CPU systems there will be more than one line. This output is set to the variable "cpu_model". If statements specific to certain cpus are then run to trim excess text from the model name for cleaner formatting.
cpu_model=$(cat /proc/cpuinfo | grep -a "model name" | sed 's/^.............//' | head --lines=1 | tail --lines=1)
if [[ "$cpu_model" == "AMD A10-4600M APU with Radeon(tm) HD Graphics" ]]; then
    cpu_model="AMD A10-4600M"
fi
if [[ "$cpu_model" == "Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz" ]]; then
    cpu_model="Intel Core i5-4460"
fi
if [[ "$cpu_model" == "AMD Athlon(tm) 64 X2 Dual Core Processor 4200+" ]]; then
    cpu_model="AMD Athlon 64 X2 4200+"
fi
if [[ "$cpu_model" == "AMD A4-3305M APU with Radeon(tm) HD Graphics" ]]; then
    cpu_model="AMD A4-3305M"
fi
#Get CPU core running clock-rates and trim excess text.
##CPUFreqUtils gets the CPU core clock-rates, grep is used to detect the clock rate-lines, Sed trims excess text from the front, Sed trims the period from the end, Sed adds a space to the front of each line. This output is set to the variable which is then echoed so that clock-rates can be compressed to a single line.
cpu_core_clock_rates_raw=$(cpufreq-info | grep -a "current CPU frequency" | sed 's/(asserted by call to hardware)//g' | sed 's/^...........................//' | sed 's/\.$//' | sed 's/^/ /')
cpu_core_clock_rates=$(echo $cpu_core_clock_rates_raw)
#Get CPU rated-clock-rate and trim excess text.
##CPUFreqUtils gets the CPUs rated clock-rate, grep is used to detect the CPU clock rate-line, then head and tail trim the output to a single line. This output is set to the variable "cpu_rated_cock_rate_raw" which is then echoed so that rated clock-rate can be extracted from the range of clock-rates. This output is assigned to the variable "cpu_rated_clock_rate".
cpu_rated_clock_rate_raw=$(cpufreq-info | grep -a "hardware limits" | head --lines=1 | tail --lines=1)
cpu_rated_clock_rate=$(echo ${cpu_rated_clock_rate_raw:(-8)})
#Get CPU core count and trim excess text.
##The command lscpu is run, grep is used to detect the CPU cores line, sed trims text from the beginning so just the number is left, and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_core".
cpu_core=$(lscpu | grep -a "Core(s) per socket" | sed 's/^.......................//' | head --lines=1 | tail --lines=1)
##Some AMD Multi-core CPUs (eg: Bulldozer, Piledriver, Steamroller) have more than 1 core per module, because of this they are detected as having less cores than they have when using lscpu to detect cores on a per socket basis. To fix this, the below code scans for select models, and gets the correct value using the "CPU(s)" line from lscpu. Static values aren't used because this would result in incorrect values in virtual-machines where more cores are assigned than the host has. This may not function correctly on Multi-CPU systems (for which no testing has been done).
case $cpu_model in
  "AMD A10-4600M") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
case ${cpu_model:0:13} in
  "AMD A10-4655M" | "AMD A10-5745M" | "AMD A10-5757M" | "AMD A10-5750M" | "AMD A10-6800K" | "AMD A10-5800K") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
case ${cpu_model:0:12} in
  "AMD A4-4355M" | "AMD A4-5145M" | "AMD A6-4455M" | "AMD A6-5345M" | "AMD A6-5357M" | "AMD A8-4555M" | "AMD A8-5545M" | "AMD A8-5557M" | "AMD A4-4300M" | "AMD A4-5150M" | "AMD A6-4400M" | "AMD A6-5350M" | "AMD A8-4500M" | "AMD A8-5550M" | "AMD A10-6700" | "AMD A10-5700" | "AMD A8-6600K" | "AMD A8-5600K" | "AMD A6-6400K" | "AMD A6-5400K") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
case ${cpu_model:0:11} in
  "AMD FX-9590" | "AMD FX-9370" | "AMD FX-8350" | "AMD FX-8320" | "AMD FX-8300" | "AMD FX-6350" | "AMD FX-6300" | "AMD FX-4350" | "AMD FX-4320" | "AMD FX-4300" | "AMD A8-6500" | "AMD A8-5500" | "AMD A4-5300" | "AMD A4-4000" | "AMD FX-8150" | "AMD FX-8120" | "AMD FX-8100" | "AMD FX-6200" | "AMD FX-6120" | "AMD FX-6100" | "AMD FX-4170" | "AMD FX-4130" | "AMD FX-4100") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
#Detect CPU architecture. (The user will always be running an X86-64 CPU, because that's what Linux Mint Cinnamon 64bit requires.)
##The command lscpu is run, grep is used to detect the architecture line, sed trims text from the beginning so just the architecture is left, and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_arch". The variable is then checked using an if statement to see if the architecture is "x86_64", if it is the variable is reset to say "X86-64".
cpu_arch=$(lscpu | grep -a "Architecture" | sed 's/^.......................//' | head --lines=1 | tail --lines=1)
if [[ "$cpu_arch" == "x86_64" ]]; then
    cpu_arch=X86-64
fi
#Detect if CPU supports PAE.
##Cat reads from a file, grep is used to detect the flags entry, grep is used to search for the "pae" flag, sed trims text from the beginning so just the flag is left, and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_pae_raw". The variable is then checked using an if statement to see if the variable is empty or pae. If it is pae then the variable "cpu_pae" is set to "Yes", if it isn't then it's set to "No".
cpu_pae_raw=$(cat /proc/cpuinfo | grep -a "flags" | grep -a -o "pae" | head --lines=1 | tail --lines=1)
if [[ "$cpu_pae_raw" == "pae" ]]; then
    cpu_pae=Yes
else
    cpu_pae=No
fi
#Detect if CPUs have virtualization support
##Cat reads from a file, grep is used to detect the flags entry, grep is used to search for the "vmx" flag, sed replaces "vmx" with "Yes", and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_virt_raw_1". The same process is done for the "svm" flag, and assigned to "cpu_virt_raw_2". An if else statement is then used to set the variable "cpu_virt" as "Yes" if either of the other 2 variables is "Yes", or "No" if they aren't. Vmx is for Intel CPUs (VT-x), and svm is for AMD CPUs (AMD-V). This only indicates whether the CPU has virtualization support, not whether it's currently enabled.
cpu_virt_raw_1=$(cat /proc/cpuinfo | grep -a "flags" | grep -a -o "vmx" | sed 's/vmx/Yes/' | head --lines=1 | tail --lines=1)
cpu_virt_raw_2=$(cat /proc/cpuinfo | grep -a "flags" | grep -a -o "svm" | sed 's/svm/Yes/' | head --lines=1 | tail --lines=1)
if [[ "$cpu_virt_raw_1" == "Yes" ]]; then
    cpu_virt=Yes
elif [[ "$cpu_virt_raw_2" == "Yes" ]]; then
    cpu_virt=Yes
else
    cpu_virt=No
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [=       ]."
#Get GPU models, trims excess text, and adds a dash to the beginning of each line.
##Lshw is used to get the GPU models. Grep trims grabs just the lines with the model-names on them. Sed trims excess chracters and space from in front of the model-name, and then Sed is used again to add a dash to the beginning of each line. The output of all of this is assigned to the variable gpu_models_raw.
gpu_models_raw=$(lshw -C display 2>/dev/null | grep -a "product" | sed 's/^................//' | sed 's/^/-/')
#Fix GPU model names.
##The variable gpu_models_raw is echoed so that Sed can be used to search for matches to known model-names that use poor naming in the hopes of swapping them for cleaner names. The output is assigned to the variable gpu_models.
gpu_models=$(echo "$gpu_models_raw" | sed 's/Trinity \[Radeon HD 7660G]/Radeon HD 7660G/g' | sed 's/Whistler LE \[Radeon HD 6610M\/7610M]/Radeon HD 6610M\/7610M/g' | sed 's/SVGA II Adapter/VMware SVGA II Adapter/g' | sed 's/Xeon E3-1200 v3\/4th Gen Core Processor Integrated Graphics Controller/Intel HD Graphics 4600/g' | sed 's/Sumo \[Radeon HD 6480G\]/Radeon HD 6480G/g')
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [==      ]."
#Get RAM amount
##Get RAM amount in mebibytes (MiB)(1,048,576 bytes) from dmidecode, use Grep to extract the Size entry, use Sed to trim excess text from front and back, use head and tail to trim output to a the first line. This is all assigned to the variable "ram_raw".
ram_raw=$(sudo dmidecode --type memory | grep -a "Size: " | grep -a MB | sed 's/^.......//g' | sed 's/ MB.*//g' | sed '/.*a.*$/d' | sed '/.*b.*$/d' | sed '/.*c.*$/d' | sed '/.*d.*$/d' | sed '/.*e.*$/d' | sed '/.*f.*$/d' | sed '/.*g.*$/d' | sed '/.*h.*$/d' | sed '/.*i.*$/d' | sed '/.*j.*$/d' | sed '/.*k.*$/d' | sed '/.*l.*$/d' | sed '/.*m.*$/d' | sed '/.*n.*$/d' | sed '/.*o.*$/d' | sed '/.*p.*$/d' | sed '/.*q.*$/d' | sed '/.*r.*$/d' | sed '/.*s.*$/d' | sed '/.*t.*$/d' | sed '/.*u.*$/d' | sed '/.*v.*$/d' | sed '/.*w.*$/d' | sed '/.*x.*$/d' | sed '/.*y.*$/d' | sed '/.*z.*$/d' | sed 's/^/\+/g')
ram_working1=$(echo $ram_raw | sed 's/ +/+/g' | sed 's/^+//')
ram_working2=$(echo $ram_working1 | bc)
##Use Bc to convert the data in "ram_raw" from mebibytes (MiB)(1,048,576 bytes) to gibibytes (GiB)(1,073,741,824 bytes), by dividing by 1024, and calcuating to 2 decimal places. The result is assigned to the variable "ram".
ram=$(bc <<< "scale=2;$ram_working2/1024")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [===     ]."
#Get Network-adapter-models and trim excess text.
##INXI is used to get the model-names, grep extracts the card line (this is where the model-name is), and then Sed trims excess text from the front of each line, and removes the driver information from the end of the line. Tac reverses the output so it will match the order of later variables.
network_adapter_models_raw=$(inxi -c 0 -N | grep -a "Card" | sed 's/^................./-/g' | sed 's/driver:.*//g' | sed 's/-: /-/g' | tac)
##Sed is used to clean up model-name formatting for some model-names.
network_adapter_models=$(echo "$network_adapter_models_raw" | sed 's/Belkin F5D8053 N Wireless USB Adapter v3000 \[Ralink RT2870\]/Belkin F5D8053 N Wireless USB Adapter/g' | sed 's/ASUSTek USB-N13 802.11n Network Adapter (rev. A1) \[Ralink RT3072\]/ASUSTek USB-N13 802.11n Network Adapter/g' | sed 's/ ASUSTek USB-N13 802.11n Network Adapter (rev. A1) \[Ralink RT3072\]/ASUSTek USB-N13 802.11n Network Adapter/g' | sed 's/ Ralink RT5370 Wireless Adapter/Ralink RT5370 Wireless Adapter/g' | sed 's/Intel 82545EM Gigabit Ethernet Controller (Copper)/Intel 82545EM Gigabit Ethernet Controller/g')
#Get network-adapter types and trim excess text.
##Lshw is used to get the capabilities of each adapter, and then excess text is trimmed from the front of the line.
network_adapters_type_raw=$(lshw -class network 2>/dev/null | grep -a "capabilities" | sed 's/^...................//g')
##Sed is used to replace "ethernet" with text identifying the adapter as wired, and replace "wireless" with text identifying the adapter as wireless.
network_adapters_type=$(echo "$network_adapters_type_raw" | sed 's/.*wireless.*/Wireless/g'| sed 's/.*ethernet.*/Wired/g' | sed 's/^/ -Adapter type: /g')
#Detect if adapter is configured.
##Lshw is used to get the interface names for each adapter, and grep and sed are used to replace it with a confirmation.
network_adapters_configured=$(lshw -class network 2>/dev/null | grep -a "logical name" | sed 's/.*eth.*/Yes/g' | sed 's/.*wlan.*/Yes/g' | sed 's/^/ -Configured: /g')
#Detect if adapter's network interface has an IP address.
##Lshw is used to detect the network interface for each model, Sed trims the excess text, Sed adds the ifconfig command in front of each interface name, and then Sed adds head and tail trimming commands to each line. This creates a series of commands for each network interface.
ipaddress_raw_part=$(lshw -class network 2>/dev/null | grep -a "logical name" | sed 's/^....................//g' | sed 's/^/ifconfig/g' | sed 's/$/ \| head -n 2 \| tail -n 1/g')
##Eval is used to execute the commands created in the previous variable, then Sed is used to replace the existing lines with either text confirming it has an IP address or stating that it doesn't. A line that has an IP address will say inet, but one that doesn't will say BROADCAST, all thanks to using head and tail in the previous commands.
ipaddress=$(eval "$ipaddress_raw_part" | sed 's/.*inet.*/ -IP Address: Yes/g' | sed 's/.*BROADCAST.*/ -IP Address: No/g' )
#Combine variables
##Paste is used to combine the variables. All the information for each adapter is combined to it's own line.
network_results_raw=$(paste <(echo "$network_adapter_models") <(echo "$network_adapters_type") <(echo "$network_adapters_configured") <(echo "$ipaddress"))
##Echo is used to display the combined variables, then Sed is used to add in \n before each item. \n means new line, but Sed isn't going to interpret it, it sends the text.
network_results_working1=$(echo "$network_results_raw" | sed 's/ -Adapter type:/\\n -Adapter type:/g' | sed 's/ -Configured:/\\n -Configured:/g' | sed 's/ -IP Address:/\\n -IP Address:/g')
##Echo is used to send the previously combined variables into a new variable, this time the \n text that was added by Sed will be interpretted.
network_results=$(echo -e "$network_results_working1")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [====    ]."
#Detect number of storage devices.
number_of_storage_devices=$(ls -1 /dev/sd* | sed 's/.*[0-9].*//g' | grep -a dev | wc -l)
#Setup output variable layout
storage_devices_results_working1=$(echo "$number_of_storage_devices * 3" | bc -l)
storage_devices_results_working2=$(seq 1 1 $storage_devices_results_working1 | sed 's/.*[0-9].*/ REMOVE/g')
storage_devices_results_working3=$(echo -e "$storage_devices_results_working2")
#Get the model-names for the storage devices
storage_devices_model_names_raw=$(sudo parted -l | sed '/Error: \/dev\/sr.*/d' | sed 's/Warning.*\/dev\/sr.*(Read-only file system).*//g' | sed 's/.*read-only.*//g' | sed 's/.*Error: \/dev/Model: Unknown \/dev/g' | tr "\n" "#" | sed 's/#Disk \/dev/Disk \/dev/g' | tr "#" "\n" | sed 's/Model:.*Disk \/dev\/sr.*//g' | grep -a "Model:" | sed 's/^......./-/g' | sed 's/(scsi)//g' | sed 's/: unrecognised.*//g' | sed 's/Disk \/dev.*//g')
storage_devices_model_names_working1=$(echo "$storage_devices_model_names_raw" | sed 's/$/ \\n REMOVE \\n REMOVE/g')
storage_devices_model_names=$(echo -e "$storage_devices_model_names_working1")
#Get the partition-table types for storage devices.
storage_devices_partition_tables_raw=$(sudo parted -l | sed '/Error: \/dev\/sr.*/d' | sed 's/Warning.*\/dev\/sr.*(Read-only file system).*//g' | sed 's/.*read-only.*//g' | sed 's/.*Error: \/dev.*/Partition Table: No partition table is present/g' | tr "\n" "#" | sed 's/#Partition Table/Partition table/g' | sed 's/#Sector size/Sector size/g' | tr "#" "\n" | sed 's/Disk \/dev\/sr.*Partition table.*//g' | grep -a "Partition table:" | sed 's/.*Partition table: / -Partition-table type: /g' | sed 's/gpt/G.P.T./g' | sed 's/msdos/M.B.R.P.T./g')
storage_devices_partition_tables_working1=$(echo "$storage_devices_partition_tables_raw" | sed 's/$/ \\n REMOVE/g' | sed 's/^/ REMOVE \\n/g')
storage_devices_partition_tables=$(echo -e "$storage_devices_partition_tables_working1")
#Get the partitions.
storage_devices_partitions_working1=$(sudo parted -l | sed '/.*Sector.*$/d' | sed '/.*Partition Table.*$/d' | tr "\n" "#" | sed 's/Flags###Model/Flags#EmptyPart##Model/g' | tr "#" "\n" | sed '/.*Model.*$/d' | sed '/Error: \/dev\/sr.*/d' | sed 's/Warning.*\/dev\/sr.*(Read-only file system).*//g' | sed 's/.*read-only.*//g' | sed 's/Error: \/dev/Disk \/dev/g' | tr "\n" "#" | sed 's/Flags#EmptyPart/EmptyPart/g' | tr "#" "\n" | sed 's/.*EmptyPart.*/EmptyPart/g' | tr "\n" "#" | sed 's/##EmptyPart/EmptyPart/g' | tr "#" "\n" | grep -a "Disk" | sed 's/.*EmptyPart.*/None/g' | sed 's/.*unrecognised.*/None/g' | sed 's/:.*//g' | sed 's/Disk/ls -1/g' | sed 's/$/*/g' | sed 's/.*None.*/echo \"partitionless1\"/g' | sed 's/$/ | tr \"\\n\" \"#\"/g' | sed 's/$/ \&\& echo \" divide1\"/g' | sed '/.*\/dev\/sr.*/d')
storage_devices_partitions_working2=$(eval "$storage_devices_partitions_working1" | sed 's/#/ #1 /g' | sed 's/#1/\\n/g')
storage_devices_partitions=$(echo -e "$storage_devices_partitions_working2" | sed '/[0-9]/!d' |sed 's/ //g' | sed 's/$/:/g' | sed 's/^/  - /g')
#Get the storage device partition types.
storage_devices_partition_types_working1=$(sudo parted -l | tr "\r" "&" | tr "\t" "&" | sed 's/&//g' | tr "\n" "#" | sed 's/Flags###Model/Flags#EmptyPart##Model/g' | tr "#" "\n" | sed '/Error: \/dev\/sr.*/d' | sed '/Warning.*\/dev\/sr.*(Read-only file system).*/d' | sed '/.*read-only.*/d' | tr "\n" "#" | sed 's/\/dev\/sr.*###//g' | tr "#" "\n" | sed 's/.*Error: \/dev.*/Partition-type: Not Applicable # divide1/g' | sed 's/.*EmptyPart.*/Partition-type: Not Applicable # divide1/g' | sed '/Model.*/d' | sed '/Disk \/dev.*/d' | sed '/Sector.*/d' | sed '/Partition Table.*/d' | sed '/Number.*/d' | sed '/.*Disk.*/d' | sed 's/.*extended.*/Partition-type: Extended, /g' | sed 's/.*logical.*/Partition-type: Logical, /g' | sed 's/.*primary.*/Partition-type: Primary, /g' | sed 's/.*B.*/Partition-type: Primary, /g' | sed 's/^$/divide1/g' | sed '/.*Error:.*/d' | sed '/.*Warning:.*/d' | tr "\n" "#" | sed 's/#/ #1 /g' | sed 's/divide1 #1 divide1 #1 divide1/divide1/g' | sed 's/divide1 #1 divide1/divide1/g' | sed 's/divide1 #1//1')
storage_devices_partition_types_working2=$(echo "$storage_devices_partition_types_working1" | sed 's/ #1 /\\n/g')
storage_devices_partition_types=$(echo -e "$storage_devices_partition_types_working2" | sed 's/ //g')
#Merge partitions and details into a new variable.
storage_devices_partitions_and_types_working1=$(paste <(echo "$storage_devices_partitions") <(echo "$storage_devices_partition_types"))
storage_devices_partitions_and_types_working2=$(echo "$storage_devices_partitions_and_types_working1" | sed 's/.*divide1.*/divide1/g' | sed 's/Partition-type:NotApplicable/Partition-type: Not applicable, /g' | tr "\t" " " | sed 's/partitionless1/Partitionless/g' | tr "\r" "Q" | sed 's/Q//g')
storage_devices_partitions_and_types_working3=$(echo "$storage_devices_partitions_and_types_working2"| tr "\n" "#" | sed 's/divide1/\\n/g' | sed 's/...$//' | sed 's/^/#/g')
storage_devices_partitions_and_types_working4=$(echo -e "$storage_devices_partitions_and_types_working3" | sed 's/^/\\n \\n/g')
storage_devices_partitions_and_types=$(echo -e "$storage_devices_partitions_and_types_working4" | sed 's/.$//' | sed 's/^.//')
#Merge variables into results variable.
storage_devices_results_working4=$(paste <(echo "$storage_devices_results_working3") <(echo "$storage_devices_model_names") <(echo "$storage_devices_partition_tables") <(echo "$storage_devices_partitions_and_types"))
storage_devices_results_working5=$(echo "$storage_devices_results_working4" | tr "\t" " " | sed 's/ REMOVE //g' | tr "#" "\n")
storage_devices_results=$(echo -e "$storage_devices_results_working5")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [=====   ]."
#Get model names for media devices
##lsblkd is used to get a list of devices, sed is used to trim out non-Sr devices, and replace them with a removal reminder.
mediadevicemodelnames_working1=$(lsblk -o name | sed '/.*sd.*[0-9]/d' | sed 's/.*sd.*/REMOVE /g' | sed '/.*loop.*/d' | sed '/NAME/d')
##lsblk is used to get the model-names, and Sed is used to delete empty lines, and remove the line containing the word "MODEL".
mediadevicemodelnames_working2=$(lsblk -o model | sed '/^$/d' | sed '/MODEL/d')
##Paste is used to merge the 2 previously created variables, but the model-name variable is trimmed using Sed; Sed removes lines containing the removal reminder.
mediadevicemodelnames_working3=$(paste <(echo "$mediadevicemodelnames_working1") <(echo "$mediadevicemodelnames_working2") | sed '/REMOVE/d')
##Tr is used to get rid of tabs and then Sed is used to add a dash in front of the model-name. Since only 4 optical drives are supported, head is used to trim all but the first 4 lines. Sed is used to add an @ to the end of the modelname to help trim out blank space later on. Sed is used to change instances of the model-name "CD-ROM          @" to "CD-ROM@". This is needed for VirtualBox guests.
mediadevicemodelnames=$(echo "$mediadevicemodelnames_working3" | tr "\t" "@" | sed 's/.*sr.*@/-/g' | head --lines=4 | sed 's/$/@/g' | sed 's/CD-ROM          @/CD-ROM@/g')
#Get media device types
##Each device type is gotten seperately using cd-drive. Sed and grep are used to isolate the details, then sed removes excess text, and adds numerals based on type. Sort uses the numerals to re-order the types the drive supports, and then tail is used to get the highest type on the list.
mediadevice1type=$(cd-drive -i /dev/sr0 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive one was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice1type" == "" ]]; then
    mediadevice1type="Unknown"
fi
mediadevice2type=$(cd-drive -i /dev/sr1 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive 2 was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice2type" == "" ]]; then
    mediadevice2type="Unknown"
fi
mediadevice3type=$(cd-drive -i /dev/sr2 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive 3 was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice3type" == "" ]]; then
    mediadevice3type="Unknown"
fi
mediadevice4type=$(cd-drive -i /dev/sr3 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive 4 was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice4type" == "" ]]; then
    mediadevice4type="Unknown"
fi
##The device type variables are echoed and saved into a single variable.
mediadevicetypes_raw=$(echo "$mediadevice1type" && echo "$mediadevice2type" && echo "$mediadevice3type" && echo "$mediadevice4type")
mediadevicemodelnameslinecount=$(echo "$mediadevicemodelnames" | wc -l)
##The device types variable is trimmed to match the number of lines in the modelnames variable.
mediadevicetypes=$(echo "$mediadevicetypes_raw" | head --lines="$mediadevicemodelnameslinecount")
#Merge variables
##Paste is used to combine the model names and media types variables.
mediadevices_raw=$(paste <(echo "$mediadevicemodelnames") <(echo "$mediadevicetypes"))
##The mediadevices variable is echoed, then TR is used to remove tabs, and replace them with an @ symbol. Sed is used to trim extra space between the model-name and device-type using the added @ symbols.
mediadevices=$(echo "$mediadevices_raw" | tr "\t" "@" | sed 's/@.*@/ /g')
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [======  ]."
#List running OS
##The os variable is set to "Linux Mint Cinnamon".
os="Linux Mint Cinnamon"
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [======= ]."
#Detect running kernel
##Uname is used to get the kernel information. Sed is used to trim it to just the version number.
kernel=$(uname -r | sed 's/[a-z]//g' | sed 's/[A-Z]//g' | sed 's/-.*//g' | sed 's/$/@/g' | sed 's/.0@//g' | sed 's/@//g')
#Detect the active computer firmware interface (eg: BIOS, EFI, UEFI).
##Head is used to see if the efi folder is present, stderror is directed to stdout, then Sed removes excess text from the error message. The result is saved to a variable.
acfi_raw=$(head --lines=1 /sys/firmware/efi 2>&1 | sed 's/.*: //g')
##Dmesg is used to find the EFIorUEFI release number, grep and sed are used to isolate the release number.
efioruefiversion=$(dmesg | grep -a "EFI v" | sed 's/[a-z]//g' | sed 's/[A-Z]//g' | sed 's/.*:  //g' | sed 's/ .*//g')
##An if elif else statement is used to see if the first number of the EFI/UEFI release number is 1 or 2. It's one the variable "efioruefi" is set to EFI, if it's 2 then the variable is set to UEFI, and if it's something else then the variable is set to "EFI or UEFI".
if [[ "${efioruefiversion:0:1}" == "1" ]]; then
    efioruefi=EFI
elif [[ "${efioruefiversion:0:1}" == "2" ]]; then
    efioruefi=UEFI
else
    efioruefi="EFI or UEFI"
fi
##The variable acfi_raw is checked against expected outputs to determine if the EFI folder is present, and use that information to decide if the acfi variable should indicate BIOS, UEFI, or Unknown is active.
if [[ "$acfi_raw" == "Is a directory" ]]; then
    acfi=$(echo "$efioruefi")
elif [[ "$acfi_raw" == "No such file or directory" ]]; then
    acfi=BIOS
else
    acfi=Unknown
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [========]."
#Display results
##Echo is used to display the necessary text, in an organized manner, along with the gathered variables.
echo System Information
echo CPU:
echo "-$cpu_model $cpu_rated_clock_rate rated ($cpu_core_clock_rates) running $cpu_core core $cpu_arch"
echo " -Supports PAE: $cpu_pae"
echo " -Virtualization Support: $cpu_virt"
echo GPUs:
echo "$gpu_models"
echo RAM: $ram GiB
echo Network Adapters:
echo "$network_results"
echo Storage Devices:
echo "$storage_devices_results"
echo Media Devices:
echo "$mediadevices"
echo Operating System: "$os (Kernel:$kernel)"
echo Active Computer Firmware Interface: "$acfi"


#322 Guest_hollowface_*

Guest_hollowface_*

  •  Avatar image
  • Guests
  • OFFLINE
  •  

Posted 17 September 2015 - 02:42 PM

Reveal For Linux Mint 17.1 Cinnamon 64bit 1.0 Stable
 
This is a stable release for all to use. To install Reveal, copy the code into a new text file, name it "reveal.sh" (or whatever you'd like to call it), and save it in your home folder (or where-ever you'd like to save it). To run Reveal type "bash ~/reveal.sh". You'll need to substitute "reaveal.sh" for the name you gave the file, and "~/" for the path to where you saved it (eg: "/directory1/directory2").

#!/bin/bash
#Reveal For Linux Mint 17.1 Cinnamon 64bit 1.0 Stable
#Throughout the code the Reveal release and a progress message are displayed.
#Check for dependencies.
revealrelease="Reveal For Linux Mint 17.1 Cinnamon 64bit 1.0 Stable"
depprog="Checking for dependencies. Progress:"
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [                            ]."
##Checking for Sed.
dep1=$(sed --version | head --lines=1 | sed 's/.*(GNU sed) //g')
if [[ "$dep1" == "4.2.2" ]]; then
    dep1="dep1_working"
else
    dep1="dep1_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=                           ]."
##Checking for Grep.
dep2=$(grep --version | head --lines=1 | sed 's/.*(GNU grep) //g')
if [[ "$dep2" == "2.16" ]]; then
    dep2="dep2_working"
else
    dep2="dep2_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==                          ]."
##Checking for "/proc/cpuinfo".
dep3=$(wc -l /proc/cpuinfo)
if [[ "${dep3:4:4}" == "proc" ]]; then
    dep3="dep3_working"
elif [[ "$dep3:5:4}" == "proc" ]]; then
    dep3="dep3_working"
else
    dep3="dep3_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===                         ]."
##Checking for Bash.
dep4=$(bash --version | head --lines=1 | sed 's/.*version //g' | sed 's/(.*//g')
if [[ "$dep4" == "4.3.11" ]]; then
    dep4="dep4_working"
else
    dep4="dep4_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [====                        ]."
##Checking for CPUfreq-utils.
dep5=$(cpufreq-info -h | head --lines=1 | sed 's/.*cpufrequtils //g' | sed 's/: cpufreq-info.*//g')
if [[ "$dep5" == "008" ]]; then
    dep5="dep5_working"
else
    dep5="dep5_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=====                       ]."
##Checking for Echo.
dep6=$(head --lines=1 /bin/echo | wc -l)
if [[ "${dep6:0:1}" == "1" ]]; then
    dep6="dep6_working"
else
    dep6="dep6_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [======                      ]."
##Checking for Head.
dep7=$(head --version | head --lines=1 | sed 's/.*) //g')
if [[ "$dep7" == "8.21" ]]; then
    dep7="dep7_working"
else
    dep7="dep7_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=======                     ]."
##Checking for Tail.
dep8=$(tail --version | head --lines=1 | sed 's/.*) //g')
if [[ "$dep8" == "8.21" ]]; then
    dep8="dep8_working"
else
    dep8="dep8_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [========                    ]."
##Checking for Lscpu.
dep9=$(lscpu --help | grep [a-z] | head --lines=1)
if [[ "${dep9:0:5}" == "Usage" ]]; then
    dep9="dep9_working"
else
    dep9="dep9_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=========                   ]."
##Checking for Lshw.
dep10=$(lshw -v 2>&1 | grep lshw | head --lines=1 | sed 's/.*(lshw) - //g')
if [[ "$dep10" == "B.02.16" ]]; then
    dep10="dep10_working"
else
    dep10="dep10_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==========                  ]"
##Checking for Sudo.
dep11=$(sudo --version | head --lines=1 | sed 's/.*version //g')
if [[ "$dep11" == "1.8.9p5" ]]; then
    dep11="dep11_working"
else
    dep11="dep11_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===========                 ]."
##Checking for "/dev/null".
dep12=$(ls /dev/null | head --lines=1)
if [[ "${dep12:5:4}" == "null" ]]; then
    dep12="dep12_working"
else
    dep12="dep12_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============                ]."
##Checking for Dmidecode.
dep13=$(dmidecode --version)
if [[ "$dep13" == "2.12" ]]; then
    dep13="dep13_working"
else
    dep13="dep13_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=============               ]."
##Checking for Bc.
dep14=$(bc --version | head --lines=1 | sed 's/.*bc //g')
if [[ "$dep14" == "1.06.95" ]]; then
    dep14="dep14_working"
else
    dep14="dep14_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==============              ]."
##Checking for Inxi.
dep15=$(inxi --version | head --lines=2 | tail --lines=1 | sed 's/.*: //g')
if [[ "$dep15" == "1.8.4-00" ]]; then
    dep15="dep15_working"
elif [[ "${dep15:5:9}" == "1.9.17-00" ]]; then
    dep15="dep15_working"
else
    dep15="dep15_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===============             ]."
##Checking for Tac.
dep16=$(tac --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep16" == "8.21" ]]; then
    dep16="dep16_working"
else
    dep16="dep16_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [================            ]."
##Checking for Paste.
dep17=$(paste --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep17" == "8.21" ]]; then
    dep17="dep17_working"
else
    dep17="dep17_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=================           ]."
##Checking for Ls.
dep18=$(ls --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep18" == "8.21" ]]; then
    dep18="dep18_working"
else
    dep18="dep18_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==================          ]."
##Checking for Wc.
dep19=$(wc --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep19" == "8.21" ]]; then
    dep19="dep19_working"
else
    dep19="dep19_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [===================         ]."
##Checking for Seq.
dep20=$(seq --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep20" == "8.21" ]]; then
    dep20="dep20_working"
else
    dep20="dep20_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [====================        ]."
##Checking for Parted.
dep21=$(parted --version | sed 's/.*(GNU parted) //g' | head --lines=1)
if [[ "$dep21" == "2.3" ]]; then
    dep21="dep21_working"
else
    dep21="dep21_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=====================       ]."
##Checking for Tr.
dep22=$(tr --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep22" == "8.21" ]]; then
    dep22="dep22_working"
else
    dep22="dep22_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [======================      ]."
##Checking for Lsblk.
dep23=$(lsblk -h | head --lines=2 | tail --lines=1)
if [[ "${dep23:0:5}" == "Usage" ]]; then
    dep23="dep23_working"
else
    dep23="dep23_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=======================     ]."
##Checking for Cd-drive.
dep24=$(cd-drive --version | head --lines=1 | sed 's/.*version //g' | sed 's/ x86.*//g')
if [[ "$dep24" == "0.83" ]]; then
    dep24="dep24_working"
else
    dep24="dep24_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [========================    ]."
##Checking for Sort.
dep25=$(sort --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep25" == "8.21" ]]; then
    dep25="dep25_working"
else
    dep25="dep25_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=========================   ]."
##Checking for Uname.
dep26=$(uname --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep26" == "8.21" ]]; then
    dep26="dep26_working"
else
    dep26="dep26_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [==========================  ]."
##Checking for Cat.
dep27=$(cat --version | sed 's/.*(GNU coreutils) //g' | head --lines=1)
if [[ "$dep27" == "8.21" ]]; then
    dep27="dep27_working"
else
    dep27="dep27_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [=========================== ]."
##Checking for Dmesg.
dep28=$(dmesg --version | head --lines=1 | sed 's/.*from //g')
if [[ "$dep28" == "util-linux 2.20.1" ]]; then
    dep28="dep28_working"
else
    dep28="dep28_error"
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
##The depency checks are combined.
deps=$(echo "Dependency Check Results:" && echo "$dep1 $dep2 $dep3 $dep4 $dep5 $dep6 $dep7 $dep8 $dep9 $dep10 $dep11 $dep12 $dep13 $dep14 $dep15 $dep16 $dep17 $dep18 $dep19 $dep20 $dep21 $dep22 $dep23 $dep24 $dep25 $dep26 $dep27 $dep28")
##The results of the dependency check is outputted.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
infoprog=$(echo "Collecting information about your system. Progress:")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [        ]."
#Get CPU model and trim excess text.
##Cat reads data to a pipe, grep finds lines starting with "model name", sed trims text from the beginning of the line so that just the actual model name remains, and lastly head and tail trim the output to a single line as on mult-CPU systems there will be more than one line. This output is set to the variable "cpu_model". If statements specific to certain cpus are then run to trim excess text from the model name for cleaner formatting.
cpu_model=$(cat /proc/cpuinfo | grep -a "model name" | sed 's/^.............//' | head --lines=1 | tail --lines=1)
if [[ "$cpu_model" == "AMD A10-4600M APU with Radeon(tm) HD Graphics" ]]; then
    cpu_model="AMD A10-4600M"
fi
if [[ "$cpu_model" == "Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz" ]]; then
    cpu_model="Intel Core i5-4460"
fi
if [[ "$cpu_model" == "AMD Athlon(tm) 64 X2 Dual Core Processor 4200+" ]]; then
    cpu_model="AMD Athlon 64 X2 4200+"
fi
if [[ "$cpu_model" == "AMD A4-3305M APU with Radeon(tm) HD Graphics" ]]; then
    cpu_model="AMD A4-3305M"
fi
#Get CPU core running clock-rates and trim excess text.
##CPUFreqUtils gets the CPU core clock-rates, grep is used to detect the clock rate-lines, Sed trims excess text from the front, Sed trims the period from the end, Sed adds a space to the front of each line. This output is set to the variable which is then echoed so that clock-rates can be compressed to a single line.
cpu_core_clock_rates_raw=$(cpufreq-info | grep -a "current CPU frequency" | sed 's/(asserted by call to hardware)//g' | sed 's/^...........................//' | sed 's/\.$//' | sed 's/^/ /')
cpu_core_clock_rates=$(echo $cpu_core_clock_rates_raw)
#Get CPU rated-clock-rate and trim excess text.
##CPUFreqUtils gets the CPUs rated clock-rate, grep is used to detect the CPU clock rate-line, then head and tail trim the output to a single line. This output is set to the variable "cpu_rated_cock_rate_raw" which is then echoed so that rated clock-rate can be extracted from the range of clock-rates. This output is assigned to the variable "cpu_rated_clock_rate".
cpu_rated_clock_rate_raw=$(cpufreq-info | grep -a "hardware limits" | head --lines=1 | tail --lines=1)
cpu_rated_clock_rate=$(echo ${cpu_rated_clock_rate_raw:(-8)})
#Get CPU core count and trim excess text.
##The command lscpu is run, grep is used to detect the CPU cores line, sed trims text from the beginning so just the number is left, and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_core".
cpu_core=$(lscpu | grep -a "Core(s) per socket" | sed 's/^.......................//' | head --lines=1 | tail --lines=1)
##Some AMD Multi-core CPUs (eg: Bulldozer, Piledriver, Steamroller) have more than 1 core per module, because of this they are detected as having less cores than they have when using lscpu to detect cores on a per socket basis. To fix this, the below code scans for select models, and gets the correct value using the "CPU(s)" line from lscpu. Static values aren't used because this would result in incorrect values in virtual-machines where more cores are assigned than the host has. This may not function correctly on Multi-CPU systems (for which no testing has been done).
case $cpu_model in
  "AMD A10-4600M") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
case ${cpu_model:0:13} in
  "AMD A10-4655M" | "AMD A10-5745M" | "AMD A10-5757M" | "AMD A10-5750M" | "AMD A10-6800K" | "AMD A10-5800K") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
case ${cpu_model:0:12} in
  "AMD A4-4355M" | "AMD A4-5145M" | "AMD A6-4455M" | "AMD A6-5345M" | "AMD A6-5357M" | "AMD A8-4555M" | "AMD A8-5545M" | "AMD A8-5557M" | "AMD A4-4300M" | "AMD A4-5150M" | "AMD A6-4400M" | "AMD A6-5350M" | "AMD A8-4500M" | "AMD A8-5550M" | "AMD A10-6700" | "AMD A10-5700" | "AMD A8-6600K" | "AMD A8-5600K" | "AMD A6-6400K" | "AMD A6-5400K") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
case ${cpu_model:0:11} in
  "AMD FX-9590" | "AMD FX-9370" | "AMD FX-8350" | "AMD FX-8320" | "AMD FX-8300" | "AMD FX-6350" | "AMD FX-6300" | "AMD FX-4350" | "AMD FX-4320" | "AMD FX-4300" | "AMD A8-6500" | "AMD A8-5500" | "AMD A4-5300" | "AMD A4-4000" | "AMD FX-8150" | "AMD FX-8120" | "AMD FX-8100" | "AMD FX-6200" | "AMD FX-6120" | "AMD FX-6100" | "AMD FX-4170" | "AMD FX-4130" | "AMD FX-4100") cpu_core=$(lscpu | grep -a "CPU(s):" | sed 's/^.......................//' | head --lines=1 | tail --lines=1);;
esac
#Detect CPU architecture. (The user will always be running an X86-64 CPU, because that's what Linux Mint Cinnamon 64bit requires.)
##The command lscpu is run, grep is used to detect the architecture line, sed trims text from the beginning so just the architecture is left, and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_arch". The variable is then checked using an if statement to see if the architecture is "x86_64", if it is the variable is reset to say "X86-64".
cpu_arch=$(lscpu | grep -a "Architecture" | sed 's/^.......................//' | head --lines=1 | tail --lines=1)
if [[ "$cpu_arch" == "x86_64" ]]; then
    cpu_arch=X86-64
fi
#Detect if CPU supports PAE.
##Cat reads from a file, grep is used to detect the flags entry, grep is used to search for the "pae" flag, sed trims text from the beginning so just the flag is left, and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_pae_raw". The variable is then checked using an if statement to see if the variable is empty or pae. If it is pae then the variable "cpu_pae" is set to "Yes", if it isn't then it's set to "No".
cpu_pae_raw=$(cat /proc/cpuinfo | grep -a "flags" | grep -a -o "pae" | head --lines=1 | tail --lines=1)
if [[ "$cpu_pae_raw" == "pae" ]]; then
    cpu_pae=Yes
else
    cpu_pae=No
fi
#Detect if CPUs have virtualization support
##Cat reads from a file, grep is used to detect the flags entry, grep is used to search for the "vmx" flag, sed replaces "vmx" with "Yes", and then head and tail trim the output to a single line in case multiple matches are found. This output is set to the variable "cpu_virt_raw_1". The same process is done for the "svm" flag, and assigned to "cpu_virt_raw_2". An if else statement is then used to set the variable "cpu_virt" as "Yes" if either of the other 2 variables is "Yes", or "No" if they aren't. Vmx is for Intel CPUs (VT-x), and svm is for AMD CPUs (AMD-V). This only indicates whether the CPU has virtualization support, not whether it's currently enabled.
cpu_virt_raw_1=$(cat /proc/cpuinfo | grep -a "flags" | grep -a -o "vmx" | sed 's/vmx/Yes/' | head --lines=1 | tail --lines=1)
cpu_virt_raw_2=$(cat /proc/cpuinfo | grep -a "flags" | grep -a -o "svm" | sed 's/svm/Yes/' | head --lines=1 | tail --lines=1)
if [[ "$cpu_virt_raw_1" == "Yes" ]]; then
    cpu_virt=Yes
elif [[ "$cpu_virt_raw_2" == "Yes" ]]; then
    cpu_virt=Yes
else
    cpu_virt=No
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [=       ]."
#Get GPU models, trims excess text, and adds a dash to the beginning of each line.
##Lshw is used to get the GPU models. Grep trims grabs just the lines with the model-names on them. Sed trims excess chracters and space from in front of the model-name, and then Sed is used again to add a dash to the beginning of each line. The output of all of this is assigned to the variable gpu_models_raw.
gpu_models_raw=$(lshw -C display 2>/dev/null | grep -a "product" | sed 's/^................//' | sed 's/^/-/')
#Fix GPU model names.
##The variable gpu_models_raw is echoed so that Sed can be used to search for matches to known model-names that use poor naming in the hopes of swapping them for cleaner names. The output is assigned to the variable gpu_models.
gpu_models=$(echo "$gpu_models_raw" | sed 's/Trinity \[Radeon HD 7660G]/Radeon HD 7660G/g' | sed 's/Whistler LE \[Radeon HD 6610M\/7610M]/Radeon HD 6610M\/7610M/g' | sed 's/SVGA II Adapter/VMware SVGA II Adapter/g' | sed 's/Xeon E3-1200 v3\/4th Gen Core Processor Integrated Graphics Controller/Intel HD Graphics 4600/g' | sed 's/Sumo \[Radeon HD 6480G\]/Radeon HD 6480G/g')
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [==      ]."
#Get RAM amount
##Get RAM amount in mebibytes (MiB)(1,048,576 bytes) from dmidecode, use Grep to extract the Size entry, use Sed to trim excess text from front and back, use head and tail to trim output to a the first line. This is all assigned to the variable "ram_raw".
ram_raw=$(sudo dmidecode --type memory | grep -a "Size: " | grep -a MB | sed 's/^.......//g' | sed 's/ MB.*//g' | sed '/.*a.*$/d' | sed '/.*b.*$/d' | sed '/.*c.*$/d' | sed '/.*d.*$/d' | sed '/.*e.*$/d' | sed '/.*f.*$/d' | sed '/.*g.*$/d' | sed '/.*h.*$/d' | sed '/.*i.*$/d' | sed '/.*j.*$/d' | sed '/.*k.*$/d' | sed '/.*l.*$/d' | sed '/.*m.*$/d' | sed '/.*n.*$/d' | sed '/.*o.*$/d' | sed '/.*p.*$/d' | sed '/.*q.*$/d' | sed '/.*r.*$/d' | sed '/.*s.*$/d' | sed '/.*t.*$/d' | sed '/.*u.*$/d' | sed '/.*v.*$/d' | sed '/.*w.*$/d' | sed '/.*x.*$/d' | sed '/.*y.*$/d' | sed '/.*z.*$/d' | sed 's/^/\+/g')
ram_working1=$(echo $ram_raw | sed 's/ +/+/g' | sed 's/^+//')
ram_working2=$(echo $ram_working1 | bc)
##Use Bc to convert the data in "ram_raw" from mebibytes (MiB)(1,048,576 bytes) to gibibytes (GiB)(1,073,741,824 bytes), by dividing by 1024, and calcuating to 2 decimal places. The result is assigned to the variable "ram".
ram=$(bc <<< "scale=2;$ram_working2/1024")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [===     ]."
#Get Network-adapter-models and trim excess text.
##INXI is used to get the model-names, grep extracts the card line (this is where the model-name is), and then Sed trims excess text from the front of each line, and removes the driver information from the end of the line. Tac reverses the output so it will match the order of later variables.
network_adapter_models_raw=$(inxi -c 0 -N | grep -a "Card" | sed 's/^................./-/g' | sed 's/driver:.*//g' | sed 's/-: /-/g' | tac)
##Sed is used to clean up model-name formatting for some model-names.
network_adapter_models=$(echo "$network_adapter_models_raw" | sed 's/Belkin F5D8053 N Wireless USB Adapter v3000 \[Ralink RT2870\]/Belkin F5D8053 N Wireless USB Adapter/g' | sed 's/ASUSTek USB-N13 802.11n Network Adapter (rev. A1) \[Ralink RT3072\]/ASUSTek USB-N13 802.11n Network Adapter/g' | sed 's/ ASUSTek USB-N13 802.11n Network Adapter (rev. A1) \[Ralink RT3072\]/ASUSTek USB-N13 802.11n Network Adapter/g' | sed 's/ Ralink RT5370 Wireless Adapter/Ralink RT5370 Wireless Adapter/g' | sed 's/Intel 82545EM Gigabit Ethernet Controller (Copper)/Intel 82545EM Gigabit Ethernet Controller/g')
#Get network-adapter types and trim excess text.
##Lshw is used to get the capabilities of each adapter, and then excess text is trimmed from the front of the line.
network_adapters_type_raw=$(lshw -class network 2>/dev/null | grep -a "capabilities" | sed 's/^...................//g')
##Sed is used to replace "ethernet" with text identifying the adapter as wired, and replace "wireless" with text identifying the adapter as wireless.
network_adapters_type=$(echo "$network_adapters_type_raw" | sed 's/.*wireless.*/Wireless/g'| sed 's/.*ethernet.*/Wired/g' | sed 's/^/ -Adapter type: /g')
#Detect if adapter is configured.
##Lshw is used to get the interface names for each adapter, and grep and sed are used to replace it with a confirmation.
network_adapters_configured=$(lshw -class network 2>/dev/null | grep -a "logical name" | sed 's/.*eth.*/Yes/g' | sed 's/.*wlan.*/Yes/g' | sed 's/^/ -Configured: /g')
#Detect if adapter's network interface has an IP address.
##Lshw is used to detect the network interface for each model, Sed trims the excess text, Sed adds the ifconfig command in front of each interface name, and then Sed adds head and tail trimming commands to each line. This creates a series of commands for each network interface.
ipaddress_raw_part=$(lshw -class network 2>/dev/null | grep -a "logical name" | sed 's/^....................//g' | sed 's/^/ifconfig/g' | sed 's/$/ \| head -n 2 \| tail -n 1/g')
##Eval is used to execute the commands created in the previous variable, then Sed is used to replace the existing lines with either text confirming it has an IP address or stating that it doesn't. A line that has an IP address will say inet, but one that doesn't will say BROADCAST, all thanks to using head and tail in the previous commands.
ipaddress=$(eval "$ipaddress_raw_part" | sed 's/.*inet.*/ -IP Address: Yes/g' | sed 's/.*BROADCAST.*/ -IP Address: No/g' )
#Combine variables
##Paste is used to combine the variables. All the information for each adapter is combined to it's own line.
network_results_raw=$(paste <(echo "$network_adapter_models") <(echo "$network_adapters_type") <(echo "$network_adapters_configured") <(echo "$ipaddress"))
##Echo is used to display the combined variables, then Sed is used to add in \n before each item. \n means new line, but Sed isn't going to interpret it, it sends the text.
network_results_working1=$(echo "$network_results_raw" | sed 's/ -Adapter type:/\\n -Adapter type:/g' | sed 's/ -Configured:/\\n -Configured:/g' | sed 's/ -IP Address:/\\n -IP Address:/g')
##Echo is used to send the previously combined variables into a new variable, this time the \n text that was added by Sed will be interpretted.
network_results=$(echo -e "$network_results_working1")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [====    ]."
#Detect number of storage devices.
number_of_storage_devices=$(ls -1 /dev/sd* | sed 's/.*[0-9].*//g' | grep -a dev | wc -l)
#Setup output variable layout
storage_devices_results_working1=$(echo "$number_of_storage_devices * 3" | bc -l)
storage_devices_results_working2=$(seq 1 1 $storage_devices_results_working1 | sed 's/.*[0-9].*/ REMOVE/g')
storage_devices_results_working3=$(echo -e "$storage_devices_results_working2")
#Get the model-names for the storage devices
storage_devices_model_names_raw=$(sudo parted -l | sed '/Error: \/dev\/sr.*/d' | sed 's/Warning.*\/dev\/sr.*(Read-only file system).*//g' | sed 's/.*read-only.*//g' | sed 's/.*Error: \/dev/Model: Unknown \/dev/g' | tr "\n" "#" | sed 's/#Disk \/dev/Disk \/dev/g' | tr "#" "\n" | sed 's/Model:.*Disk \/dev\/sr.*//g' | grep -a "Model:" | sed 's/^......./-/g' | sed 's/(scsi)//g' | sed 's/: unrecognised.*//g' | sed 's/Disk \/dev.*//g')
storage_devices_model_names_working1=$(echo "$storage_devices_model_names_raw" | sed 's/$/ \\n REMOVE \\n REMOVE/g')
storage_devices_model_names=$(echo -e "$storage_devices_model_names_working1")
#Get the partition-table types for storage devices.
storage_devices_partition_tables_raw=$(sudo parted -l | sed '/Error: \/dev\/sr.*/d' | sed 's/Warning.*\/dev\/sr.*(Read-only file system).*//g' | sed 's/.*read-only.*//g' | sed 's/.*Error: \/dev.*/Partition Table: No partition table is present/g' | tr "\n" "#" | sed 's/#Partition Table/Partition table/g' | sed 's/#Sector size/Sector size/g' | tr "#" "\n" | sed 's/Disk \/dev\/sr.*Partition table.*//g' | grep -a "Partition table:" | sed 's/.*Partition table: / -Partition-table type: /g' | sed 's/gpt/G.P.T./g' | sed 's/msdos/M.B.R.P.T./g')
storage_devices_partition_tables_working1=$(echo "$storage_devices_partition_tables_raw" | sed 's/$/ \\n REMOVE/g' | sed 's/^/ REMOVE \\n/g')
storage_devices_partition_tables=$(echo -e "$storage_devices_partition_tables_working1")
#Get the partitions.
storage_devices_partitions_working1=$(sudo parted -l | sed '/.*Sector.*$/d' | sed '/.*Partition Table.*$/d' | tr "\n" "#" | sed 's/Flags###Model/Flags#EmptyPart##Model/g' | tr "#" "\n" | sed '/.*Model.*$/d' | sed '/Error: \/dev\/sr.*/d' | sed 's/Warning.*\/dev\/sr.*(Read-only file system).*//g' | sed 's/.*read-only.*//g' | sed 's/Error: \/dev/Disk \/dev/g' | tr "\n" "#" | sed 's/Flags#EmptyPart/EmptyPart/g' | tr "#" "\n" | sed 's/.*EmptyPart.*/EmptyPart/g' | tr "\n" "#" | sed 's/##EmptyPart/EmptyPart/g' | tr "#" "\n" | grep -a "Disk" | sed 's/.*EmptyPart.*/None/g' | sed 's/.*unrecognised.*/None/g' | sed 's/:.*//g' | sed 's/Disk/ls -1/g' | sed 's/$/*/g' | sed 's/.*None.*/echo \"partitionless1\"/g' | sed 's/$/ | tr \"\\n\" \"#\"/g' | sed 's/$/ \&\& echo \" divide1\"/g' | sed '/.*\/dev\/sr.*/d')
storage_devices_partitions_working2=$(eval "$storage_devices_partitions_working1" | sed 's/#/ #1 /g' | sed 's/#1/\\n/g')
storage_devices_partitions=$(echo -e "$storage_devices_partitions_working2" | sed '/[0-9]/!d' |sed 's/ //g' | sed 's/$/:/g' | sed 's/^/  - /g')
#Get the storage device partition types.
storage_devices_partition_types_working1=$(sudo parted -l | tr "\r" "&" | tr "\t" "&" | sed 's/&//g' | tr "\n" "#" | sed 's/Flags###Model/Flags#EmptyPart##Model/g' | tr "#" "\n" | sed '/Error: \/dev\/sr.*/d' | sed '/Warning.*\/dev\/sr.*(Read-only file system).*/d' | sed '/.*read-only.*/d' | tr "\n" "#" | sed 's/\/dev\/sr.*###//g' | tr "#" "\n" | sed 's/.*Error: \/dev.*/Partition-type: Not Applicable # divide1/g' | sed 's/.*EmptyPart.*/Partition-type: Not Applicable # divide1/g' | sed '/Model.*/d' | sed '/Disk \/dev.*/d' | sed '/Sector.*/d' | sed '/Partition Table.*/d' | sed '/Number.*/d' | sed '/.*Disk.*/d' | sed 's/.*extended.*/Partition-type: Extended, /g' | sed 's/.*logical.*/Partition-type: Logical, /g' | sed 's/.*primary.*/Partition-type: Primary, /g' | sed 's/.*B.*/Partition-type: Primary, /g' | sed 's/^$/divide1/g' | sed '/.*Error:.*/d' | sed '/.*Warning:.*/d' | tr "\n" "#" | sed 's/#/ #1 /g' | sed 's/divide1 #1 divide1 #1 divide1/divide1/g' | sed 's/divide1 #1 divide1/divide1/g' | sed 's/divide1 #1//1')
storage_devices_partition_types_working2=$(echo "$storage_devices_partition_types_working1" | sed 's/ #1 /\\n/g')
storage_devices_partition_types=$(echo -e "$storage_devices_partition_types_working2" | sed 's/ //g')
#Merge partitions and details into a new variable.
storage_devices_partitions_and_types_working1=$(paste <(echo "$storage_devices_partitions") <(echo "$storage_devices_partition_types"))
storage_devices_partitions_and_types_working2=$(echo "$storage_devices_partitions_and_types_working1" | sed 's/.*divide1.*/divide1/g' | sed 's/Partition-type:NotApplicable/Partition-type: Not applicable, /g' | tr "\t" " " | sed 's/partitionless1/Partitionless/g' | tr "\r" "Q" | sed 's/Q//g')
storage_devices_partitions_and_types_working3=$(echo "$storage_devices_partitions_and_types_working2"| tr "\n" "#" | sed 's/divide1/\\n/g' | sed 's/...$//' | sed 's/^/#/g')
storage_devices_partitions_and_types_working4=$(echo -e "$storage_devices_partitions_and_types_working3" | sed 's/^/\\n \\n/g')
storage_devices_partitions_and_types=$(echo -e "$storage_devices_partitions_and_types_working4" | sed 's/.$//' | sed 's/^.//')
#Merge variables into results variable.
storage_devices_results_working4=$(paste <(echo "$storage_devices_results_working3") <(echo "$storage_devices_model_names") <(echo "$storage_devices_partition_tables") <(echo "$storage_devices_partitions_and_types"))
storage_devices_results_working5=$(echo "$storage_devices_results_working4" | tr "\t" " " | sed 's/ REMOVE //g' | tr "#" "\n")
storage_devices_results=$(echo -e "$storage_devices_results_working5")
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [=====   ]."
#Get model names for media devices
##lsblkd is used to get a list of devices, sed is used to trim out non-Sr devices, and replace them with a removal reminder.
mediadevicemodelnames_working1=$(lsblk -o name | sed '/.*sd.*[0-9]/d' | sed 's/.*sd.*/REMOVE /g' | sed '/.*loop.*/d' | sed '/NAME/d')
##lsblk is used to get the model-names, and Sed is used to delete empty lines, and remove the line containing the word "MODEL".
mediadevicemodelnames_working2=$(lsblk -o model | sed '/^$/d' | sed '/MODEL/d')
##Paste is used to merge the 2 previously created variables, but the model-name variable is trimmed using Sed; Sed removes lines containing the removal reminder.
mediadevicemodelnames_working3=$(paste <(echo "$mediadevicemodelnames_working1") <(echo "$mediadevicemodelnames_working2") | sed '/REMOVE/d')
##Tr is used to get rid of tabs and then Sed is used to add a dash in front of the model-name. Since only 4 optical drives are supported, head is used to trim all but the first 4 lines. Sed is used to add an @ to the end of the modelname to help trim out blank space later on. Sed is used to change instances of the model-name "CD-ROM          @" to "CD-ROM@". This is needed for VirtualBox guests.
mediadevicemodelnames=$(echo "$mediadevicemodelnames_working3" | tr "\t" "@" | sed 's/.*sr.*@/-/g' | head --lines=4 | sed 's/$/@/g' | sed 's/CD-ROM          @/CD-ROM@/g')
#Get media device types
##Each device type is gotten seperately using cd-drive. Sed and grep are used to isolate the details, then sed removes excess text, and adds numerals based on type. Sort uses the numerals to re-order the types the drive supports, and then tail is used to get the highest type on the list.
mediadevice1type=$(cd-drive -i /dev/sr0 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive one was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice1type" == "" ]]; then
    mediadevice1type="Unknown"
fi
mediadevice2type=$(cd-drive -i /dev/sr1 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive 2 was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice2type" == "" ]]; then
    mediadevice2type="Unknown"
fi
mediadevice3type=$(cd-drive -i /dev/sr2 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive 3 was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice3type" == "" ]]; then
    mediadevice3type="Unknown"
fi
mediadevice4type=$(cd-drive -i /dev/sr3 | sed 's/Can read CD/@Can read CD/g' | sed 's/Can read DVD/@Can read DVD/g' | sed 's/Can write CD/@Can write CD/g' | sed 's/Can write DVD/@Can write DVD/g' | grep -a @ | grep -a Yes | sed 's/.*read CD-RW.*/3 CD-ROM/g' | sed 's/.*read CD-R.*/2 CD-ROM/g' | sed 's/.*read CD-DA.*/1 CD-ROM/g' | sed 's/.*write CD-RW.*/4 CD-RW/g' | sed 's/.*write DVD-RAM.*/9 DVD-RAM/g' | sed 's/.*read DVD-ROM.*/5 DVD-ROM/g' | sed 's/.*write DVD-RW.*/# DVD-RW/g' | sed 's/.*write DVD+RW.*/8 DVD+RW/g' | sed 's/.*write DVD-RW.*/7 DVD-RW/g' | sed 's/.*write DVD-R.*/6 DVD-R/g' | sort -n | tail --lines=1 | sed 's/[0-9] //g')
##An if statement is used to check and see if the mediatype for drive 4 was successfully detected. If it is blank it will be changed to "Unknown".
if [[ "$mediadevice4type" == "" ]]; then
    mediadevice4type="Unknown"
fi
##The device type variables are echoed and saved into a single variable.
mediadevicetypes_raw=$(echo "$mediadevice1type" && echo "$mediadevice2type" && echo "$mediadevice3type" && echo "$mediadevice4type")
mediadevicemodelnameslinecount=$(echo "$mediadevicemodelnames" | wc -l)
##The device types variable is trimmed to match the number of lines in the modelnames variable.
mediadevicetypes=$(echo "$mediadevicetypes_raw" | head --lines="$mediadevicemodelnameslinecount")
#Merge variables
##Paste is used to combine the model names and media types variables.
mediadevices_raw=$(paste <(echo "$mediadevicemodelnames") <(echo "$mediadevicetypes"))
##The mediadevices variable is echoed, then TR is used to remove tabs, and replace them with an @ symbol. Sed is used to trim extra space between the model-name and device-type using the added @ symbols.
mediadevices=$(echo "$mediadevices_raw" | tr "\t" "@" | sed 's/@.*@/ /g')
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [======  ]."
#List running OS
##The os variable is set to "Linux Mint Cinnamon".
os="Linux Mint Cinnamon"
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [======= ]."
#Detect running kernel
##Uname is used to get the kernel information. Sed is used to trim it to just the version number.
kernel=$(uname -r | sed 's/[a-z]//g' | sed 's/[A-Z]//g' | sed 's/-.*//g' | sed 's/$/@/g' | sed 's/.0@//g' | sed 's/@//g')
#Detect the active computer firmware interface (eg: BIOS, EFI, UEFI).
##Head is used to see if the efi folder is present, stderror is directed to stdout, then Sed removes excess text from the error message. The result is saved to a variable.
acfi_raw=$(head --lines=1 /sys/firmware/efi 2>&1 | sed 's/.*: //g')
##Dmesg is used to find the EFIorUEFI release number, grep and sed are used to isolate the release number.
efioruefiversion=$(dmesg | grep -a "EFI v" | sed 's/[a-z]//g' | sed 's/[A-Z]//g' | sed 's/.*:  //g' | sed 's/ .*//g')
##An if elif else statement is used to see if the first number of the EFI/UEFI release number is 1 or 2. It's one the variable "efioruefi" is set to EFI, if it's 2 then the variable is set to UEFI, and if it's something else then the variable is set to "EFI or UEFI".
if [[ "${efioruefiversion:0:1}" == "1" ]]; then
    efioruefi=EFI
elif [[ "${efioruefiversion:0:1}" == "2" ]]; then
    efioruefi=UEFI
else
    efioruefi="EFI or UEFI"
fi
##The variable acfi_raw is checked against expected outputs to determine if the EFI folder is present, and use that information to decide if the acfi variable should indicate BIOS, UEFI, or Unknown is active.
if [[ "$acfi_raw" == "Is a directory" ]]; then
    acfi=$(echo "$efioruefi")
elif [[ "$acfi_raw" == "No such file or directory" ]]; then
    acfi=BIOS
else
    acfi=Unknown
fi
###Progress Code.
clear
echo "$revealrelease"
echo "$depprog [============================]."
echo "$deps"
echo ""
echo "$infoprog [========]."
#Display results
##Echo is used to display the necessary text, in an organized manner, along with the gathered variables.
echo System Information
echo CPU:
echo "-$cpu_model $cpu_rated_clock_rate rated ($cpu_core_clock_rates) running $cpu_core core $cpu_arch"
echo " -Supports PAE: $cpu_pae"
echo " -Virtualization Support: $cpu_virt"
echo GPUs:
echo "$gpu_models"
echo RAM: $ram GiB
echo Network Adapters:
echo "$network_results"
echo Storage Devices:
echo "$storage_devices_results"
echo Media Devices:
echo "$mediadevices"
echo Operating System: "$os (Kernel:$kernel)"
echo Active Computer Firmware Interface: "$acfi"

Known Issues:
- Clock-rate detections don't work in VMware Player, or VirtualBox.
- Ram detection doesn't work in VirtualBox.
- For some people the network detection code doesn't output properly. The adapter type, adapter network interface connection status, and adapter network interface connection IP address confirmation, don't show up.
- Reveal doesn't support USB network adapters. If any are attached, all of the network details will be mismatched.
- Storage-devices that don't have a partition-table applied, will not have their model-name displayed.
- Under some circumstances Reveal will hang when getting the storage details. This is caused by Parted prompting for user input in response to issues with the user's storage device. For example, a flash drive that has had an ISO written to it with dd, or a damaged partition table.
- Incorrectly detects the device-type for: Bluray (any kind), DVD+R, CD+RW, CD+R, and CD-R drives. They will appear as the highest ranking type that Reveal can detect, if any. Correctly detects: DVD-RAM, DVD+RW, DVD-RW, DVD-R, DVD-ROM, CD-RW, and some CD-ROM drives.
- Doesn't distinguish between media-devices capable of using dual-layer DVDs and those using only single-layer DVDs.

Additional Requirements:
- Depends on package "libcdio-utils" for program "Cd-drive". This package is not pre-installed on Linux Mint 17.1 Cinnamon 64bit, but is available in the default repositories.
- Reveal must be run by a sudoer as some commands require elevated permissions, and they achieve this with Sudo.

#323 Guest_hollowface_*

Guest_hollowface_*

  •  Avatar image
  • Guests
  • OFFLINE
  •  

Posted 17 September 2015 - 02:54 PM

Reveal is a tool designed to output details commonly needed in posts on BC (as opposed to every detail about your computer), and currently it does this well (unless you're plagued by a known issue :( ). There is, of course, room for new features (and debates for removal of features), the existing code/features can always be improved, and there are plenty of operating systems it could be ported to. However this was a temporary project, created just for fun. It was known from the start that this project would die long before reaching all of it's goals. I think reaching our first stable release is pretty impressive though. :)

With a project like this, the work never really ends, there's always more you can do. I've had fun working on Reveal, and learned tons, but it's time for me to move on. Now seems a fitting time to stop. If anyone else wants to take over administrating this thread and continue development, free free to, otherwise consider Reveal discontinued.

Thanks to all whom followed along, or participated in this little project! I hope you found it interesting. :)






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users