#!/bin/bash

set -euo pipefail

driving_repo=$1
cd $driving_repo

# TODO : Source from a shell script SIM-9782
base_log_dir="$HOME/.log"
export ROS_LOG_DIR="$base_log_dir/ros"
export GOOGLE_LOG_DIR="$base_log_dir/glog"
export PYTHON_LOG_DIR="$base_log_dir/python"
export ELECTRON_LOG_DIR="$base_log_dir/electron"

# When moving from branches where sim is deployed to ones where
# it isn't, the vehicle.json may be stale when we start the bridge, which
# can cauuse problems generating the masterlist
# This should not be necessary once everyone is deploying to sim,
# but this entire target will be able to be added to the validation
# package, obviating the need for this script entirely
bazel run //bin:get_hardware_config -- --output_dir /etc/zoox/current_config

bazel run //ci/zimbeast/ansible/simulation_management:start_bridge --config=kraken > /home/zoox/.log/glog/sim_3d_bridge_error_log.txt 2>&1
