Suggest correct IP if using non-default interface

This patch makes airship-in-a-bottle.sh script to suggest correct IP
if using non-default interface, and fixes minor syntax error.

Change-Id: I85f9d681eed9a1f3bd23f78cb749be498ab3c2ea
This commit is contained in:
Roman Gorshunov 2018-06-11 15:32:15 +02:00
parent 3fcdf434fc
commit 047e6a6a19
2 changed files with 7 additions and 2 deletions

View File

@ -24,7 +24,7 @@ This demonstration uses the images pinned in the versions file of the targeted
deployment_files based site definitions:
deployment_files/global/v1.0demo/software/config/versions.yaml
By default, files will be downloadloaded and built into the /root/deploy
By default, files will be downloaded into and built in the /root/deploy
directory of the virtual machine being used to install this demo.
Note that this process will result in the contents of the VM to be modified

View File

@ -80,14 +80,19 @@ echo "Let's collect some information about your VM to get started."
sleep 1
# IP and Hostname setup
get_local_ip ()
{
ip addr | awk "/inet/ && /${HOST_IFACE}/{sub(/\/.*$/,\"\",\$2); print \$2}"
}
HOST_IFACE=$(ip route | grep "^default" | head -1 | awk '{ print $5 }')
LOCAL_IP=$(ip addr | awk "/inet/ && /${HOST_IFACE}/{sub(/\/.*$/,\"\",\$2); print \$2}")
LOCAL_IP=$(get_local_ip)
if [[ $ASSUME_YES -ne 1 ]]; then
read -p "Is your HOST IFACE $HOST_IFACE? (Y/n) " YN_HI
if [[ ! "$YN_HI" =~ ^([yY]|"")$ ]]; then
read -p "What is your HOST IFACE? " HOST_IFACE
fi
LOCAL_IP=$(get_local_ip)
read -p "Is your LOCAL IP $LOCAL_IP? (Y/n) " YN_IP
if [[ ! "$YN_IP" =~ ^([yY]|"")$ ]]; then