From 04c195e8b55225b861a8252dd41f819df7bf02e8 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:41:54 -0400 Subject: [PATCH] Move interface up setps before requesting keys URL --- install.sh | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/install.sh b/install.sh index b3133a5..4418652 100755 --- a/install.sh +++ b/install.sh @@ -116,6 +116,24 @@ else echo fi +echo -n "Bringing up primary network interface in ${target_netformat} mode... " +case ${target_netformat} in + 'static') + ip link set ${target_interface} up >&2 || true + ip address add ${target_ipaddr} dev ${target_interface} >&2 || true + ip route add default via ${target_defgw} >&2 || true + formatted_ipaddr="$( sipcalc ${target_ipaddr} | grep -v '(' | awk '/Host address/{ print $NF }' )" + formatted_netmask="$( sipcalc ${target_ipaddr} | grep -v '(' | awk '/Network mask/{ print $NF }' )" + target_interfaces_block="auto ${target_interface}\niface ${target_interface} inet ${target_netformat}\n\taddress ${formatted_ipaddr}\n\tnetmask ${formatted_netmask}\n\tgateway ${target_defgw}" + ;; + 'dhcp') + dhclient ${target_interface} >&2 + target_interfaces_block="auto ${target_interface}\niface ${target_interface} inet ${target_netformat}" + ;; +esac +echo "done." +echo + echo "4) Please enter an HTTP URL containing a text list of SSH authorized keys to" echo "fetch. These keys will be allowed access to the 'deploy' user via SSH." echo "Leave blank to bypass this and use a password instead." @@ -215,23 +233,6 @@ else exit 1 fi -echo -n "Bringing up primary network interface in ${target_netformat} mode... " -case ${target_netformat} in - 'static') - ip link set ${target_interface} up >&2 || true - ip address add ${target_ipaddr} dev ${target_interface} >&2 || true - ip route add default via ${target_defgw} >&2 || true - formatted_ipaddr="$( sipcalc ${target_ipaddr} | grep -v '(' | awk '/Host address/{ print $NF }' )" - formatted_netmask="$( sipcalc ${target_ipaddr} | grep -v '(' | awk '/Network mask/{ print $NF }' )" - target_interfaces_block="auto ${target_interface}\niface ${target_interface} inet ${target_netformat}\n\taddress ${formatted_ipaddr}\n\tnetmask ${formatted_netmask}\n\tgateway ${target_defgw}" - ;; - 'dhcp') - dhclient ${target_interface} >&2 - target_interfaces_block="auto ${target_interface}\niface ${target_interface} inet ${target_netformat}" - ;; -esac -echo "done." - echo -n "Disabing existing volume groups... " vgchange -an >&2 || true echo "done."