3333# ### Variables
3434# #######################################################################
3535# Versioning
36- version=" Version: 01.00-06 , Script Date: 2022.03.06 "
36+ version=" Version: 01.00-07 , Script Date: 2022.03.07 "
3737# md5_sum=$(md5sum $sname | sed 's/system.*//g' )
3838arg1=$1
3939arg2=$2
@@ -59,6 +59,8 @@ LTS_PKG=""
5959# variables to keep track of missing programs...
6060missing_programs=" "
6161check_paster=0
62+ # Variable to track upload status as uploaded
63+ check_paste=1
6264missing_paster_progs=" "
6365# Logger settings
6466# Change verbosity to show level of warnings. Range: -1 through 5. -1 is show nothing.
@@ -183,6 +185,7 @@ function CheckPrerequisites()
183185 free
184186 gsettings
185187 gzip
188+ tar
186189 md5sum
187190 mokutil
188191 curl
@@ -269,7 +272,7 @@ function CheckPrerequisites()
269272 nl
270273
271274 ans=
272- while [ " $ans " != " e" ] && [ " $ans " != " c " ]
275+ while [ " $ans " != " e" ] && [ " $ans " != " E " ] && [ " $ans " != " c " ] && [ " $ans " != " C " ]
273276 do
274277 read -erp " <E>xit and install the program(s) or <C>ontinue anyway? <E/C> " ans
275278 ans=" ${ans,} "
@@ -621,6 +624,7 @@ function GetFQDN()
621624function GetDiskInfo()
622625{
623626 # Gets filesystem, disk, fstab and moutn information. Called once by Writer().
627+ GetStorageControllers
624628 echo -e " ${setansi} ---------- File system specs from 'df -h':$ransi "
625629 df -hT -x tmpfs -x devtmpfs | grep -v ' /snap/'
626630 nl
@@ -640,6 +644,32 @@ function GetDiskInfo()
640644 nl
641645}
642646
647+ function GetStorageControllers() {
648+ # Based on this information:
649+ # lspci | grep --color=never -i -e 'IDE controller' -e 'SATA controller' -e 'SCSI controller' -e 'Non-Volatile memory controller' -e 'RAID Controller'
650+ echo -e " ${setansi} ---------- Storage Controller Information From 'lspci':$ransi "
651+ cntrllr_busid_list=$( lspci | grep --color=never -i -e ' IDE controller' \
652+ -e ' SATA controller' \
653+ -e ' SCSI controller' \
654+ -e ' Non-Volatile memory controller' \
655+ -e ' RAID Controller' | \
656+ awk ' {print $1}' )
657+ # Modified for devices which have no formal storage controllers besides USB or SD
658+ if [ ! -z " $cntrllr_busid_list " ]
659+ then
660+ # Parse through list )array) and show detailed information on each
661+ for controller in " ${cntrllr_busid_list} "
662+ do
663+ sudo lspci -s $controller -vv
664+ nl
665+ done
666+ else
667+ echo -e " No storage controller found. Check in 'lsusb' section."
668+ echo -e " May be USB or SD storage."
669+ nl
670+ fi
671+ }
672+
643673function GetGraphicsEnv()
644674{
645675 # Gets Graphics Layer Information. Called once by Writer().
@@ -708,8 +738,8 @@ function GetGraphicsEnv()
708738 else
709739 echo -e " The Current Desktop Theme: Is not set,this is Console Based."
710740 fi
711- virt_ttys=$( ps -e | awk ' $2 ~ /^tty/ && $2 ! ~ /^ttyS/ {print "\t" $2 "\t" $4}' )
712- echo -e " The Current Virtual TTYs being used are:"
741+ virt_ttys=$( ps -e | awk ' $2 ~ /^tty/ || $2 ~ /^ttyS/ || $2 ~ /^pts / {print "\t" $2 "\t" $4}' )
742+ echo -e " The Current Virtual TTY's being used are:"
713743 echo -e " \tTTY#\tUsed By"
714744 echo -e " $virt_ttys "
715745 nl
@@ -1056,6 +1086,78 @@ function nl()
10561086 echo -e " "
10571087}
10581088
1089+ function Pause()
1090+ {
1091+ read -n 1 -s -r -p " Press any key to continue"
1092+ nl
1093+ }
1094+
1095+ function ArchiveReport() {
1096+ # Check if uploaded (successfully)...
1097+ # $check-paste is 1 at start (not uploaed), 0 if upload was successful.
1098+ uploaded=$check_paste
1099+ if [ $uploaded -eq 1 ]
1100+ then
1101+ # Check size of report file, must be less than 19.5kB
1102+ report_size=$( wc -c $report | awk ' {print $1}' )
1103+ if [ $report_size -ge 19500 ]
1104+ then
1105+ echo -e " '$sname .txt' is larger than 19.5kB. ($report_size bytes)"
1106+ nl
1107+ echo -e " If you want to attach to a post on Ubuntu Forums as an attachment, "
1108+ echo -e " you will need to compress the report."
1109+ nl
1110+ # Prompt User
1111+ ans=
1112+ while [ " $ans " != " y" ] && [ " $ans " != " Y" ] && [ " $ans " != " n" ] && [ " $ans " != " N" ]
1113+ do
1114+ read -erp " Would you like to archive the report? <y/N> " ans
1115+ ans=" ${ans,} "
1116+ debug " User answered $ans " 1
1117+ if [[ $ans =~ ^[Yy]$ ]]
1118+ then
1119+ echo -e " Compressing '$sname .txt' to archive file '$HOME /$sname .tar.gz'."
1120+ nl
1121+ # Remove old archive file, if present
1122+ if [ -f $HOME /$sname .tar.gz ]
1123+ then
1124+ rm -f $HOME /$sname .tar.gz
1125+ fi
1126+ cwd=$( pwd) # Save current directory
1127+ cd $HOME
1128+ # Create Archive without any parent direcetories
1129+ tar -czvf $sname .tar.gz $sname .txt
1130+ exit_code=$?
1131+ # Check if archive was created successfully (catch exit code)
1132+ if [ $exit_code -eq 0 ]
1133+ then
1134+ echo -e " Archive file can be found at '$HOME /$sname .tar.gz'."
1135+ nl
1136+ Pause
1137+ else
1138+ echo -e " $sname .txt was not compressed. Archive file not created."
1139+ nl
1140+ Pause
1141+ exit 1
1142+ fi
1143+ cd $cwd
1144+ elif [[ ${ans,} =~ ^[Nn]$ ]]
1145+ then
1146+ if [ $verbosity -eq 5 ]
1147+ then
1148+ debug " Continuing without creating archive file..."
1149+ Sleep 1
1150+ fi
1151+ fi
1152+ done
1153+ else
1154+ echo " Report 'size' check complete. ($report_size bytes)"
1155+ nl
1156+ sleep 1
1157+ fi
1158+ fi
1159+ }
1160+
10591161function Writer
10601162{
10611163 # Report template. Called twice by Main().
@@ -1331,6 +1433,7 @@ Writer | sed 's/<filter>/[REMOVED]/g' > "$report" # Writing to file
13311433echo " The result is stored in '$report '"
13321434# # Optional upload to pastebin paste.ubuntu.com
13331435Paster
1436+ ArchiveReport
13341437exit
13351438
13361439
@@ -1342,5 +1445,7 @@ exit
13421445#
13431446# Recheck all messages and prompts for spelling errors
13441447#
1345- # Add comments as script doucmentation :
1448+ # Add comments as script documentation :
13461449# - Document logic flow
1450+ #
1451+ # Possibly add more for LVM, ZFS, mdadm, and LUKS information(?)
0 commit comments