@@ -17,7 +17,7 @@ LC_NUMERIC=C
17
17
# ########################################### VARIABLES #############################################
18
18
19
19
# VERSION
20
- padd_version=" v3.5.1 "
20
+ padd_version=" v3.6 "
21
21
22
22
# DATE
23
23
today=$( date +%Y%m%d)
@@ -277,8 +277,33 @@ GetSystemInformation() {
277
277
}
278
278
279
279
GetNetworkInformation () {
280
- # Get pi IP address, hostname and gateway
281
- pi_ip_address=$( ip addr | grep ' state UP' -A2 | tail -n1 | awk ' {print $2}' | cut -f1 -d' /' )
280
+ # Get pi IPv4 address
281
+ readarray -t pi_ip4_addrs <<< " $(ip addr | grep 'inet ' | grep -v '127.0.0.1/8' | awk '{print $2}' | cut -f1 -d'/')"
282
+ if [ ${# pi_ip4_addrs[@]} -eq 0 ]; then
283
+ # No IPv4 address available
284
+ pi_ip4_addr=" N/A"
285
+ elif [ ${# pi_ip4_addrs[@]} -eq 1 ]; then
286
+ # One IPv4 address available
287
+ pi_ip4_addr=" ${pi_ip4_addrs[0]} "
288
+ else
289
+ # More than one IPv4 address available
290
+ pi_ip4_addr=" ${pi_ip4_addrs[0]} +"
291
+ fi
292
+
293
+ # Get pi IPv6 address
294
+ readarray -t pi_ip6_addrs <<< " $(ip addr | grep 'inet6 ' | grep -v '::1/128' | awk '{print $2}' | cut -f1 -d'/')"
295
+ if [ ${# pi_ip6_addrs[@]} -eq 0 ]; then
296
+ # No IPv6 address available
297
+ pi_ip6_addr=" N/A"
298
+ elif [ ${# pi_ip6_addrs[@]} -eq 1 ]; then
299
+ # One IPv6 address available
300
+ pi_ip4_addr=" ${pi_ip6_addrs[0]} "
301
+ else
302
+ # More than one IPv6 address available
303
+ pi_ip6_addr=" ${pi_ip6_addrs[0]} +"
304
+ fi
305
+
306
+ # Get hostname and gateway
282
307
pi_hostname=$( hostname)
283
308
pi_gateway=$( ip r | grep ' default' | awk ' {print $3}' )
284
309
@@ -646,41 +671,41 @@ PrintNetworkInformation() {
646
671
if [ " $1 " = " pico" ]; then
647
672
CleanEcho " ${bold_text} NETWORK ============${reset_text} "
648
673
CleanEcho " Hst: ${pi_hostname} "
649
- CleanEcho " IP: ${pi_ip_address } "
674
+ CleanEcho " IP: ${pi_ip4_addr } "
650
675
CleanEcho " DHCP ${dhcp_check_box} IPv6 ${dhcp_ipv6_check_box} "
651
676
elif [ " $1 " = " nano" ]; then
652
677
CleanEcho " ${bold_text} NETWORK ================${reset_text} "
653
678
CleanEcho " Host: ${pi_hostname} "
654
- CleanEcho " IPv4: ${IPV4_ADDRESS }"
679
+ CleanEcho " IP: ${pi_ip4_addr }"
655
680
CleanEcho " DHCP: ${dhcp_check_box} IPv6: ${dhcp_ipv6_check_box} "
656
681
elif [ " $1 " = " micro" ]; then
657
682
CleanEcho " ${bold_text} NETWORK ======================${reset_text} "
658
683
CleanEcho " Host: ${full_hostname} "
659
- CleanEcho " IPv4 : ${IPV4_ADDRESS }"
684
+ CleanEcho " IP : ${pi_ip4_addr }"
660
685
CleanEcho " DHCP: ${dhcp_check_box} IPv6: ${dhcp_ipv6_check_box} "
661
686
elif [ " $1 " = " mini" ]; then
662
687
CleanEcho " ${bold_text} NETWORK ================================${reset_text} "
663
688
CleanPrintf " %-9s%-19s\e[0K\\ n" " Host:" " ${full_hostname} "
664
- CleanPrintf " %-9s%-19s\e[0K\\ n" " IPv4 :" " ${IPV4_ADDRESS } "
689
+ CleanPrintf " %-9s%-19s\e[0K\\ n" " IP :" " ${pi_ip4_addr } "
665
690
CleanPrintf " %-9s%-10s\e[0K\\ n" " DNS:" " ${dns_information} "
666
691
667
692
if [[ " ${DHCP_ACTIVE} " == " true" ]]; then
668
693
CleanPrintf " %-9s${dhcp_heatmap} %-10s${reset_text} %-9s${dhcp_ipv6_heatmap} %-10s${reset_text} \e[0K\\ n" " DHCP:" " ${dhcp_status} " " IPv6:" ${dhcp_ipv6_status}
669
694
fi
670
695
elif [ " $1 " = " tiny" ]; then
671
696
CleanEcho " ${bold_text} NETWORK ============================================${reset_text} "
672
- CleanPrintf " %-10s%-16s %-8s%-16s\e[0K\\ n" " Hostname:" " ${full_hostname} " " IPv4: " " ${IPV4_ADDRESS } "
673
- CleanPrintf " %-10s %-39s\e[0K\\ n" " IPv6:" " ${IPV6_ADDRESS } "
697
+ CleanPrintf " %-10s%-16s %-8s%-16s\e[0K\\ n" " Hostname:" " ${full_hostname} " " IP: " " ${pi_ip4_addr } "
698
+ CleanPrintf " %-6s %-39s\e[0K\\ n" " IPv6:" " ${pi_ip6_addr } "
674
699
CleanPrintf " %-10s%-16s %-8s%-16s\e[0K\\ n" " DNS:" " ${dns_information} " " DNSSEC:" " ${dnssec_heatmap}${dnssec_status}${reset_text} "
675
700
676
701
if [[ " ${DHCP_ACTIVE} " == " true" ]]; then
677
702
CleanPrintf " %-10s${dhcp_heatmap} %-16s${reset_text} %-8s${dhcp_ipv6_heatmap} %-10s${reset_text} \e[0K\\ n" " DHCP:" " ${dhcp_status} " " IPv6:" ${dhcp_ipv6_status}
678
703
CleanPrintf " %s\e[0K\\ n" " ${dhcp_info} "
679
- fi
704
+ fi
680
705
elif [[ " $1 " = " regular" || " $1 " = " slim" ]]; then
681
706
CleanEcho " ${bold_text} NETWORK ===================================================${reset_text} "
682
- CleanPrintf " %-10s%-19s %-10s%-19s\e[0K\\ n" " Hostname:" " ${full_hostname} " " IPv4 :" " ${IPV4_ADDRESS } "
683
- CleanPrintf " %-10s %-19s\e[0K\\ n" " IPv6:" " ${IPV6_ADDRESS } "
707
+ CleanPrintf " %-10s%-19s %-10s%-19s\e[0K\\ n" " Hostname:" " ${full_hostname} " " IP :" " ${pi_ip4_addr } "
708
+ CleanPrintf " %-6s %-19s\e[0K\\ n" " IPv6:" " ${pi_ip6_addr } "
684
709
CleanPrintf " %-10s%-19s %-10s%-19s\e[0K\\ n" " DNS:" " ${dns_information} " " DNSSEC:" " ${dnssec_heatmap}${dnssec_status}${reset_text} "
685
710
686
711
if [[ " ${DHCP_ACTIVE} " == " true" ]]; then
@@ -690,7 +715,7 @@ PrintNetworkInformation() {
690
715
else
691
716
CleanEcho " ${bold_text} NETWORK =======================================================================${reset_text} "
692
717
CleanPrintf " %-10s%-19s\e[0K\\ n" " Hostname:" " ${full_hostname} "
693
- CleanPrintf " %-10s %-19s %-10s%-29s\e[0K\\ n" " IPv4 Adr :" " ${IPV4_ADDRESS } " " IPv6 Adr :" " ${IPV6_ADDRESS } "
718
+ CleanPrintf " %-6s %-19s %-10s%-29s\e[0K\\ n" " IPv4:" " ${pi_ip4_addr } " " IPv6:" " ${pi_ip6_addr } "
694
719
CleanEcho " DNS ==========================================================================="
695
720
CleanPrintf " %-10s%-39s\e[0K\\ n" " Servers:" " ${dns_information} "
696
721
CleanPrintf " %-10s${dnssec_heatmap} %-19s${reset_text} %-20s${conditional_forwarding_heatmap} %-9s${reset_text} \e[0K\\ n" " DNSSEC:" " ${dnssec_status} " " Conditional Fwding:" " ${conditional_forwarding_status} "
0 commit comments