Fetch and display local and global IP for conclusion message

This commit is contained in:
Alexandre Aubin 2018-12-10 17:28:28 +00:00
parent 181e2beaa2
commit ff20b1ee33

View file

@ -417,6 +417,17 @@ function fix_locales() {
} }
function conclusion() { function conclusion() {
# Get first local IP and global IP
local local_ip=$(hostname --all-ip-address | awk '{print $1}')
local global_ip=$(curl https://ip.yunohost.org 2>/dev/null)
# Will ignore local ip if it's already the global IP (e.g. for some VPS)
[[ "$local_ip" != "$global_ip" ]] || local_ip=""
# Formatting
[[ -z "$local_ip" ]] || local_ip=$(echo -e "\n - https://$local_ip/ (local IP, if self-hosting at home)")
[[ -z "$global_ip" ]] || global_ip=$(echo -e "\n - https://$global_ip/ (global IP, if you're on a VPS)")
cat << EOF cat << EOF
=============================================================================== ===============================================================================
You should now proceed with Yunohost post-installation. This is where you will You should now proceed with Yunohost post-installation. This is where you will
@ -426,8 +437,7 @@ be asked for :
You can perform this step : You can perform this step :
- from the command line, by running 'yunohost tools postinstall' as root - from the command line, by running 'yunohost tools postinstall' as root
- or from your web browser, by accessing https://11.22.33.44 (replacing the - or from your web browser, by accessing : ${local_ip}${global_ip}
numbers with your server's local or global IP).
If this is your first time with YunoHost, it is strongly advised to take time If this is your first time with YunoHost, it is strongly advised to take time
to read the administator documentation and in particular the sections to read the administator documentation and in particular the sections