Skip to content

Commit

Permalink
Colors
Browse files Browse the repository at this point in the history
  • Loading branch information
qhdwight committed Sep 17, 2023
1 parent 2923d39 commit c412f74
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
# See: https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -Eeuo pipefail

readonly BLUE='\033[0;34m'
readonly RED_BOLD='\033[1;31m'
readonly BLUE_BOLD='\033[1;34m'
readonly GREY_BOLD='\033[1;30m'
readonly NC='\033[0m'

echo "Ensuring SSH keys are set up ..."
echo "${GREY_BOLD}Ensuring SSH keys are set up ...${NC}}"
if [ ! -f ~/.ssh/id_ed25519 ] && [ ! -f ~/.ssh/id_rsa ]; then
echo "Please see: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent"
echo "${RED_BOLD}Please see: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent${NC}"
exit 1
fi

Expand All @@ -24,7 +26,7 @@ NEED_APT_UPDATE=false
for PPA in "${PPAS[@]}"; do
if ! grep -q "^deb .*${PPA}" /etc/apt/sources.list /etc/apt/sources.list.d/*;
then
echo "Adding PPA: ${PPA}"
echo "${GREY_BOLD}Adding PPA: ${PPA}${NC}"
sudo apt-add-repository ppa:"${PPA}" -y
NEED_APT_UPDATE=true
fi
Expand All @@ -37,32 +39,32 @@ sudo apt install -y ansible git git-lfs

readonly DEFAULT_CATKIN_PATH=~/catkin_ws

echo "${BLUE}Enter path to ROS workspace... [leave blank for ${DEFAULT_CATKIN_PATH}]:${NC}"
echo "${BLUE_BOLD}Enter path to ROS workspace... [leave blank for ${DEFAULT_CATKIN_PATH}]:${NC}"
read -r CATKIN_PATH
if [ -z "${CATKIN_PATH}" ]; then
CATKIN_PATH=${DEFAULT_CATKIN_PATH}
fi
echo "Using ${CATKIN_PATH} as ROS workspace"
echo "${GREY_BOLD}Using ${CATKIN_PATH} as ROS workspace${NC}"

readonly MROVER_PATH=${CATKIN_PATH}/src/mrover
readonly FIRST_TIME_SETUP=[ ! -d ${MROVER_PATH}]

if [ "${FIRST_TIME_SETUP}" ]; then
echo "Creating ROS workspace ..."
echo "${GREY_BOLD}Creating ROS workspace ...${NC}"
mkdir -p ${CATKIN_PATH}/src
git clone git@github.com:umrover/mrover-ros ${CATKIN_PATH}/src/mrover -b qd/ansible
fi

echo "Using Ansible to finish up ..."
echo "${GREY_BOLD}Using Ansible to finish up ...${NC}"
${MROVER_PATH}/ansible.sh dev.yml

if [ ! -d ${MROVER_PATH}/venv ]; then
echo "Setting up Python virtual environment ..."
echo "${GREY_BOLD}Setting up Python virtual environment ...${NC}"
python3.10 -m venv ${MROVER_PATH}/venv
source ${MROVER_PATH}/venv/bin/activate
pip install -e "${MROVER_PATH}[dev]"
fi

if [ "${FIRST_TIME_SETUP}" ]; then
echo "All done! Welcome to MRover!"
echo "${GREY_BOLD}All done! Welcome to MRover!${NC}"
fi

0 comments on commit c412f74

Please sign in to comment.