Skip to content

Commit 4040b84

Browse files
committed
trixie: Fix behaviour on IPv6-only setups.
1 parent e4c9a76 commit 4040b84

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

trixie

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,17 @@ EOF
651651

652652
function conclusion() {
653653
# Get first local IP and global IP
654-
local local_ip
654+
local local_ip global_ip no_ip=""
655655
local_ip=$(hostname --all-ip-address | tr ' ' '\n' | grep -v ":" | head -n1)
656-
local global_ip
657-
global_ip=$(curl https://ip.yunohost.org 2>/dev/null)
658-
local no_ip=""
656+
global_ip=$(curl https://ipv4.yunohost.org 2>/dev/null || true)
657+
658+
# Fallback to IPv6
659+
if [[ -z "$local_ip" ]]; then
660+
local_ip=$(hostname --all-ip-address | tr ' ' '\n' | grep ":" | head -n1)
661+
fi
662+
if [[ -z "$global_ip" ]]; then
663+
global_ip=$(curl https://ipv6.yunohost.org 2>/dev/null || true)
664+
fi
659665

660666
# Will ignore local ip if it's already the global IP (e.g. for some VPS)
661667
if [[ "$local_ip" == "$global_ip" ]]; then
@@ -665,14 +671,16 @@ function conclusion() {
665671
# Formatting
666672
local width=79
667673
if [[ -n "$local_ip" ]]; then
668-
local_ip=$(echo -e "\n │ - https://$local_ip/ (local IP, if self-hosting at home)")
674+
local_ip=$(echo -e "\n │ - https://$local_ip/")
669675
local nb_spaces=$(( width - ${#local_ip} ))
670676
local_ip+="$(printf "%${nb_spaces}s")"
677+
local_ip+=$(echo -e "\n │ (local IP, if self-hosting at home) │")
671678
fi
672679
if [[ -n "$global_ip" ]]; then
673-
global_ip=$(echo -e "\n │ - https://$global_ip/ (global IP, if you're on a VPS)")
680+
global_ip=$(echo -e "\n │ - https://$global_ip/")
674681
local nb_spaces=$(( width - ${#global_ip} ))
675682
global_ip+="$(printf "%${nb_spaces}s")"
683+
global_ip+=$(echo -e "\n │ (global IP, if you're on a VPS) │")
676684
fi
677685
if [[ -z "$local_ip" ]] && [[ -z "$global_ip" ]]; then
678686
no_ip=$(echo -e "\n │ - (no local nor global IP detected ?)")

0 commit comments

Comments
 (0)