diff --git a/scripts/cloudron-setup b/scripts/cloudron-setup index 13effbc6f..e32a36573 100755 --- a/scripts/cloudron-setup +++ b/scripts/cloudron-setup @@ -227,7 +227,10 @@ while true; do sleep 10 done -echo -e "\n\n${GREEN}Visit https:// and accept the self-signed certificate to finish setup.${DONE}\n" +if ! ip=$(curl --fail --connect-timeout 2 --max-time 2 -q https://api.cloudron.io/api/v1/helper/public_ip | sed -n -e 's/.*"ip": "\(.*\)"/\1/p'); then + ip='' +fi +echo -e "\n\n${GREEN}Visit https://${ip} and accept the self-signed certificate to finish setup.${DONE}\n" if [[ "${rebootServer}" == "true" ]]; then systemctl stop box mysql # sometimes mysql ends up having corrupt privilege tables diff --git a/setup/start/cloudron-motd b/setup/start/cloudron-motd index bce8fd228..0c922f55a 100755 --- a/setup/start/cloudron-motd +++ b/setup/start/cloudron-motd @@ -3,10 +3,17 @@ printf "**********************************************************************\n\n" if [[ -z "$(ls -A /home/yellowtent/boxdata/mail/dkim)" ]]; then + if [[ -f /tmp/.cloudron-motd-cache ]]; then + ip=$(cat /tmp/.cloudron-motd-cache) + elif ! ip=$(curl --fail --connect-timeout 2 --max-time 2 -q https://api.cloudron.io/api/v1/helper/public_ip | sed -n -e 's/.*"ip": "\(.*\)"/\1/p'); then + ip='' + fi + echo "${ip}" > /tmp/.cloudron-motd-cache + printf "\t\t\tWELCOME TO CLOUDRON\n" printf "\t\t\t-------------------\n" - printf '\n\e[1;32m%-6s\e[m\n\n' "Visit https:// on your browser and accept the self-signed certificate to finish setup." + printf '\n\e[1;32m%-6s\e[m\n\n' "Visit https://${ip} on your browser and accept the self-signed certificate to finish setup." printf "Cloudron overview - https://cloudron.io/documentation/ \n" printf "Cloudron setup - https://cloudron.io/documentation/installation/#setup \n" else