Skip to content

Commit 87bcfac

Browse files
committed
Changed file permissions.
1 parent c9d47b3 commit 87bcfac

File tree

1 file changed

+111
-36
lines changed

1 file changed

+111
-36
lines changed

system-info

Lines changed: 111 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#### Variables
3434
########################################################################
3535
# Versioning
36-
version="Version: 01.00-01, Script Date: 2021.09.30"
36+
version="Version: 01.00-02, Script Date: 2021.12.04"
3737
#md5_sum=$(md5sum $sname | sed 's/system.*//g' )
3838
arg1=$1
3939
arg2=$2
@@ -54,6 +54,12 @@ less_status="less"
5454
up_status= "true"
5555
# Report timestamp
5656
startt="$(date '+%F %T %Z (%z)')"
57+
# LST Name for package calc
58+
LTS_PKG=""
59+
# variables to keep track of missing programs...
60+
missing_programs=""
61+
check_paster=0
62+
missing_paster_progs=""
5763
# Logger settings
5864
# Change verbosity to show level of warnings. Range: -1 through 5. -1 is show nothing.
5965
verbosity=-1
@@ -204,30 +210,54 @@ function CheckPrerequisites()
204210
do
205211
if [ $(type ${Program} > /dev/null 2>&1 ; echo $?) -ne 0 ]
206212
then
207-
echo -e " --- Some Programs This Script Uses Were Missing --- "
213+
if [[ "$check_prog" == "1" ]]
214+
then
215+
echo -e " --- Some Programs This Script Uses Were Missing --- "
216+
fi
208217
if [[ "$Program" == "mokutil" ]]
209218
then # If not 'Here' condition
210219
# If this missing, it is a variant for UEFI systems only. It does work on 18.04 where it was not default yet, and is
211220
# a useful option to see if there "is" a SecureBoot option in the BIOS, besides just what it is set at. This, during
212221
# tests, is safe to install on Legacy Only BIOS systems and can be used to tell if the BIOS is such.
213-
echo -e "$faintvid \"${Program}\" could not be found. This program is suggested.$resetvid"
222+
echo -e "$faintvid \"${Program}\" Could not be found. This program is suggested.$resetvid"
214223
echo -e "$faintvid If this is older hardware that is 'Legacy Only BIOS', then this can be ignored.$resetvid"
224+
echo -e "$faintvid The report will still run without it. It will just not be able to answer one question. $resetvid"
215225
check_mokutil=0; # Set Flag to false and recheck in GetSb()
216226
check_prog=0;
227+
missing_programs="$missing_programs\n$Program"
217228
debug "'$Program' is not installed" 1
229+
elif [[ "$Program" == "pastebinit" ]] || [[ "$Program" == "wget" ]] || [[ "$Program" == "curl" ]] || [[ "$Program" == "nc" ]]
230+
then
231+
check_prog=0;
232+
check_paster=$($check_paster+1);
233+
missing_paster_progs="$missing_paster_progs$Program, "
234+
missing_programs="$missing_programs\n$Program"
218235
else
219236
echo -e "'$Program' is not installed."
220237
check_prog=0;
238+
missing_programs="$missing_programs\n$Program"
221239
fi
222-
echo -e " -------------------------------- "
223240
fi
224241
done
225-
242+
226243
if [ "$check_prog" == 0 ]
227244
then
245+
echo -e " -------------------------------- "
228246
nl
229-
echo -e "The Script 'system-info' uses some very basic Linux utilities. "
247+
echo -e "The Script 'system-info' uses some very basic Linux utilities. "
230248
echo -e "Some of these utilities were not found."
249+
nl
250+
echo -e "The report will still run without them. It will just not answer related questions."
251+
echo -e "Some of that information may be related to the diagnosis of your installed system."
252+
echo -e "If missing utilities may have answered your specified problem, you may "
253+
echo -e "be asked by a 'Ubuntu Forums Member' supporting you if a program was missing, and "
254+
echo -e "if you could install it to answer that related question."
255+
nl
256+
CheckPaster
257+
echo -e "Some of these utilities are not default installed utilities to all Editions, "
258+
echo -e "versions, and flavors of Ubuntu... So may be considered as optional. "
259+
nl
260+
231261
ans=
232262
while [ "$ans" != "e" ] && [ "$ans" != "c" ]
233263
do
@@ -250,6 +280,37 @@ function CheckPrerequisites()
250280
fi
251281
}
252282

283+
function CheckPaster() {
284+
if [ $check_paster -eq 4 ]
285+
then
286+
echo -e "Programs 'pastebinit', 'curl', 'wget', and 'nc' are missing. "
287+
echo -e "All 4 utilities used to upload this report to a PasteBin are missing."
288+
echo -e "The report will still run. If not installed, you would just need to "
289+
echo -e "paste the report into a post, contained within 'CODE' Tags."
290+
nl
291+
fi
292+
if [ $check_paster -le 3 -a $check_paster -ge 1 ]
293+
then
294+
echo -e "Program(s) $missing_paster_progs is/are missing, "
295+
echo -e "but can be ignored as there still are installed utilities present to "
296+
echo -e "to be able to upload the report to an online PasteBin."
297+
nl
298+
fi
299+
}
300+
301+
function ProcessMissingPrograms() {
302+
echo -e "---- Required Programs For Report."
303+
if [[ "$missing_programs" == "" ]]
304+
then
305+
echo -e " All required programs installed for report. "
306+
nl
307+
else
308+
echo -e " --- Some Programs This Script Uses Were Missing --- "
309+
echo -e "$missing_programs" | awk 'NF && !/^(start|#)/ {print " " $0}'
310+
nl
311+
fi
312+
}
313+
253314
function RmOldReport()
254315
{
255316
# Removes the old report. Called once by Main().
@@ -485,9 +546,9 @@ function GetPingStatus()
485546
function GetIP()
486547
{
487548
# Get IP related information. Called once by GetNetworkingInfo().
488-
echo -e "${setansi}---------- IP Adress Information:$ransi"
489-
echo -e " --- IP Adress Information from 'ip addr' --- "
490-
# Grab IP adress information
549+
echo -e "${setansi}---------- IP Address Information:$ransi"
550+
echo -e " --- IP Address Information from 'ip addr' --- "
551+
# Grab IP address information
491552
if [ "$less_status" == "less" ]
492553
then
493554
ip_addr=$(ip addr | grep -e '^[[:space:][1-9]:' -e 'inet.')
@@ -588,7 +649,7 @@ function GetGraphicsEnv()
588649
echo -e "$lshw_data"
589650
fi
590651
nl
591-
echo -e " --- Graphics Environment Continued form 'various graphics ENVs' ----"
652+
echo -e " --- Graphics Environment Continued from 'various graphics ENVs' ----"
592653
if [ $XDG_CURRENT_DESKTOP ]
593654
then
594655
echo -e "The Current Configured Destop is: $XDG_CURRENT_DESKTOP "
@@ -597,7 +658,10 @@ function GetGraphicsEnv()
597658
fi
598659
if [ $DESKTOP_SESSION ]
599660
then
600-
echo -e "The Current Desktop Session is: $DESKTOP_SESSION "
661+
echo -e "The Current Desktop Session is: $DESKTOP_SESSION "
662+
xmode=$(xrandr -q | egrep --color=never -e 'Screen' -e 'connected primary')
663+
echo -e "The Current X Desktop Information Details from 'xrandr' are: "
664+
echo -e "$xmode"
601665
else
602666
echo -e "The Current Desktop Session is: <Not Populated> "
603667
fi
@@ -666,26 +730,6 @@ function GetRepositories()
666730
fi
667731
}
668732

669-
function GetRepositoriesOld()
670-
{
671-
# Gets Repository Informations. Called once by Writer().
672-
echo -e "${setansi}---------- Repository Information from '/etc/apt/sources.list':$ransi"
673-
nl
674-
sources=$(grep -v '#' /etc/apt/sources.list | sed -e /^$/d )
675-
# sourcesd=$(grep -v '#' /etc/apt/sources.list.d/* | sed -e /^$/d)
676-
echo -e "Sources List:"
677-
echo -e "$sources"
678-
nl
679-
if [ $(find /etc/apt/sources.list.d/ -type f 2> /dev/null | wc -l) -ne 0 ]
680-
then # prevent showing files that have commented out lines / empty
681-
sourcesd=$(grep -v '#' /etc/apt/sources.list.d/* | sed -e /^$/d \
682-
| sed 's/:deb/:\n deb/')
683-
echo -e "Sources List from SourcesD:"
684-
echo -e "$sourcesd"
685-
nl
686-
fi
687-
}
688-
689733
function GetOtherDetails()
690734
{
691735
# Gets Other General Details. Gets called once by Writer().
@@ -696,6 +740,7 @@ function GetOtherDetails()
696740
GetInstallMedia
697741
GetDistUpgradeDate
698742
nl
743+
GetHweRange
699744
GetHweKernels
700745
CheckHwe
701746
CheckIfCertifiedHardwarePlatform
@@ -764,10 +809,36 @@ function GetDistUpgradeDate()
764809
fi
765810
}
766811

812+
function GetHweRange() {
813+
# Valid current choices for Release numbers LTS are: 18.04, 20.04
814+
LSB_Rel=$(lsb_release -sr | cut -c 1-5)
815+
case "$LSB_Rel" in
816+
("18.04")
817+
LTS_PKG="18.04"
818+
;;
819+
("20.04")
820+
LTS_PKG="20.04"
821+
;;
822+
("21.04")
823+
LTS_PKG="20.04"
824+
;;
825+
("21.10")
826+
LTS_PKG="20.04"
827+
;;
828+
("22.04")
829+
LTS_PKG="22.04"
830+
(*)
831+
echo -e "Something went wrong. Error out of range."
832+
exit 1
833+
esac
834+
835+
}
836+
767837
function GetHweKernels()
768838
{
769839
echo -e "These are the current kernel ranges for HWE kernels for this release."
770-
show_kernels=$(apt-cache show linux-generic-hwe-$(lsb_release -sr) 2> /dev/null \
840+
841+
show_kernels=$(apt-cache show linux-generic-hwe-$LTS_PKG 2> /dev/null \
771842
| awk '/Depends:/ {print "For HWE Package: " $2 ", Kernel Version: " $4}' \
772843
| sed -e 's/..$//' -e 's/~.*//') 2> /dev/null
773844
echo -e " --- HWE Kernel Reference from 'apt-cache show':"
@@ -777,15 +848,15 @@ function GetHweKernels()
777848

778849
function CheckHwe()
779850
{
780-
return_status=$(dpkg -s linux-generic-hwe-$(lsb_release -sr) 2>&1 \
851+
return_status=$(dpkg -s linux-generic-hwe-$LTS_PKG 2>&1 \
781852
| grep 'Status\|dpkg-query' )
782853
echo -e " --- HWE Package Status from 'dpkg':"
783854
if [[ "$return_status" == *"Status:"* ]]
784855
then
785-
echo -e "Package linux-generic-hwe-$(lsb_release -sr) is installed."
856+
echo -e "Package linux-generic-hwe-$LTS_PKG is installed."
786857
elif [[ "$return_status" == *"is not installed"* ]]
787858
then
788-
echo -e "HWE package linux-generic-hwe-$(lsb_release -sr) was not detected. Please check "
859+
echo -e "HWE package linux-generic-hwe-$LTS_PKG was not detected. Please check "
789860
echo -e "kernel version to verify range"
790861
fi
791862
nl
@@ -889,6 +960,10 @@ function Writer
889960
GetGraphicsEnv
890961
GetRepositories
891962
GetOtherDetails
963+
if [[ "$less_status" != "less" ]]
964+
then
965+
ProcessMissingPrograms
966+
fi
892967
ReportFooter
893968
}
894969

@@ -1147,7 +1222,7 @@ Writer | sed 's/<filter>/[REMOVED]/g' > "$report" # Writing to file
11471222
echo "The result is stored in '$report'"
11481223
## Optional upload to pastebin paste.ubuntu.com
11491224
Paster
1150-
1225+
exit
11511226

11521227

11531228

0 commit comments

Comments
 (0)