setup.sh: work in non interactive mode (#33162)

* work without terminal

* failure message

* no if
old-commit-hash: 3e66827a85
This commit is contained in:
Maxime Desroches
2024-07-31 20:32:41 -07:00
committed by GitHub
parent 0d9b5627f2
commit ea71f07ea7
2 changed files with 14 additions and 9 deletions

View File

@@ -73,9 +73,14 @@ function check_dir() {
return 1
fi
# already a "valid" openpilot clone, skip cloning again
if [[ ! -z "$(ls -A $OPENPILOT_ROOT)" ]]; then
SKIP_GIT_CLONE=1
fi
# by default, don't try installing in already existing directory
if [[ -z $INTERACTIVE ]]; then
return 1
return 0
fi
read -p " Would you like to attempt installation anyway? [Y/n] " -n 1 -r
@@ -84,11 +89,6 @@ function check_dir() {
return 1
fi
# already a "valid" openpilot clone, skip cloning again
if [[ ! -z "$(ls -A $OPENPILOT_ROOT)" ]]; then
SKIP_GIT_CLONE=1
fi
return 0
fi
@@ -123,10 +123,10 @@ function git_clone() {
function install_with_op() {
cd $OPENPILOT_ROOT
$OPENPILOT_ROOT/tools/op.sh install
$OPENPILOT_ROOT/tools/op.sh setup
$OPENPILOT_ROOT/tools/op.sh setup || (echo -e "\n[${RED}${NC}] failed to install openpilot!" && return 1)
echo -e "\n----------------------------------------------------------------------"
echo -e "openpilot was successfully installed into ${BOLD}$OPENPILOT_ROOT${NC}"
echo -e "[${GREEN}${NC}] openpilot was successfully installed into ${BOLD}$OPENPILOT_ROOT${NC}"
echo -e "Checkout the docs at https://docs.comma.ai"
echo -e "Checkout how to contribute at https://github.com/commaai/openpilot/blob/master/docs/CONTRIBUTING.md"
}