Lines 81-88
Link Here
|
81 |
# info "Font" font |
81 |
# info "Font" font |
82 |
# info "Song" song |
82 |
# info "Song" song |
83 |
# [[ "$player" ]] && prin "Music Player" "$player" |
83 |
# [[ "$player" ]] && prin "Music Player" "$player" |
84 |
# info "Local IP" local_ip |
84 |
# info "Local IP4" local_ip |
85 |
# info "Public IP" public_ip |
85 |
# info "Local IP6" local_ip6 |
|
|
86 |
# info "Public IP4" public_ip |
87 |
# info "Public IP6" public_ip6 |
86 |
# info "Users" users |
88 |
# info "Users" users |
87 |
# info "Locale" locale # This only works on glibc systems. |
89 |
# info "Locale" locale # This only works on glibc systems. |
88 |
|
90 |
|
Lines 400-405
Link Here
|
400 |
# Values: 'url' |
402 |
# Values: 'url' |
401 |
# Flag: --ip_host |
403 |
# Flag: --ip_host |
402 |
public_ip_host="http://ident.me" |
404 |
public_ip_host="http://ident.me" |
|
|
405 |
public_ip6_host="http://ident.me" |
403 |
|
406 |
|
404 |
# Public IP timeout. |
407 |
# Public IP timeout. |
405 |
# |
408 |
# |
Lines 407-412
Link Here
|
407 |
# Values: 'int' |
410 |
# Values: 'int' |
408 |
# Flag: --ip_timeout |
411 |
# Flag: --ip_timeout |
409 |
public_ip_timeout=2 |
412 |
public_ip_timeout=2 |
|
|
413 |
public_ip6_timeout=2 |
410 |
|
414 |
|
411 |
|
415 |
|
412 |
# Desktop Environment |
416 |
# Desktop Environment |
Lines 3695-3702
Link Here
|
3695 |
get_local_ip() { |
3699 |
get_local_ip() { |
3696 |
case $os in |
3700 |
case $os in |
3697 |
"Linux" | "BSD" | "Solaris" | "AIX" | "IRIX") |
3701 |
"Linux" | "BSD" | "Solaris" | "AIX" | "IRIX") |
3698 |
local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')" |
3702 |
local_ip=$(ip -4 addr show scope global | grep -m1 "inet " |awk '{print $2}' | cut -d'/' -f1) |
3699 |
local_ip="${local_ip/uid*}" |
|
|
3700 |
[[ -z "$local_ip" ]] && local_ip="$(ifconfig -a | awk '/broadcast/ {print $2; exit}')" |
3703 |
[[ -z "$local_ip" ]] && local_ip="$(ifconfig -a | awk '/broadcast/ {print $2; exit}')" |
3701 |
;; |
3704 |
;; |
3702 |
|
3705 |
|
Lines 3721-3743
Link Here
|
3721 |
esac |
3724 |
esac |
3722 |
} |
3725 |
} |
3723 |
|
3726 |
|
|
|
3727 |
get_local_ip6() { |
3728 |
case $os in |
3729 |
"Linux" | "BSD" | "Solaris" | "AIX" | "IRIX") |
3730 |
local_ip6=$(ip -6 addr show scope global | grep -m1 "inet6 " |awk '{print $2}' | cut -d'/' -f1) |
3731 |
[[ -z "$local_ip6" ]] && local_ip6="$(ifconfig -a | awk '/global/ {print $2; exit}')" |
3732 |
;; |
3733 |
esac |
3734 |
} |
3735 |
|
3724 |
get_public_ip() { |
3736 |
get_public_ip() { |
3725 |
if type -p dig >/dev/null; then |
3737 |
if type -p dig >/dev/null; then |
3726 |
public_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com)" |
3738 |
public_ip="$(dig +time=1 +tries=1 +short A myip.opendns.com @resolver1.opendns.com)" |
3727 |
[[ "$public_ip" =~ ^\; ]] && unset public_ip |
3739 |
[[ "$public_ip" =~ ^\; ]] && unset public_ip |
3728 |
fi |
3740 |
fi |
3729 |
|
3741 |
|
3730 |
if [[ -z "$public_ip" ]] && type -p drill >/dev/null; then |
3742 |
if [[ -z "$public_ip" ]] && type -p drill >/dev/null; then |
3731 |
public_ip="$(drill myip.opendns.com @resolver1.opendns.com | \ |
3743 |
public_ip="$(drill A myip.opendns.com @resolver1.opendns.com | \ |
3732 |
awk '/^myip\./ && $3 == "IN" {print $5}')" |
3744 |
awk '/^myip\./ && $3 == "IN" {print $5}')" |
3733 |
fi |
3745 |
fi |
3734 |
|
3746 |
|
3735 |
if [[ -z "$public_ip" ]] && type -p curl >/dev/null; then |
3747 |
if [[ -z "$public_ip" ]] && type -p curl >/dev/null; then |
3736 |
public_ip="$(curl --max-time "$public_ip_timeout" -w '\n' "$public_ip_host")" |
3748 |
public_ip="$(curl -4 --max-time "$public_ip_timeout" -w '\n' "$public_ip_host")" |
3737 |
fi |
3749 |
fi |
3738 |
|
3750 |
|
3739 |
if [[ -z "$public_ip" ]] && type -p wget >/dev/null; then |
3751 |
if [[ -z "$public_ip" ]] && type -p wget >/dev/null; then |
3740 |
public_ip="$(wget -T "$public_ip_timeout" -qO- "$public_ip_host")" |
3752 |
public_ip="$(wget -4 -T "$public_ip_timeout" -qO- "$public_ip_host")" |
|
|
3753 |
fi |
3754 |
} |
3755 |
|
3756 |
get_public_ip6() { |
3757 |
if type -p dig >/dev/null; then |
3758 |
public_ip6="$(dig +time=1 +tries=1 +short AAAA myip.opendns.com @resolver1.opendns.com)" |
3759 |
[[ "$public_ip6" =~ ^\; ]] && unset public_ip6 |
3760 |
fi |
3761 |
|
3762 |
if [[ -z "$public_ip6" ]] && type -p drill >/dev/null; then |
3763 |
public_ip6="$(drill AAAA myip.opendns.com @resolver1.opendns.com | \ |
3764 |
awk '/^myip\./ && $3 == "IN" {print $5}')" |
3765 |
fi |
3766 |
|
3767 |
if [[ -z "$public_ip6" ]] && type -p curl >/dev/null; then |
3768 |
public_ip6="$(curl -6 --max-time "$public_ip_timeout" -w '\n' "$public_ip_host")" |
3769 |
fi |
3770 |
|
3771 |
if [[ -z "$public_ip6" ]] && type -p wget >/dev/null; then |
3772 |
public_ip6="$(wget -6 -T "$public_ip_timeout" -qO- "$public_ip_host")" |
3741 |
fi |
3773 |
fi |
3742 |
} |
3774 |
} |
3743 |
|
3775 |
|