From dd4ae6990f8656b0739be6d15d0c81f7494c2159 Mon Sep 17 00:00:00 2001 From: Miyuru Sankalpa Date: Sat, 14 Mar 2020 23:50:00 +0530 Subject: [PATCH] added IPv6 address as a fall back address shows the IPv6 address when IPv4 address is unavailable. --- bases/overlay-feature-motd/etc/update-motd.d/50-scw | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bases/overlay-feature-motd/etc/update-motd.d/50-scw b/bases/overlay-feature-motd/etc/update-motd.d/50-scw index 042ab8a..54d6d5d 100755 --- a/bases/overlay-feature-motd/etc/update-motd.d/50-scw +++ b/bases/overlay-feature-motd/etc/update-motd.d/50-scw @@ -20,6 +20,11 @@ processes=`ps aux | wc -l` ip=$(scw-metadata --cached PRIVATE_IP) public_ip=$(scw-metadata --cached PUBLIC_IP_ADDRESS) +if [ -z public_ip ]; then + # Fall back to using the IPv6 address + public_ip=$(scw-metadata --cached IPV6_ADDRESS) +fi + metadata() { scw-metadata --cached "$1" }