-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsolver
More file actions
executable file
·886 lines (731 loc) · 19.5 KB
/
solver
File metadata and controls
executable file
·886 lines (731 loc) · 19.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
#!/bin/bash
declare -a blacklist
declare -a report
declare -a drivers
pkgm=''
distro=''
ver='0.1'
LANGUAGE_PREV=$LANGUAGE
LANGUAGE=en_US.UTF-8
LANG=$LANG
LANG=en_US.UTF-8
#
### Solvers
#
touchpad_force_reload ()
{
declare -a local posibilidades
declare -a local drivers
explode 'touch|mouse|vsxx|cyapa' '|' posibilidades
[[ ${#posibilidades} -eq 0 ]] && { echo 'Touchpad: no se encontró driver'; return; }
for posibilidad in "${posibilidades[@]}"; do
local driver=$(lsmod | awk '{print $1 " "}' | grep -i "$posibilidad")
if [[ ! -z "$driver" ]]; then
msg "Reloading driver $driver,..."
sudo modprobe -r $driver && sleep 1 && sudo modprobe $driver
break
fi
done
}
touchpad () {
# Parsear xinput buscando "Touchpad"
if [[ -z $(cat /proc/bus/input/devices | egrep -i 'Touchpad|Synaptics') ]]; then
msg "Touchad undetected - driver?"
return
fi
shopt -s nocasematch
case $XDG_CURRENT_DESKTOP in
*gnome*) # probar
enabled=$(gsettings get org.gnome.desktop.peripherals.touchpad send-events)
if [[ $enabled == "false" ]]; then
msg "Enabling Touchpad (..)"
gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled
fi
;;
*cinnamon*)
enabled=$(gsettings get org.cinnamon.settings-daemon.peripherals.touchpad touchpad-enabled)
if [[ $enabled == "false" ]]; then
msg "Enabling Touchpad (..)"
gsettings set org.cinnamon.settings-daemon.peripherals.touchpad touchpad-enabled true
fi
;;
*) # otros escritorios
if [[ ! -z `which xinput 2>/dev/null` ]]; then
local id=$(xinput list | egrep -i 'Touchpad|Synaptics' | awk '{ print $6 }' | cut -c4-6)
local enabled=$(xinput list-props $id | grep Device\ Enabled | awk '{print $4}')
if [[ $enabled -eq 0 ]]; then
msg "Trying to enable Touchpad (..)"
xinput enable "$id"
xinput set-prop "$id" "Device Enabled" 1
fi
# Vuelvo a chequear ...
enabled=$(xinput list-props $id | grep Device\ Enabled | awk '{print $4}')
if [[ $enabled -eq 0 ]]; then
msg "Touchpad deshabilitado - sin solucionar"
fi
fi
if [[ ! -z `which TouchpadOff 2>/dev/null` ]]; then
synclient TouchpadOff=0
fi
;;
esac
shopt -u nocasematch
[[ $force -eq 1 ]] && touchpad_force_reload
# Parsear la linea GRUB_CMDLINE_LINUX_DEFAULT de /etc/default/grub en búsqueda de acpi=off por ejemplo
(grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub | egrep '(acpi=off|acpi_os=!)') >/dev/null 2>&1
[[ $? -eq 0 ]] && msg "ACPI is disabled: $(grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub)"
}
# -- OK
bluetooth () {
# bloqueado ? desbloquear
rf bluetooth
}
# --OK
sound () {
get_pci_driver 'audio'
blacklist_check
# muted?
muted=$(pacmd list-sinks | awk '/muted/ { print $2 }')
if [[ $muted == 'yes' ]]; then
msg "Audio: there is a 'muted' sound device, solving now (..)"
amixer -c 0 set Master playback 100% unmute >/dev/null 2>&1
sleep 1
amixer sset Master unmute >/dev/null 2>&1
amixer sset Speaker unmute >/dev/null 2>&1
amixer sset Headphone unmute >/dev/null 2>&1
muted=$(pacmd list-sinks | awk '/muted/ { print $2 }')
[[ $muted == 'no' ]] && msg "Audio: dispositivo de audio pudo ser 'unmuted' -OK"
else
msg "No 'muted' devices -OK" "v"
fi
# aplicar algo de esto?
# https://askubuntu.com/questions/1029502/no-audio-on-ubuntu-18-04
# https://help.ubuntu.com/community/SoundTroubleshootingProcedure
# https://zillowtech.com/ubuntu-no-sound.html
}
# -- OK
performance () {
local mem_ava=$(cat /proc/meminfo | grep MemAvailable | awk '{print $2}')
local free_space_root=$(df -h | awk '
$6=="/" {
print $4
}
')
local free_space_root_h=$free_space_root
free_space_root=${free_space_root/K/000}
free_space_root=${free_space_root/M/000000}
free_space_root=${free_space_root/G/000000000}
free_space_root=${free_space_root/T/000000000000}
# menos de 4Gb libres en /
if [[ $free_space_root -le 4000000000 ]]; then
free_space_root_h=${free_space_root_h/}
msg "Poco espacio ($free_space_root_h) in root partition"
else
msg "$free_space_root_h free in root partition" "v"
fi
# Menos de 150Kb libres de RAM
if [[ $mem_ava -le 150000 ]]; then
msg "Insufficient available memory ($mem_ava kb)"
else
msg "$mem_ava kb of RAM available" "v"
fi
}
dns_check () {
declare -a local dns
local dnss_str
if [[ $(systemctl is-enabled network-manager) == 'enabled' ]]; then
dnss_str=$(nmcli dev show | grep DNS | awk '{print $2}')
else
dnss_str=$(grep nameserver /etc/resolv.conf | awk '{print $2}')
fi
if [[ -z "$dnss_str" ]]; then
msg "No DNS servers found"
return 1
else
explode "$dnss_str" $'\n' dnss
fi
return 0
}
dns_ping () {
if [[ $dns_tested == "false" ]]; then # testeo el DNS Server una sola vez
for dns in "${dnss[@]}"; do
if [[ $(ping -c5 $dns | grep -o '[1-5] received' | cut -d' ' -f1) -eq 0 ]]; then
msg " No connection to the DNS server $dns"
else
msg " Successful connection to the DNS server $dns -OK"
dns_tested=true
break
fi
done
dns_tested=true
fi
}
# Detectar errores de Ethernet
ethernet ()
{
get_pci_driver 'ethernet'
blacklist_check
interfaces=$(ls /sys/class/net | grep '^e.*')
local downs=0
for interface in $interfaces; do
if [[ -z $(sudo ip address show $interface | grep "UP>") ]]; then
msg "Interface $interface is down, turning on (..)"
(( downs++ ))
sudo ip link set "$interface" up 2>/dev/null
[[ $? -ne 0 ]] && msg "Interface $interface could not be initialized"
fi
done
if [[ $downs -gt 0 ]]; then
if [[ ! -z $(systemctl list-unit-files | grep network-manager | grep enabled) ]]; then
msg " Restarting NetworkManager (..)"
sudo service network-manager restart
sleep 10
fi
fi
#si tiene conexion al medio (cable) hacer:
for interface in $interfaces; do
errora=0
msg "* Intefaz $interface\n"
if [[ $(sudo ip address show $interface | grep "LOWER_UP>") ]]; then
# Tiene IP
[[ -z $(ip address show $interface | grep "inet " | awk '{print $2}') ]] && msg " IP address not found for the interface: $interface" && (( errora++ ))
# IP/CIDR
maskara=$(ip address show $interface | grep "inet " | awk '{print $2}') # Obtiene IP/CIDR
maskara=${maskara:(-2)} # Corta el string, dejando los dós digitos de la derecha
[[ maskara -eq 0 ]] && { msg " Subnet mask not found for the interface: $interface" && (( errora++ )); }
# Gateway
gateway=$(ip route show |grep default | awk '{print $3}' | cut -d$'\n' -f1)
[[ -z $gateway ]] && { msg " Gateway not found for the interface: $interface"; return; }
# DNS
dns_check
# si errora es igual a 0 hace ping contra el router
if [[ $errora -eq 0 ]]; then
msg " Testing $interface connection, please wait..."
# Ping Gateway
myping=$(ping -c3 $gateway | grep "packets transmitted" | awk '{print $4}')
[[ myping -eq 0 ]] && msg " No connection with the router" || msg " Connection to gw $gateway successful -OK"
# Ping DNS
dns_ping
fi
else
msg " Cable disconnected on interface: $interface"
fi
done
}
#
#
# Tanto para WiFi como Ethernet es posible obtener
#
# driverversion y firmware
#
# sudo lshw -C network
#
# Detectar errores de wifi
#
# TODO:
# https://ubuntuforums.org/showthread.php?t=2239747
#
#
wireless ()
{
# PCI
get_pci_driver 'wireless'
blacklist_check
# USB
get_usb_driver "wireless adapter"
# No hay driver en uso?
if [[ ! -z "$hardware" ]]; then
if [[ -z "$driver_en_uso" ]]; then
msg "Wireless USB: no driver for $hardware"
else
msg "Driver '$driver_en_uso' in use for '$hardware' -OK" "v"
fi
else
msg "Hardware for USB adapter not detected" "v"
fi
# bloqueado ? desbloquear
rf wlan
# verifico interfaces
local interfaces=$(cat /proc/net/dev | grep -o w[a-z0-9]*: | cut -d':' -f1)
local interfaces_up=$(cat /proc/net/wireless | awk '/:/ {print $1}' | cut -d':' -f1)
[[ "${#interfaces[@]}" -eq 0 ]] && msg "No wireless network interfaces found"
local downs=0
local fails=0
for interface in $interfaces; do
msg "* Interface $interface\n"
in_array $interface interfaces_up
if [[ $? -ne 0 ]]; then
msg " Interface $interface is down, turning on (..)"
(( downs++ ))
sudo ip link set "$interface" up 2>/dev/null
[[ $? -ne 0 ]] && { ((fails++)) && msg " Interface $interface could not be initialized"; }
fi
done
[[ "${#interfaces[@]}" -eq $fails ]] && return
if [[ $downs -gt 0 ]]; then
if [[ ! -z $(systemctl list-unit-files | grep network-manager | grep enable ) ]]; then
msg " Rebooting NetworkManager (..)"
sudo service network-manager restart
sleep 10
fi
fi
#si tiene conexion al medio (aire) hacer:
dns_tested=false
for interface in $interfaces; do
errora=0
if [[ $(sudo ip address show $interface | grep "LOWER_UP>") ]]; then
# Tiene IP
[[ -z $(ip address show $interface | grep "inet " | awk '{print $2}') ]] && msg " No IP address found for the interface: $interface" && (( errora++ ))
# IP/CIDR
maskara=$(ip address show $interface | grep "inet " | awk '{print $2}') # Get IP/CIDR
maskara=${maskara:(-2)} # Truncate the string, leaving the last two digits
[[ maskara -eq 0 ]] && { msg " No subnet mask found for the interface: $interface" && (( errora++ )); }
# Gateway
gateway=$(ip route show |grep default | awk '{print $3}' | cut -d$'\n' -f1)
[[ -z $gateway ]] && { msg " No gateway found for the interface: $interface"; return; }
# DNS
dns_check
# si errora es igual a 0 hace ping contra router y DNS
if [[ $errora -eq 0 ]]; then
msg " Testing connection of $interface, please wait..."
# Ping Gateway
myping=$(ping -c3 $gateway | grep "packets transmitted" | awk '{print $4}')
[[ $myping -eq 0 ]] && msg " No connection with gw $gateway" || msg " Successful connection with gw $gateway -OK"
# Ping DNS
dns_ping
fi
else
msg " No WiFi connection on: $interface"
fi
done
}
video ()
{
local posibilidades=(vga 3d 2d display)
local p
declare -a local prev
for p in "${posibilidades[@]}"; do
get_pci_driver $p
local d=$(echo "$drivers_str" | tr ' ' '-')
in_array "$d" prev
if [[ $? -ne 0 ]]; then
blacklist_check
push "$d" prev
fi
done
}
#
## Utils
#
get_pci_driver ()
{
local search="$1"
local addr=$(lspci | grep -i "$search" | grep -o '[0-9]\{2\}:[0-9a-f]\{2\}.[0-9a-f]')
[[ -z $addr ]] && return
local reg=$(lspci -vs "$addr")
hardware=$(echo "$reg" | grep -i 'Subsystem' | cut -d':' -f2 | cut -c2-)
drivers_str=$(echo "$reg" | grep -i 'Kernel modules:' | cut -d: -f2 | cut -c2-)
driver_en_uso=$(echo "$reg" | grep 'in use:' | cut -d: -f2 | cut -c2-)
explode drivers_str ',' drivers
}
get_usb_driver ()
{
local search="$1"
local id=$((lsusb | grep -i "$search" 2>/dev/null) | grep -o '[0-9a-f]\{4\}:[0-9a-f]\{4\}')
local reg=$(sudo lsusb -vd "$id" 2>/dev/null)
local id_vendor=$(echo "$reg" | grep idVendor | awk '{print $2}' | cut -dx -f2)
local id_product=$(echo "$reg" | grep idProduct | awk '{print $2}' | cut -dx -f2)
hardware=$(echo "$reg" | grep iProduct | awk '{print $3}')
driver_en_uso=$(usb-devices | grep -A5 "Vendor=$id_vendor ProdID=$id_product" | grep -o Driver=[a-z0-9\-]* | cut -d= -f2)
drivers=()
}
#
# @param string archivo
# @param string separador
# @param array array_name
#
get_registers ()
{
local file=$(cat "$1")
local sep="$2"
local arrname="$3"
local str
local f2
f2=$(echo "${file//$sep/|$'\n'}")
set +f;
IFS='|'
set -- $f2
set -f;
unset IFS
str="$arrname"
str+='=("$@")'
eval "$str"
}
rf () {
# bluetooth|wlan
type=$1
[[ $type == "wlan" ]] && pattern='phy'
[[ $type == "bluetooth" ]] && pattern='hci'
declare -a soft_lock
declare -a hard_lock
IFS=$'\n';
set -- $(rfkill list);
argv=($@)
for ((i=0;i<$#;i++)); do
if [[ "${argv[i]}" =~ "$pattern" ]]; then
device=$(echo "${argv[i]}" | egrep -o "$pattern[0-9]*")
id=$(echo "${argv[i]}" | egrep -o '^[0-9]*')
has_soft_lock=$(echo "${argv[i+1]}" | grep -o 'yes')
has_hard_lock=$(echo "${argv[i+2]}" | grep -o 'yes')
[[ ! -z $has_soft_lock ]] && soft_lock=("${soft_lock[@]}" "$id")
[[ ! -z $has_hard_lock ]] && hard_lock=("${hard_lock[@]}" "$id")
if [[ ! -z $has_soft_lock ]]; then
if [[ -z $has_hard_lock ]]; then
msg "A $type device (id=$id) blocked by software, unlocking (..)"
rfkill unblock $id 2>/dev/null
sleep 1
if [[ ! -z $(rfkill list | grep -A 2 "$device" | grep -i 'Soft blocked: no') ]]; then
msg "Device $type unlocked -OK"
else
msg "Device $type could not be unlocked"
fi
else
msg "A $type device (id=$id) blocked by hard"
fi
fi
fi
i=$i+2
done
[[ "${soft_lock[@]}" -eq 0 ]] && [[ "${hard_lock[@]}" -eq 0 ]] && msg "No hay dispositivos $type bloqueados" "v"
}
print_r () {
for i in "$@"; do
echo '----------------------'
echo -e "$i"
done
}
#
# Busca un elemento en un arreglo
#
# @param string elemento_a_buscar
# @param string array_name
# @return integer 0/1 según sea éxito o fracaso
#
in_array () {
[[ $# -lt 2 ]] && return 1
local elem=$1
local arr_name=$2
local _arr
local x
str='_arr="${'
str+=$arr_name
str+='[@]}"'
eval $str
for x in $_arr; do
[ "${x}" == "$elem" ] && return 0
done
return 1
}
#
# Empuja un elemento a un array
#
# @param string elemento
# @param string nombre_array
#
push () {
(( $# != 2 )) && return 1
local arr_name=$2
local str
# array=("${array[@]}" "$2")
str=$arr_name
str+='=("${'
str+=$arr_name
str+='[@]}" "$1")'
eval $str
}
#
# Hace un 'split' de un string generando un array (simil explode de php)
#
# @param string string_to_explode
# @param string separator
# @param array
#
explode () {
local strvar="$1"
local sep="$2"
local arrname=$3
set -f
case $2 in
ENTER)
IFS=$'\n'
;;
TAB)
IFS=$'\t'
;;
*)
IFS=$2
;;
esac
set -- $strvar
set +f; unset IFS
str=$arrname
str+='=("$@")'
eval "$str"
}
msg () {
if [[ "$2" != "v" ]] || [[ "$2" == "v" && $verbose -eq 1 ]]; then
push "$1" report
echo -e "$1"
fi
}
# Sistema de paquetes utilizado, distribución, etc
describe () {
if [[ ! -z $(which apt 2>/dev/null) ]]; then
pkgm='apt'
else
if [[ ! -z $(which dnf 2>/dev/null) ]]; then
pkgm='dnf'
else
if [[ ! -z $(which pacman 2>/dev/null) ]]; then
pkgm='pacman'
else
if [[ ! -z $(which emerge 2>/dev/null) ]]; then
pkgm='emerge'
fi
fi
fi
fi
distro=`((cat /etc/*-release 2>/dev/null)| egrep '^ID=' | cut -c4-)`
}
# Drivers en lista negra
blacklist () {
blacklist=$(cat /etc/modprobe.d/*blacklist* 2>/dev/null | egrep '^blacklist ' | cut -d' ' -f2)
}
blacklist_check ()
{
echo -e "\n* $hardware\n"
if [[ ${#drivers} -eq 0 ]]; then
msg " No drivers found for $hardware"
else
msg " Installed drivers: $drivers_str para '$hardware'"
fi
# No hay driver en uso?
if [[ -z "$driver_en_uso" ]]; then
msg " No active driver"
if [[ ${#drivers} -ne 0 ]]; then
msg " Loading driver ${drivers[0]} (..)"
sudo modprobe ${drivers[0]}
fi
else
msg " Driver in use: $driver_en_uso' -OK"
fi
# Verifico que ningún driver esté blacklisted
declare -a local blk
for driver in "${drivers[@]}"; do
in_array "$driver" blacklist
[[ $? -eq 0 ]] && { blacklisted=1; push "$driver" blk; }
done
if [[ $blacklisted -eq 0 ]]; then
msg " No drivers in blacklist -OK"
else
local lista
[[ ${#blk[@]} -ne 0 ]] && lista="${blk[@]}" || lista='--'
msg " Blacklisted: $lista"
fi
echo
}
key () {
echo -e "\nPress Enter to continue..."
read tecla
}
# MENU
menu () {
while :
do
clear
echo "Choose an option"
echo "==================="
echo "1. Check performance issues"
echo "2. Check video"
echo "3. Check touchpad"
echo "4. Ethernet issues"
echo "5. WiFi issues"
echo "6. Bluetooth issues"
echo "7. Sound issues"
echo "8. Exit the program"
echo -en "\nSelect an option [1 - 8] "
read opcion
echo
case $opcion in
1) performance
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
key;;
2) video
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
key;;
3) touchpad
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
key;;
4) sudo true; ethernet
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
key;;
5) sudo true; wireless
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
key;;
6) bluetooth
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
key;;
7) sound
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
key;;
8) exit 0
key;;
*) echo "'$opcion' option is invalid."
key;;
esac
unset report[@] # Reinicia variable
done
}
options ()
{
help=$(cat <<-TEXT
LINUX SOLVER ver ${ver}
Usage:
$(basename $0) [-v] [-f] <options>
Display and try to solve hardware configuration issues
Options:
-v, --verbose show detailed information
-f, --force force to solve when it's possible
-i, --interactive interactive mode (menu)
-a, --all run all tests
-b, --bluetooth bluetooth checking
-d, --display video cards
-t, --touchpad touchpad checking
-w, --wireless wifi tests
-e, --ethernet ethernet tests
-p, --performance check why computer can be running slow
-s, --sound sound tests
-c, --credits authors
-h, --help display this help
-V, --version display version
TEXT
)
credits=$(cat <<-TEXT
Credits:
Pablo Bozzolo <boctulus>
Leonardo D'Ulivo <ldulivo>
https://github.com/boctulus/linuxsolver
TEXT
)
verbose=
case "$1" in
-v|--verbose)
verbose=1
shift 1
;;
esac
force=
case "$1" in
-f|--force)
force=1
shift 1
;;
esac
sel=$1
case $sel in
-V|--version)
echo "$(basename $0) version $ver"
return
;;
-h|--help)
echo -e "$help"
return
;;
-c|--credits)
echo -e "$credits"
return
;;
-i|--interactive)
menu
;;
-a|-all)
sudo true
echo -e '\n---| Performance\n'
unset report[@]
performance
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
sleep 1
echo -e '\n---| Display\n'
unset report[@]
video
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
sleep 1
echo -e '\n---| Sound\n'
unset report[@]
sound
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
sleep 1
echo -e '\n---| Bluetooth\n'
unset report[@]
bluetooth
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
sleep 1
echo -e '\n---| Touchpad\n'
unset report[@]
touchpad
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
sleep 1
echo -e '\n---| Ethernet\n'
unset report[@]
ethernet
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
sleep 1
echo -e '\n---| Wireless\n'
unset report[@]
wireless
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
sleep 1
;;
-p|--performance)
performance
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
;;
-d|--display)
video
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
;;
-s|--sound)
sound
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
;;
-b|--bluetooth)
bluetooth
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
;;
-t|--touchpad)
touchpad
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
;;
-e|--ethernet)
sudo true
ethernet
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
;;
-w|wireless)
sudo true
wireless
[[ "${#report[@]}" -eq 0 ]] && echo 'OK.'
;;
*)
if [[ $# -eq 0 ]]; then
echo -e "$help"
else
echo -e "$(basename $0): unrecognized option '$sel'\nTry '$(basename $0) --help' for more information";
fi
return
;;
esac
}
describe ; [[ -z $pkgm ]] && msg "Unknown package management"
blacklist
options $@