Skip to content

Commit

Permalink
use return instead of exit in setup_student_vm.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
maaikelimper committed Oct 15, 2024
1 parent 8f24f07 commit 6f93d8a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions environment/setup_student_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ $# -eq 0 ]
then
echo "No arguments supplied"
echo "Usage: ./setup_student_vm.sh <USERNAME> <HOST_IP>"
exit 1
return 1
fi

# first argument of the script is the username
Expand All @@ -16,9 +16,9 @@ USERNAME=$1
HOST_IP=$2

echo "USERNAME=`echo $USERNAME`"
read -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
read -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || return 1
echo "HOST_IP=`echo $HOST_IP`"
read -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
read -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || return 1

# execute commands over ssh

Expand All @@ -37,7 +37,7 @@ ssh -o StrictHostKeyChecking=no wmo_admin@`echo $HOST_IP` "sudo unzip -o /tmp/wi
ssh -o StrictHostKeyChecking=no wmo_admin@`echo $HOST_IP` "rm -rf /tmp/wis2box-setup-1.0b8.zip"

# copy the latest exercise materials to the student-vm
ssh -o StrictHostKeyChecking=no wmo_admin@`echo $HOST_IP` "wget https://training.wis2box.wis2dev.io/exercise-materials.zip -O /tmp/exercise-materials.zip"
ssh -o StrictHostKeyChecking=no wmo_admin@`echo $HOST_IP` "wget https://training.wis2box.wis.wmo.int/exercise-materials.zip -O /tmp/exercise-materials.zip"
# unzip the exercise-materials.zip
ssh -o StrictHostKeyChecking=no wmo_admin@`echo $HOST_IP` "sudo unzip -o /tmp/exercise-materials.zip -d /home/`echo $USERNAME`/"
# remove the exercise-materials.zip
Expand Down

0 comments on commit 6f93d8a

Please sign in to comment.