@@ -45,7 +45,8 @@ GetFTLData() {
45
45
}
46
46
47
47
GetSummaryInformation () {
48
- local summary=$( GetFTLData " stats" )
48
+ local summary
49
+ summary=$( GetFTLData " stats" )
49
50
domains_being_blocked_raw=$( grep " domains_being_blocked" <<< " ${summary}" | grep -Eo " [0-9]+$" )
50
51
domains_being_blocked=$( printf " %'.f" ${domains_being_blocked_raw} )
51
52
dns_queries_today_raw=$( grep " dns_queries_today" <<< " $summary" | grep -Eo " [0-9]+$" )
@@ -187,17 +188,15 @@ GetVersionInformation() {
187
188
source piHoleVersion
188
189
189
190
# was the last check today?
190
- if [ " ${today} " != " ${lastCheck} " ]; then
191
- # no, it wasn't today
192
-
191
+ if [ " ${today} " != " ${lastCheck} " ]; then # no, it wasn't today
193
192
# Today is...
194
193
today=$( date +%Y%m%d)
195
194
196
195
# what are the latest available versions?
197
196
# TODO: update if necessary if added to pihole
198
- piholeVersionLatest=$( pihole -v -p -l | tr -d " [:alpha:]" )
199
- webVersionLatest=$( pihole -v -a -l | tr -d " [:alpha:]" )
200
- ftlVersionLatest=$( curl -sI https://github.com/pi-hole/FTL/releases/latest | grep ' Location ' | awk -F ' / ' ' {print $NF }' | tr -d ' \r\n [:alpha:]' )
197
+ piholeVersionLatest=$( pihole -v -p -l | awk ' {print $5} ' | tr -d " [:alpha:]" )
198
+ webVersionLatest=$( pihole -v -a -l | awk ' {print $5} ' | tr -d " [:alpha:]" )
199
+ ftlVersionLatest=$( pihole -v -f -l | awk ' {print $5 }' | tr -d " [:alpha:]" )
201
200
chronometer2VersionLatest=$( curl -sI https://github.com/jpmck/chronometer2/releases/latest | grep ' Location' | awk -F ' /' ' {print $NF}' | tr -d ' \r\n[:alpha:]' )
202
201
203
202
# check if everything is up-to-date...
@@ -250,8 +249,6 @@ GetVersionInformation() {
250
249
fi
251
250
fi
252
251
253
-
254
-
255
252
# write it all to the file
256
253
echo " lastCheck=" ${today} > ./piHoleVersion
257
254
@@ -275,9 +272,9 @@ GetVersionInformation() {
275
272
# else the file dosn't exist
276
273
else
277
274
# We're using...
278
- piholeVersion=$( pihole -v -p -c | tr -d " [:alpha:]" )
279
- webVersion=$( pihole -v -a -c | tr -d " [:alpha:]" )
280
- ftlVersion=$( /usr/bin/ pihole-FTL version | tr -d " [:alpha:]" )
275
+ piholeVersion=$( pihole -v -p | awk ' {print $4} ' | tr -d " [:alpha:]" )
276
+ webVersion=$( pihole -v -a | awk ' {print $4} ' | tr -d " [:alpha:]" )
277
+ ftlVersion=$( pihole -v -f | awk ' {print $4} ' | tr -d " [:alpha:]" )
281
278
282
279
echo " lastCheck=0" > ./piHoleVersion
283
280
echo " piholeVersion=" $piholeVersion >> ./piHoleVersion
@@ -297,7 +294,7 @@ outputDHCPInformation() {
297
294
}
298
295
299
296
outputJSON () {
300
- GetSummaryInformatioon
297
+ GetSummaryInformation
301
298
echo " {\" domains_being_blocked\" :${domains_being_blocked_raw} ,\" dns_queries_today\" :${dns_queries_today_raw} ,\" ads_blocked_today\" :${ads_blocked_today_raw} ,\" ads_percentage_today\" :${ads_percentage_today_raw} }"
302
299
}
303
300
@@ -424,7 +421,7 @@ if [[ $# = 0 ]]; then
424
421
GetVersionInformation
425
422
echo " - $versionStatus "
426
423
echo " "
427
- printf " Chronometer2 will start in "
424
+ printf " Chronometer2 will start in"
428
425
429
426
for i in 5 4 3 2 1
430
427
do
0 commit comments