diff --git a/setup/setup_px4_sitl.sh b/setup/setup_px4_sitl.sh index b23ecb4..991f89d 100644 --- a/setup/setup_px4_sitl.sh +++ b/setup/setup_px4_sitl.sh @@ -43,12 +43,7 @@ if [ ! -d "$CLONE_PATH" ]; then mkdir -p "$CLONE_PATH" fi -# === Ensure the Script is in the Target Folder === -TARGET_SCRIPT_PATH="$CLONE_PATH/$SCRIPT_NAME" -if [ "$(realpath "$0")" != "$(realpath "$TARGET_SCRIPT_PATH")" ]; then - echo "Copying script to $TARGET_SCRIPT_PATH..." - cp "$0" "$TARGET_SCRIPT_PATH" -fi + # === Introductory Information === echo "----------------------------------------------------------" @@ -83,6 +78,13 @@ else echo "Repository already cloned at $CLONE_PATH." fi +# === Ensure the Script is in the Target Folder === +TARGET_SCRIPT_PATH="$CLONE_PATH/$SCRIPT_NAME" +if [ "$(realpath "$0")" != "$(realpath "$TARGET_SCRIPT_PATH")" ]; then + echo "Copying script to $TARGET_SCRIPT_PATH..." + cp "$0" "$TARGET_SCRIPT_PATH" +fi + cd "$CLONE_PATH" || exit git checkout "$BRANCH_NAME"