diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-08-23 01:23:28 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-08-23 01:23:49 +0200 |
commit | 296ef04fc762548621401d4463151dfb4c8c3965 (patch) | |
tree | d10eb378303b2b638fde1ab7c025a6a8f9dc1262 | |
parent | 2564226bab71d4a457a39065c84af4748706d5c7 (diff) | |
download | vyatta-cfg-system-296ef04fc762548621401d4463151dfb4c8c3965.tar.gz vyatta-cfg-system-296ef04fc762548621401d4463151dfb4c8c3965.zip |
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.
-rwxr-xr-x | scripts/install/install-image | 9 |
1 files 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] " |