From 3d8537ab23197a383fd1dd7082329ddee1acfdb7 Mon Sep 17 00:00:00 2001 From: Gijs Koning Date: Fri, 18 Mar 2022 22:07:39 +0100 Subject: [PATCH] Update carla script to easier install docker and nvidia-docker (#23986) * Easier docker and nvidia-docker install in carla script * Small cleanup * cleanuo * cleanup * More comments * Remove adding usergroup step --- tools/sim/start_carla.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/sim/start_carla.sh b/tools/sim/start_carla.sh index 6418dacaee7bb8..8b2725950723b1 100755 --- a/tools/sim/start_carla.sh +++ b/tools/sim/start_carla.sh @@ -2,16 +2,16 @@ # Requires nvidia docker - https://github.com/NVIDIA/nvidia-docker if ! $(apt list --installed | grep -q nvidia-container-toolkit); then - if [ -z "$INSTALL" ]; then - echo "Nvidia docker is required. Re-run with INSTALL=1 to automatically install." - exit 0 - else + read -p "Nvidia docker is required. Do you want to install it now? (y/n)"; + if [ "${REPLY}" == "y" ]; then distribution=$(. /etc/os-release;echo $ID$VERSION_ID) echo $distribution curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list - sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit + sudo apt-get update && sudo apt-get install -y nvidia-docker2 # Also installs docker-ce and nvidia-container-toolkit sudo systemctl restart docker + else + exit 0 fi fi