From 296ef04fc762548621401d4463151dfb4c8c3965 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 23 Aug 2020 01:23:28 +0200 Subject: install-image: T2690: T2762: always run in default VRF unless specified When you connect via SSH and run the "add system image" command, it is launched inside the VRF you are currently connected to. This might become confusing as the VRF context changes. Change command to always run in "default" vrf unless "add system image" command is invoked with the vrf option. --- scripts/install/install-image | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/install/install-image b/scripts/install/install-image index 5eea4d15..0553348e 100755 --- a/scripts/install/install-image +++ b/scripts/install/install-image @@ -45,6 +45,7 @@ exit_handler () { # read in commandline - snipped thankfully copied from: # https://unix.stackexchange.com/a/580258 +VRF="default" while [ $# -gt 0 ]; do case "$1" in --url*|-u) @@ -55,7 +56,7 @@ while [ $# -gt 0 ]; do ;; --vrf*|-v) if [[ "$1" != *=* ]]; then shift; fi # Value is next arg if no `=` - VRF="ip vrf exec ${1#*=}" + VRF="${1#*=}" ;; --username*) if [[ "$1" != *=* ]]; then shift; fi @@ -115,7 +116,7 @@ fetch_iso_by_url () vyos_version=`cat /opt/vyatta/etc/version | awk '{print $2}'` filename="${TEMP_DIR}/${NEW_ISO##*/}" - $VRF curl -L -H "User-Agent: VyOS/$vyos_version" $AUTH -f -o $filename $NEW_ISO + ip vrf exec $VRF curl -L -H "User-Agent: VyOS/$vyos_version" $AUTH -f -o $filename $NEW_ISO curlerror=$? if [ $curlerror -eq 51 ]; then host=${NEW_ISO##scp://} @@ -133,7 +134,7 @@ fetch_iso_by_url () if [[ "$response" == "yes" || "$response" == "y" ]]; then mkdir -p ~/.ssh/ echo $rsa_key >> ~/.ssh/known_hosts - $VRF curl $AUTH -f -o $filename $NEW_ISO + ip vrf exec $VRF curl $AUTH -f -o $filename $NEW_ISO curlerror=$? fi fi @@ -150,7 +151,7 @@ fetch_iso_by_url () echo "ISO download succeeded." echo "Checking for digital signature file..." - $VRF curl -L -H "User-Agent: VyOS/$vyos_version" $AUTH -f -o ${filename}.asc ${NEW_ISO}.asc + ip vrf exec $VRF curl -L -H "User-Agent: VyOS/$vyos_version" $AUTH -f -o ${filename}.asc ${NEW_ISO}.asc if [ $? -ne 0 ]; then echo "Unable to fetch digital signature file." echo -n "Do you want to continue without signature check? (yes/no) [yes] " -- cgit v1.2.3