curl pc installer (#33072)

* setup

* curl

* usable right now

* op sim

* cleanup

* show cmd
old-commit-hash: 173a633a75
pull/33302/head
Maxime Desroches 9 months ago committed by GitHub
parent fbdb5f3495
commit 8b1766caa0
  1. 24
      tools/op.sh
  2. 68
      tools/setup.sh
  3. 5
      tools/ubuntu_setup.sh

@ -161,14 +161,23 @@ function op_install() {
op_check_os op_check_os
op_check_python op_check_python
echo "Installing dependencies..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then
op_run_command $OPENPILOT_ROOT/tools/ubuntu_setup.sh op_run_command $OPENPILOT_ROOT/tools/ubuntu_setup.sh
elif [[ "$OSTYPE" == "darwin"* ]]; then elif [[ "$OSTYPE" == "darwin"* ]]; then
op_run_command $OPENPILOT_ROOT/tools/mac_setup.sh op_run_command $OPENPILOT_ROOT/tools/mac_setup.sh
fi fi
echo -e " ↳ [${GREEN}${NC}] Dependencies installed successfully.\n"
echo "Getting git submodules..."
op_run_command git submodule update --init --recursive op_run_command git submodule update --init --recursive
echo -e " ↳ [${GREEN}${NC}] Submodules installed successfully.\n"
echo "Pulling git lfs files..."
op_run_command git lfs pull op_run_command git lfs pull
echo -e " ↳ [${GREEN}${NC}] Files pulled successfully.\n"
op_check
) )
} }
@ -199,7 +208,7 @@ function op_run() {
(set -e (set -e
op_before_cmd op_before_cmd
op_run_command $OPENPILOT_ROOT/launch_openpilot.sh op_run_command $OPENPILOT_ROOT/launch_openpilot.sh $@
) )
} }
@ -249,6 +258,16 @@ function op_cabana() {
) )
} }
function op_sim() {
(set -e
op_before_cmd
op_run_command exec $OPENPILOT_ROOT/tools/sim/run_bridge.py &
op_run_command exec $OPENPILOT_ROOT/tools/sim/launch_openpilot.sh
)
}
function op_default() { function op_default() {
echo "An openpilot helper" echo "An openpilot helper"
echo "" echo ""
@ -270,6 +289,7 @@ function op_default() {
echo -e " ${BOLD}install${NC} Install requirements to use openpilot" echo -e " ${BOLD}install${NC} Install requirements to use openpilot"
echo -e " ${BOLD}build${NC} Build openpilot" echo -e " ${BOLD}build${NC} Build openpilot"
echo -e " ${BOLD}run${NC} Run openpilot" echo -e " ${BOLD}run${NC} Run openpilot"
echo -e " ${BOLD}sim${NC} Run openpilot in a simulator"
echo -e " ${BOLD}juggle${NC} Run Plotjuggler" echo -e " ${BOLD}juggle${NC} Run Plotjuggler"
echo -e " ${BOLD}replay${NC} Run replay" echo -e " ${BOLD}replay${NC} Run replay"
echo -e " ${BOLD}cabana${NC} Run cabana" echo -e " ${BOLD}cabana${NC} Run cabana"
@ -318,6 +338,7 @@ function _op() {
cabana ) shift 1; op_cabana "$@" ;; cabana ) shift 1; op_cabana "$@" ;;
linter ) shift 1; op_linter "$@" ;; linter ) shift 1; op_linter "$@" ;;
replay ) shift 1; op_replay "$@" ;; replay ) shift 1; op_replay "$@" ;;
sim ) shift 1; op_sim "$@" ;;
--install ) shift 1; op_first_install "$@" ;; --install ) shift 1; op_first_install "$@" ;;
* ) op_default "$@" ;; * ) op_default "$@" ;;
esac esac
@ -345,6 +366,7 @@ unset -f op_replay
unset -f op_cabana unset -f op_cabana
unset -f op_check_venv unset -f op_check_venv
unset -f op_before_cmd unset -f op_before_cmd
unset -f op_sim
unset DRY unset DRY
unset OPENPILOT_ROOT unset OPENPILOT_ROOT
unset NO_VERIFY unset NO_VERIFY

@ -1,32 +1,54 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
if [ ! -f launch_openpilot.sh ]; then if [ -z "$OPENPILOT_ROOT" ]; then
if [ ! -d openpilot ]; then # default to current directory for installation
git clone --single-branch --recurse-submodules https://github.com/commaai/openpilot.git OPENPILOT_ROOT="$(pwd)/openpilot"
fi
cd openpilot
fi fi
if [[ "$OSTYPE" == "darwin"* ]]; then function check_dir() {
tools/mac_setup.sh echo "Checking for installation directory..."
else if [ -d "$OPENPILOT_ROOT" ]; then
tools/ubuntu_setup.sh echo -e " ↳ [${RED}${NC}] can't install openpilot in $OPENPILOT_ROOT !"
fi return 1
fi
echo -e " ↳ [${GREEN}${NC}] Successfully chosen $OPENPILOT_ROOT as installation directory\n"
}
function check_git() {
echo "Checking for git..."
if ! command -v "git" > /dev/null 2>&1; then
echo -e " ↳ [${RED}${NC}] git not found on your system, can't continue!"
return 1
else
echo -e " ↳ [${GREEN}${NC}] git found.\n"
fi
}
function git_clone() {
echo "Cloning openpilot..."
if $(git clone --depth=1 https://github.com/commaai/openpilot.git "$OPENPILOT_ROOT"); then
if [[ -f $OPENPILOT_ROOT/launch_openpilot.sh ]]; then
echo -e " ↳ [${GREEN}${NC}] Successfully cloned openpilot.\n"
return 0
fi
fi
git lfs pull echo -e " ↳ [${RED}${NC}] failed to clone openpilot!"
return 1
}
source .venv/bin/activate function install_with_op() {
cd $OPENPILOT_ROOT
$OPENPILOT_ROOT/tools/op.sh --install
$OPENPILOT_ROOT/tools/op.sh install
echo "Building openpilot" # make op usable right now
scons -u -j$(nproc) alias op="source $OPENPILOT_ROOT/tools/op.sh \"\$@\""
}
echo check_dir && check_git && git_clone && install_with_op
echo "---- OPENPILOT BUILDING DONE ----"
echo "To push changes to your fork, run the following commands:"
echo "git remote remove origin"
echo "git remote add origin git@github.com:<YOUR_USERNAME>/openpilot.git"
echo "git fetch"
echo "git commit -m \"first commit\""
echo "git push"

@ -8,8 +8,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
$DIR/install_ubuntu_dependencies.sh $DIR/install_ubuntu_dependencies.sh
$DIR/install_python_dependencies.sh $DIR/install_python_dependencies.sh
echo
echo "---- OPENPILOT SETUP DONE ----"
echo "Open a new shell or configure your active shell env by running:"
echo "source ~/.bashrc"

Loading…
Cancel
Save