18325: adapt for naming differences in kernel/headers packages between
authorWard Vandewege <ward@curii.com>
Mon, 20 Dec 2021 15:32:20 +0000 (10:32 -0500)
committerWard Vandewege <ward@curii.com>
Mon, 20 Dec 2021 18:18:51 +0000 (13:18 -0500)
       Debian and Ubuntu.

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

tools/compute-images/arvados-images-aws.json
tools/compute-images/arvados-images-azure.json
tools/compute-images/scripts/base.sh

index 55fe3815ccb82d37407b87b5ccdd51a0a2b0a710..23b7832fcba455b4e9ed3fe13a504eb4644fd4d1 100644 (file)
@@ -84,6 +84,6 @@
     "type": "shell",
     "execute_command": "sudo -S env {{ .Vars }} /bin/bash '{{ .Path }}'",
     "script": "scripts/base.sh",
-    "environment_vars": ["RESOLVER={{user `resolver`}}","REPOSUFFIX={{user `reposuffix`}}","MKSQUASHFS_MEM={{user `mksquashfs_mem`}}","NVIDIA_GPU_SUPPORT={{user `nvidia_gpu_support`}}"]
+    "environment_vars": ["RESOLVER={{user `resolver`}}","REPOSUFFIX={{user `reposuffix`}}","MKSQUASHFS_MEM={{user `mksquashfs_mem`}}","NVIDIA_GPU_SUPPORT={{user `nvidia_gpu_support`}}","CLOUD=aws"]
   }]
 }
index 46a11c0bc9bd6cfbee632e01500aa39a0bd9ae7f..e303b022b5fd73675e7e50c7735a3465c2871067 100644 (file)
@@ -67,6 +67,6 @@
     "type": "shell",
     "execute_command": "sudo -S env {{ .Vars }} /bin/bash '{{ .Path }}'",
     "script": "scripts/base.sh",
-    "environment_vars": ["RESOLVER={{user `resolver`}}","REPOSUFFIX={{user `reposuffix`}}","MKSQUASHFS_MEM={{user `mksquashfs_mem`}}","NVIDIA_GPU_SUPPORT={{user `nvidia_gpu_support`}}"]
+    "environment_vars": ["RESOLVER={{user `resolver`}}","REPOSUFFIX={{user `reposuffix`}}","MKSQUASHFS_MEM={{user `mksquashfs_mem`}}","NVIDIA_GPU_SUPPORT={{user `nvidia_gpu_support`}}","CLOUD=azure"]
   }]
 }
index 2ad9818d07cc905807d5c3df1fec18ae4c528ae2..f407b366c0bc433fe04324392b99b4a3eaadbf7f 100644 (file)
@@ -151,9 +151,16 @@ $SUDO mv /tmp/etc-cloud-cloud.cfg.d-07_compute_arvados_dispatch_cloud.cfg /etc/c
 $SUDO chown root:root /etc/cloud/cloud.cfg.d/07_compute_arvados_dispatch_cloud.cfg
 
 if [ "$NVIDIA_GPU_SUPPORT" == "1" ]; then
+  # $DIST should not have a dot if there is one in /etc/os-release (e.g. 18.04)
   DIST=$(. /etc/os-release; echo $ID$VERSION_ID | tr -d '.')
   # We need a kernel and matching headers
-  $SUDO apt-get -y install linux-image-cloud-amd64 linux-headers-cloud-amd64
+  if [[ "$DIST" =~ ^debian ]]; then
+    $SUDO apt-get -y install linux-image-cloud-amd64 linux-headers-cloud-amd64
+  elif [ "$CLOUD" == "azure" ]; then
+    $SUDO apt-get -y install linux-image-azure linux-headers-azure
+  elif [ "$CLOUD" == "aws" ]; then
+    $SUDO apt-get -y install linux-image-aws linux-headers-aws
+  fi
 
   # Install CUDA
   $SUDO apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$DIST/x86_64/7fa2af80.pub
@@ -175,6 +182,8 @@ if [ "$NVIDIA_GPU_SUPPORT" == "1" ]; then
       $SUDO tee /etc/apt/sources.list.d/libnvidia-container.list
     $SUDO sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/libnvidia-container.list
   else
+    # here, $DIST should have a dot if there is one in /etc/os-release (e.g. 18.04)...
+    DIST=$(. /etc/os-release; echo $ID$VERSION_ID)
     curl -s -L https://nvidia.github.io/libnvidia-container/$DIST/libnvidia-container.list | \
       $SUDO tee /etc/apt/sources.list.d/libnvidia-container.list
   fi