~mmach/netext73/trunk

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
#!/bin/bash
## Graficzny instalator kerneli e X t 7 3  - NeteXt'73
## przygotowanie kerneli e X t 7 3 - ext73@wp.pl
## przygotowanie skryptów optymalizacyjnych e X t 7 3
## autor skryptu NeteXt'73 - NetBit73 - netbit73@gmail.com
## Licencja: GPL v3: https://www.gnu.org/licenses/gpl.txt
#########################################################################################################################################################################
#procedury

source /opt/NeteXt73/procedury


#########################################################################################################################################################################
#Skrypty

cd /tmp/netext73
#testy
if [ "$1" = "testy" ]; then
	menu="BurnTest!$MENU_SYSBENCH_PROCESOR!$MENU_SYSBENCH_PAMIEC!$MENU_SYSBENCH_PROCESOR_TABELA!$MENU_SYSBENCH_PAMIEC_TABELA!$MENU_HDD!Rootkit Hunter!"spectre-meltdown-checker""  #$MENU15!$MENU16" - wyłączone testy glmark2
	ikonka="/opt/NeteXt73/ikony/testy.png"

#inne skrypty
else
	if [ -e ~/.config/akonadi/akonadiserverrc ]; then
		if [ "$(grep 'StartServer=true' ~/.config/akonadi/akonadiserverrc)" != "" ];then
			MENU19="$MENU19a"
		else
			MENU19="$MENU20a"
		fi
	else
		MENU19=""
	fi
	if [ "$(cat /etc/sysctl.conf | grep 'net.ipv6.conf.all.disable_ipv6 = 1')" = "" ]; then
		menu="$MENU3!$MENU5!$MENU6!$MENU7!$MENU14!$MENU17!$MENU18!$MENU19"
	else
		menu="$MENU3!$MENU5!$MENU6!$MENU8!$MENU14!$MENU17!$MENU18!$MENU19"
	fi
	if [ "$MENU19" = "" ]; then
		menu=$(echo $menu | sed -e '$s/\!$//g')
	fi
	ikonka="/opt/NeteXt73/ikony/skrypty.png"
fi

skrypt=$(yad --center --title="$nazwa_skryptu" --window-icon=$ikonka --image=$ikonka --form --field="$TEXT_DEINSTALATOR1:CB" "$menu" --button="gtk-ok:0" --button="$TEXT_POWROT:1"  )
klawisz=$?; skrypt=$(echo $skrypt | cut -d "|" -f 1)
if [ $klawisz = 0 ]; then

	#kasujem dane po konfigach
	if [ "$skrypt" = "$MENU3" ]; then
		if [ "$(dpkg -l | grep '^rc' | awk '{print $2}' | head -n1)" != "" ]; then
			xterm -T "configi" -e bash -c "echo \"$TEXT_INSTALACJA1\"; sudo dpkg -l | grep '^rc' | awk '{print \$2}' | xargs sudo dpkg --purge; echo -e \"$TEXT_INSTALACJA2\" ;read ent"
		else
			yad --center --info --title="$nazwa_skryptu"  --window-icon="/opt/NeteXt73/ikony/info.png" --image="/opt/NeteXt73/ikony/info.png" --button="gtk-ok:0" --text="$TEXT_CONFIG1" 
		fi

	#RAM
	elif [ "$skrypt" = "$MENU14" ]; then
		xterm -T "free mem" -e bash -c "echo -e \"$TEXT_RAM6\n\"; echo \"$TEXT_RAM7\"; free -m; sync; sudo bash -c 'echo 3 > /proc/sys/vm/drop_caches'; echo -e \"\n$TEXT_RAM8\"; free -m; echo -e \"$TEXT_INSTALACJA2\"; read ent"

	#odpalamy tasksel
	elif [ "$skrypt" = "$MENU5" ]; then
		cd /tmp/netext73
		xterm -T "Tasksel" -e bash -c "echo -e \"$TEXT_TASKSEL1\"; sudo tasksel; echo -e \"$TEXT_INSTALACJA2\"; read ent"

	#synchronizuj czas z internetu
	elif [ "$skrypt" = "$MENU6" ]; then
		xterm -T "time" -e bash -c "echo \"$TEXT_INSTALACJA1\"; sudo ntpdate tempus1.gum.gov.pl; echo -e \"$TEXT_INSTALACJA2\" ;read ent"
	#ipv6 off

	elif [ "$skrypt" = "$MENU7" ]; then
		naglowek > instaluj.sh
		ipv6_off >> instaluj.sh
		instalacja

	#ipv6 on
	elif [ "$skrypt" = "$MENU8" ]; then
		naglowek > instaluj.sh
		ipv6_on >> instaluj.sh
		instalacja

	#OPTIMUS FIX
	elif [ "$skrypt" = "$MENU17" ]; then
		cat /opt/NeteXt73/APM/nvidia-optimus-intel-drm-fix.sh > instaluj.sh
		instalacja

	#burntest
	elif [ "$skrypt" = "BurnTest" ]; then
		burntest

	#akonadi on/off
	elif [ "$skrypt" = "$MENU19" ]; then
		if [ "$MENU19" = "$MENU20a" ]; then
			sed -i 's/StartServer=false/StartServer=true/g' ~/.config/akonadi/akonadiserverrc
		elif [ "$MENU19" = "$MENU19a" ]; then
			sed -i 's/StartServer=true/StartServer=false/g' ~/.config/akonadi/akonadiserverrc
		fi

	#sysbench
	elif [ "$(echo $skrypt | grep 'sysbench')" != "" ]; then
		#zmienne
		a0="Doing"
		a1="Number of threads:"
		a2="total time:"
		a3="total number of events:"
		a5="min:"
		a6="avg:"
		a7="max:"
		a8="95th percentile:"
		a9="events (avg/stddev):"
		a10="execution time (avg/stddev):"

		#katalog roboczy skryptu
		cd /var/log/netext73/sysbench
		#procedury

		info_test(){
			#yad --center --info --title="$nazwa_skryptu"  --window-icon="/opt/NeteXt73/ikony/info.png" --image="/opt/NeteXt73/ikony/info.png" --button="gtk-ok:0" --text="$TEXT_SYSBENCH_PROGRESS" --timeout=$1
			please_wait
		}

		zrob_test(){
			DATE=$(date +"%Y-%m-%d@%H:%M")
			if [ "$2" = "cpu" ]; then
			      echo "uname $(uname -r)" > cpu_$(uname -r)_$DATE-sysbench.log
			      sysbench --threads=$1 --test=cpu run >> cpu_$(uname -r)_$DATE-sysbench.log
			      echo "test_time : " $DATE >> cpu_$(uname -r)_$DATE-sysbench.log
			else
			      echo "uname $(uname -r)" > memory_$(uname -r)_$DATE-sysbench.log
			      sysbench --threads=$1 --test=memory run >> memory_$(uname -r)_$DATE-sysbench.log
			      echo "test_time : " $DATE >> memory_$(uname -r)_$DATE-sysbench.log
			fi
			please_wait kill
		}

		wynik_testu(){
			yad --center --title="$nazwa_skryptu" --width=$((610*$skala)) --window-icon="/opt/NeteXt73/ikony/NeteXt73.png" --image="/opt/NeteXt73/ikony/NeteXt73.png" --button="gtk-ok:0" --form \
			--field="uname -r:RO" "$(grep "uname" $1 | cut -d " " -f 2 )" \
			--field="$(grep "$a0" $1 | sed 's/Doing //'):RO" "YES" \
			--field="$a1:RO" "$(grep "$a1" $1 | sed 's/.*: *//')" \
			--field="Test execution summary - $a2:RO" "$(grep "$a2" $1 | sed 's/.*: *//')" \
			--field="Test execution summary - $a3:RO" "$(grep "$a3" $1 | sed 's/.*: *//')" \
			--field="per-request statistics $a5:RO" "$(grep "$a5" $1 | sed 's/.*: *//')" \
			--field="per-request statistics $a6:RO" "$(grep "$a6" $1 | sed 's/.*: *//')" \
			--field="per-request statistics $a7:RO" "$(grep "$a7" $1 | sed 's/.*: *//')" \
			--field="per-request statistics $a8:RO" "$(grep "$a8" $1 | sed 's/.*: *//')" \
			--field="Threads fairness $a9:RO" "$(grep "$a9" $1 | sed 's/.*: *//')" \
			--field="Threads fairness $a10:RO" "$(grep "$a10" $1 | sed 's/.*: *//')" 
		}

		porownanie(){
			rm pliki -f
			IFS=$' \t\n'
			for i in $(ls *sysbench.log | grep $1 ); do
				if [ "$(grep test_time $i)" = "" ]; then
					rm $i
				else
					#walidacja wyników
					if [ "$(grep "uname" $i | cut -d " " -f 2)" != "" ]; then
						grep "uname" $i | cut -d " " -f 2 >> pliki
					else
						echo "-" >> pliki
					fi
					if [ "$(grep "test_time" $i | sed 's/test_time : *//')" != "" ]; then
						grep "test_time" $i | sed 's/test_time : *//' >> pliki
					else
						echo "-" >> pliki
					fi					x
					if [ "$(grep "$a1" $i | sed 's/.*: *//')" != "" ]; then
						grep "$a1" $i | sed 's/.*: *//' >> pliki
					else
						echo "-" >> pliki
					fi					
					if [ "$(grep "$a2" $i | sed 's/.*: *//')" != "" ]; then
						grep "$a2" $i | sed 's/.*: *//' >> pliki
					else
						echo "-" >> pliki
					fi
					if [ "$(grep "$a3" $i | sed 's/.*: *//')" != "" ]; then
						grep "$a3" $i | sed 's/.*: *//' >> pliki
					else
						echo "-" >> pliki
					fi
					if [ "$(grep "$a5" $i | sed 's/.*: *//')" != "" ]; then
						grep "$a5" $i | sed 's/.*: *//' >> pliki
					else
						echo "-" >> pliki
					fi
					if [ "$(grep "$a6" $i | sed 's/.*: *//')" != "" ]; then
						grep "$a6" $i | sed 's/.*: *//' >> pliki
					else
						echo "-" >> pliki
					fi
					if [ "$(grep "$a7" $i | sed 's/.*: *//')" != "" ]; then
						grep "$a7" $i | sed 's/.*: *//' >> pliki
					else
						echo "-" >> pliki
					fi
					if [ "$(grep "$a8" $i | sed 's/.*: *//')" != "" ]; then
						grep "$a8" $i | sed 's/.*: *//' >> pliki
					else
						echo "-" >> pliki
					fi
					if [ "$(grep "$a9" $i | sed 's/.*: *//')" != "" ]; then
						grep "$a9" $i | sed 's/.*: *//' >> pliki
					else
						echo "-" >> pliki
					fi
					if [ "$(grep "$a10" $i | sed 's/.*: *//')" != "" ]; then
						grep "$a10" $i | sed 's/.*: *//' >> pliki
					else
						echo "-" >> pliki
					fi
				fi
			done
			if [ "$1" = "memory" ]; then
				ikona="/opt/NeteXt73/ikony/ram.png"
			else
				ikona="/opt/NeteXt73/ikony/microcode.png"
			fi
			if [ "$2" = "usun" ]; then
				pliczek=$(yad --center --title="$nazwa_skryptu" --text="$skrypt" --width=$((1024*$skala)) --height=$((450*$skala)) --window-icon=$ikona --image=$ikona \
			--column="uname -r" --column="test dates:" --column="$(echo $a1 | sed 's/ of/\nof/')" --column="$a2" --column="$(echo $a3 | sed 's/ of/\nof/')" --column="$a5"  --column="$a6" --column="$a7" --column="$(echo $a8 | sed 's/ 95/\n95/')" --column="$(echo $a9 | sed 's/(/\n(/')" --column="$(echo $a10 | sed 's/(/\n(/')" --list $(cat pliki)  --button="$TEXT_USUN_WYNIK:0" --button="$TEXT_ZAMKNIJ:1")
			else
				pliczek=$(yad --center --title="$nazwa_skryptu" --text="$skrypt" --width=$((1024*$skala)) --height=$((450*$skala)) --window-icon=$ikona --image=$ikona \
			--column="uname -r" --column="test dates:" --column="$(echo $a1 | sed 's/ of/\nof/')" --column="$a2" --column="$(echo $a3 | sed 's/ of/\nof/')" --column="$a5"  --column="$a6" --column="$a7" --column="$(echo $a8 | sed 's/ 95/\n95/')" --column="$(echo $a9 | sed 's/(/\n(/')" --column="$(echo $a10 | sed 's/(/\n(/')" --list $(cat pliki)   --button="$TEXT_ZAMKNIJ:1")
			fi
			klawisz=$?; pliczek=$(echo $pliczek | cut -d "|" -f 2)
			if [ "$klawisz" = "0" ]; then
				rm $(ls | grep $pliczek | grep $1)
			fi
			rm pliki -f
		}

		petla="tak"
		while [ $petla = "tak" ]; do
			if [ "$skrypt" = "$MENU_SYSBENCH_PROCESOR" ]; then
				info_test 5 CPU &
				zrob_test $(grep 'model name' /proc/cpuinfo | wc -l ) cpu
				wynik_testu cpu_$(uname -r)_$DATE-sysbench.log
				porownanie cpu
			elif [ "$skrypt" = "$MENU_SYSBENCH_PAMIEC" ]; then
				info_test 25 MEMORY &
				zrob_test $(grep 'model name' /proc/cpuinfo | wc -l ) memory
				wynik_testu memory_$(uname -r)_$DATE-sysbench.log
				porownanie memory
			elif [ "$skrypt" = "$MENU_SYSBENCH_PROCESOR_TABELA" ]; then
				porownanie cpu usun
			elif [ "$skrypt" = "$MENU_SYSBENCH_PAMIEC_TABELA" ]; then
				porownanie memory usun
			fi
			if [ -z "$pliczek" ]; then
				petla="nie"
			fi
		done

	#glmark
	elif [ "$(echo $skrypt | grep 'glmark')" != "" ]; then
		#katalog roboczy skryptu
		cd /etc/netext73/glmark2

		#procedury
		zrob_test(){
			DATE=$(date +"%Y-%m-%d@%H:%M")
			echo "uname $(uname -r)" > $(uname -r)_$DATE-glmark2.log
			glmark2 >> $(uname -r)_$DATE-glmark2.log
			echo "test_time: " $DATE >> $(uname -r)_$DATE-glmark2.log
		}

		wynik_testu(){
			rm *.txt -f
			cat $1 | tr -d "\015" | grep '\[' | sed 's/FPS:/$/g' | cut -d '$' -f 1 | sed 's/ //g' > kolumna1.txt
			cat $1 | tr -d "\015" | grep '\[' | sed 's/.*FPS://g' | awk '{print $1}' > kolumna2.txt
			cat $1 | tr -d "\015" | grep '\[' | sed 's/.*FrameTime://g' | sed 's/ //g' |awk '{print $1}' > kolumna3.txt
			paste -d " " kolumna1.txt kolumna2.txt kolumna3.txt > kolumny.txt
			wynik="$(grep "glmark2 Score:" $1 | sed "s/glmark2 Score:[[:space:]]*//g" | sed "s/[[:space:]]//g")"
			yad --center --title="$nazwa_skryptu" --text="glmark2 score: $wynik" --width=$((880*$skala)) --height=$((780*$skala)) --window-icon="/opt/NeteXt73/ikony/NeteXt73.png" --image="/opt/NeteXt73/ikony/NeteXt73.png" --button="gtk-ok:0" --list $(cat kolumny.txt) \
			--column="Name" --column="FPS:" --column="FrameTime:"
				rm *.txt -f
		}

		porownanie(){
			petla="tak"
			while [ $petla = "tak" ]; do
				IFS=$' \t\n'
				rm tymczasowy.txt -f
				#walidacja wyników
				for i in $(ls *glmark2.log ); do
					if [ "$(cat $i | tr '\n' ' ' | grep test_time | grep loop | grep function | grep conditionals | grep shadow | grep buffer | grep pulsar | grep effect2d | grep bump | grep shading | grep texture | grep buil)" = "" ]; then 
						rm $i -f
					fi
				done 2>&1 | pobieranie
				for i in $(ls *glmark2.log ); do
					grep "uname" $i | cut -d " " -f 2 >> tymczasowy.txt
					echo -e "\n" >> tymczasowy.txt
					for a in $(echo test_time: GL_VENDOR: GL_RENDERER: GL_VERSION:); do
						grep "$a" $i | sed "s/$a[[:space:]]*//g" | sed 's/^[ \t]*//' | sed 's/ $//' | head -n 1 >> tymczasowy.txt
						echo -e "\n" >> tymczasowy.txt
					done
					grep "glmark2 Score:" $i | sed "s/glmark2 Score:[[:space:]]*//g" | sed "s/[[:space:]]//g" >> tymczasowy.txt
					echo -e "\n" >> tymczasowy.txt
					grep "glmark2" $i  | sed "s/glmark2[[:space:]]*//g" | sed 's/^[ \t]*//' | sed 's/ $//' | head -n 1 >> tymczasowy.txt
					echo -e "\n" >> tymczasowy.txt
				done
				sed -i '/^[ \t]*$/ d' tymczasowy.txt
				IFS=$'\n'
				pliczek=$(yad --center --on-top --title="$nazwa_skryptu" --text="$MENU16" --width=$((1024*$skala)) --height=$((450*$skala)) --window-icon="/opt/NeteXt73/ikony/glmark.png" --image="/opt/NeteXt73/ikony/glmark.png" \
				--column="uname -r" --column="test dates:" --column="GL_VENDOR:" --column="GL_RENDERER:" --column="GL_VERSION:" --column="Total score:" --column="glmark2 version:" --separator=$'\n' --list $(cat tymczasowy.txt) --button="$TEXT_USUN_WYNIK:0"  --button="$TEXT_ZAMKNIJ:1" )
				klawisz=$?; pliczek=$(echo $pliczek | cut -d " " -f 2)
				if [ "$klawisz" = "0" ]; then
					rm $(ls | grep $pliczek)
					rm tymczasowy.txt -f
				else
					petla="nie"
					rm tymczasowy.txt -f
				fi
			done
		}
		if [ "$skrypt" = "$MENU15" ]; then
			zrob_test
			wynik_testu $(uname -r)_$DATE-glmark2.log
			porownanie
		elif [ "$skrypt" = "$MENU16" ]; then
			porownanie
		fi
	#kill process
	elif [ "$skrypt" = "$MENU18" ]; then
		kill_process
	elif [ "$skrypt" = "Rootkit Hunter" ]; then
		naglowek 			
		if [ "$(ls /opt/NeteXt73/pakiety/ | grep rkhunter* | sed 's/.tar.gz//' | cut -d '-' -f 2)" != "$(rkhunter -V | head -n 1 | cut -d ' ' -f 3)" ]; then																		> instaluj.sh
			echo "tar -xvf /opt/NeteXt73/pakiety/$(ls /opt/NeteXt73/pakiety/ | grep rkhunter*) -C /tmp/" 	>> instaluj.sh
			echo "cd /tmp/$(ls /opt/NeteXt73/pakiety/ | grep rkhunter* | sed 's/.tar.gz//')"  				>> instaluj.sh
			echo "sudo ./installer.sh --layout default --install" 											>> instaluj.sh
			echo "cd /tmp/netext73" 																		>> instaluj.sh
			echo "sudo rm -rf /tmp/$(ls /opt/NeteXt73/pakiety/ | grep rkhunter*  | sed 's/.tar.gz//')" 		>> instaluj.sh
		fi
		echo "sudo /usr/local/bin/rkhunter --update" 													>> instaluj.sh
		echo "sudo /usr/local/bin/rkhunter --propupd" 													>> instaluj.sh
		echo "/usr/bin/yes | sudo rkhunter --check" 													>> instaluj.sh
		echo "sudo chmod 644 /var/log/rkhunter.log" 													>> instaluj.sh
		instalacja2 Rkhunter
		if [ -e /var/log/rkhunter.log ]; then
			yad --center --title="$nazwa_skryptu1 - rkhunter.log" --window-icon="/opt/NeteXt73/ikony/logi.png" --on-top --width=$((860*$skala)) --height=$((500*$skala)) --text-info --filename=/var/log/rkhunter.log --button="$TEXT_ZAMKNIJ:1"
		fi
	elif [ "$skrypt" = "spectre-meltdown-checker" ]; then	
		naglowek 																> instaluj.sh
		echo "bash /opt/NeteXt73/pakiety/spectre-meltdown-checker.sh"									>> instaluj.sh
		echo "rm -f spectre-meltdown-checker.sh"								>> instaluj.sh
		instalacja3 spectre-meltdown-checker
	#test HDD/SSD
	elif [ "$skrypt" = "$MENU_HDD" ]; then
		KEY="$(echo $RANDOM)"
		a=1
		klawisz_trim=""
		if [ "$(hdparm -I /dev/sd* | grep 'TRIM supported')" != "" ];then
			klawisz_trim="--button="Trim:4""
		fi
		for i in $(echo $lista_dyskow); do
			#size
			res[$a]=$(mktemp --tmpdir=/tmp/netext73 netext73_$a.XXXXXXXX)
			yad --plug=$KEY --tabnum=$a --list --column="Filesystem" --column="Size" --column="Used" --column="Free" --column="Used%" --column="Mounted on" $(df -h | grep /dev/$i) 1> ${res[$a]} &
			a=$(( $a + 1 ))
			tabulator=$(echo $tabulator --tab="$i")
			#smart info
			res[$a]=$(mktemp --tmpdir=/tmp/netext73 netext73_$a.XXXXXXXX)
			smartctl -i /dev/$i > /tmp/netext73/$i_$a.txt
			smartctl -H /dev/$i >> /tmp/netext73/$i_$a.txt
			smartctl -l error /dev/$i >> /tmp/netext73/$i_$a.txt
			sed -i '/smartctl/ d' /tmp/netext73/$i_$a.txt
			sed -i '/Copyright/ d' /tmp/netext73/$i_$a.txt
			sed -i '/===/ d' /tmp/netext73/$i_$a.txt
			sed -i '/^[ \t]*$/ d' /tmp/netext73/$i_$a.txt
			yad --plug=$KEY --tabnum=$a --text-info --filename=/tmp/netext73/$i_$a.txt 1> ${res[$a]} &
			a=$(( $a + 1 ))
			tabulator=$(echo $tabulator --tab="$i:Smart-Info")
			#SMART info
			res[$a]=$(mktemp --tmpdir=/tmp/netext73 netext73_$a.XXXXXXXX)
			smartctl -A /dev/$i | grep -v '<==' | \
			  awk -F ' ' '$2 ~ /Power_Cycle_Count|Start_Stop_Count|Load_Cycle_Count|Reallocated_Sector_Ct/ \
								{ printf "    %3d %-25s = %8d \n", $1, $2, $10 } ; \
						  $2 ~ /Used_Rsvd_Blk_Cnt_Chip|Used_Rsvd_Blk_Cnt_Tot|Unused_Rsvd_Blk_Cnt_Tot/ \
								{ printf "    %3d %-25s = %8d \n", $1, $2, $10 } ; \
						  $2 ~ /Power_On_Hours/ \
								{ printf "    %3d %-25s = %8d %s\n", $1, $2, $10, "[h]" } ; \
						  $2 ~ /Temperature_Celsius/ \
								{ printf "    %3d %-25s = %8d %s %s %s %s\n", $1, $2, $10, $11, $12, $13, "[°C]" } ; \
						  $2 ~ /Airflow_Temperature_Cel/ \
								{ printf "    %3d %-25s = %8d %s\n", $1, $2, $10, "[°C]" } ; \
						  $2 ~ /Host_Writes/ \
								{ printf "    %3d %-25s = %8.3f %s\n", $1, $2, $10 / 32768.0, "[TB]" } ; \
						  $2 ~ /Total_LBAs_Written/ \
								{ printf "    %3d %-25s = %8.3f %s\n", $1, $2, $10 / 2147483648.0, "[TB]" } ; \
						  $2 ~ /NAND_Writes_1GiB/ \
								{ printf "    %3d %-25s = %8d %s\n", $1, $2, $10, "[GB]" } ; \
						  $2 ~ /Available_Reservd_Space|Media_Wearout_Indicator|Wear_Leveling_Count/ \
								{ printf "    %3d %-25s = %8d %s\n", $1, $2, $4, "[%]" }' > /tmp/netext73/$i_$a.txt
			yad --plug=$KEY --tabnum=$a --text-info --filename=/tmp/netext73/$i_$a.txt 1> ${res[$a]} &
			a=$(( $a + 1 ))
			tabulator=$(echo $tabulator --tab="$i:Smart-Attributes")
		done
		yad --notebook --key=$KEY --image=drive-harddisk --center --tab-pos="left" --title="$nazwa_skryptu1 " $tabulator --width=$((860*$skala)) --height=$((500*$skala)) --on-top $klawisz_trim --button="BadSectorsTest:3" --button="SpeedTest:2" --button="$TEXT_ZAMKNIJ:1" 
		klawisz=$?
		if [ "$klawisz" = "2" ];then
			rm -f /tmp/netext73/*.txt 
			rm -f /tmp/netext73/netext73_*
			please_wait
			KEY="$(echo $RANDOM)"
			a=1
			tabulator=""
			
			for i in $(echo $lista_dyskow); do
				if [ "$(cat /sys/block/$i/queue/rotational)" = "0" ]; then
					res[$a]=$(mktemp --tmpdir=/tmp/netext73 netext73_$a.XXXXXXXX)
					hdparm -t -T /dev/$i > /tmp/netext73/$i_$a.txt
					sed -i 's/MB /MB \n /g' /tmp/netext73/$i_$a.txt
					yad --plug=$KEY --tabnum=$a --text-info --filename=/tmp/netext73/$i_$a.txt 1> ${res[$a]} &
					a=$(( $a + 1 ))
					tabulator=$(echo $tabulator --tab="SpeedTestSSD:$i")
				elif [ "$(cat /sys/block/$i/queue/rotational)" = "1" ]; then
					res[$a]=$(mktemp --tmpdir=/tmp/netext73 netext73_$a.XXXXXXXX)
					hdparm -t -T /dev/$i > /tmp/netext73/$i_$a.txt
					sed -i 's/MB /MB \n /g' /tmp/netext73/$i_$a.txt
					yad --plug=$KEY --tabnum=$a --text-info --filename=/tmp/netext73/$i_$a.txt 1> ${res[$a]} &
					a=$(( $a + 1 ))
					tabulator=$(echo $tabulator --tab="SpeedTestHDD:$i")
				fi
			done
			please_wait kill
			yad --notebook --key=$KEY --image=drive-harddisk --center --tab-pos="left" --title="$nazwa_skryptu1 " $tabulator --width=$((860*$skala)) --height=$((500*$skala)) --on-top --button="$TEXT_ZAMKNIJ:1"
		elif [ "$klawisz" = "3" ];then
			if [ "$(dpkg -l | grep -e smartmontools | grep ii)" = "" ]; then
				xterm  -T "smartmontools" -e bash -c "sudo apt install smartmontools"
			fi
			
			naglowek > instaluj.sh
			echo "for i in \$(df -h | awk '{print \$1}' | grep /dev/ | sort); do sudo badblocks -v \$i; done" >> instaluj.sh
			instalacja3 BadBlockTest
		elif [ "$klawisz" = "4" ];then
			naglowek > instaluj.sh
			echo "sudo fstrim -v / &" >> instaluj.sh
			echo "echo 'Work in progress'" >> instaluj.sh
			echo "pid=\$! # Process Id of the previous running command" >> instaluj.sh
			echo "spin='-\|/'" >> instaluj.sh
			echo "i=0" >> instaluj.sh
			echo "while kill -0 \$pid 2>/dev/null" >> instaluj.sh
			echo "do" >> instaluj.sh
			echo "i=\$(( (i+1) %4 ))" >> instaluj.sh
			echo "printf \"\r\${spin:\$i:1}\"" >> instaluj.sh
			echo "sleep .1" >> instaluj.sh
			echo "done" >> instaluj.sh
			instalacja3 Trim
		fi
		rm -f /tmp/netext73/*.txt 
		rm -f /tmp/netext73/netext73_*
	fi
fi