From 047e6a6a19603749458c12cc3450aab97607ca5b Mon Sep 17 00:00:00 2001 From: Roman Gorshunov Date: Mon, 11 Jun 2018 15:32:15 +0200 Subject: [PATCH] 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 --- manifests/dev_single_node/README.txt | 2 +- manifests/dev_single_node/airship-in-a-bottle.sh | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/manifests/dev_single_node/README.txt b/manifests/dev_single_node/README.txt index 0267fbc8..fc24ca51 100644 --- a/manifests/dev_single_node/README.txt +++ b/manifests/dev_single_node/README.txt @@ -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 diff --git a/manifests/dev_single_node/airship-in-a-bottle.sh b/manifests/dev_single_node/airship-in-a-bottle.sh index 896db5e0..83068155 100755 --- a/manifests/dev_single_node/airship-in-a-bottle.sh +++ b/manifests/dev_single_node/airship-in-a-bottle.sh @@ -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