21552: Updates autoscale-ebs commit hash to install the latest fix.
[arvados.git] / tools / compute-images / scripts / base.sh
index 5890eeea066741089ea12aa323b3d42de785b108..370c3f3a3a2794b4889adc545db556a56958d3e6 100644 (file)
@@ -68,8 +68,7 @@ wait_for_apt_locks && $SUDO DEBIAN_FRONTEND=noninteractive apt-get -qq --yes ins
   libcurl4-openssl-dev \
   lvm2 \
   cryptsetup \
-  xfsprogs \
-  squashfs-tools
+  xfsprogs
 
 # Install the Arvados packages we need
 wait_for_apt_locks && $SUDO DEBIAN_FRONTEND=noninteractive apt-get -qq --yes install \
@@ -81,17 +80,17 @@ wait_for_apt_locks && $SUDO DEBIAN_FRONTEND=noninteractive apt-get -qq --yes ins
 dockerversion=5:20.10.13~3-0
 if [[ "$DIST" =~ ^debian ]]; then
   family="debian"
-  if [ "$DIST" == "debian10" ]; then
-    distro="buster"
-  elif [ "$DIST" == "debian11" ]; then
+  if [ "$DIST" == "debian11" ]; then
     distro="bullseye"
+  elif [ "$DIST" == "debian12" ]; then
+    distro="bookworm"
   fi
 elif [[ "$DIST" =~ ^ubuntu ]]; then
   family="ubuntu"
-  if [ "$DIST" == "ubuntu1804" ]; then
-    distro="bionic"
-  elif [ "$DIST" == "ubuntu2004" ]; then
+  if [ "$DIST" == "ubuntu2004" ]; then
     distro="focal"
+  elif [ "$DIST" == "ubuntu2204" ]; then
+    distro="jammy"
   fi
 else
   echo "Unsupported distribution $DIST"
@@ -114,34 +113,6 @@ $SUDO systemctl daemon-reload
 # and the BootProbeCommand might be "docker ps -q"
 $SUDO systemctl disable docker
 
-# Get Go and build singularity
-mkdir -p /var/lib/arvados
-rm -rf /var/lib/arvados/go/
-curl -s https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz | tar -C /var/lib/arvados -xzf -
-ln -sf /var/lib/arvados/go/bin/* /usr/local/bin/
-
-singularityversion=3.10.4
-curl -Ls https://github.com/sylabs/singularity/archive/refs/tags/v${singularityversion}.tar.gz | tar -C /var/lib/arvados -xzf -
-cd /var/lib/arvados/singularity-${singularityversion}
-
-# build dependencies for singularity
-wait_for_apt_locks && $SUDO DEBIAN_FRONTEND=noninteractive apt-get -qq --yes install \
-  make build-essential libssl-dev uuid-dev cryptsetup
-
-echo $singularityversion > VERSION
-./mconfig --prefix=/var/lib/arvados
-make -C ./builddir
-make -C ./builddir install
-ln -sf /var/lib/arvados/bin/* /usr/local/bin/
-
-# set `mksquashfs mem` in the singularity config file if it is configured
-if [ "$MKSQUASHFS_MEM" != "" ]; then
-  echo "mksquashfs mem = ${MKSQUASHFS_MEM}" >> /var/lib/arvados/etc/singularity/singularity.conf
-fi
-
-# Print singularity version installed
-singularity --version
-
 # Remove unattended-upgrades if it is installed
 wait_for_apt_locks && $SUDO DEBIAN_FRONTEND=noninteractive apt-get -qq --yes remove unattended-upgrades --purge
 
@@ -187,7 +158,7 @@ else
   unzip -q /tmp/awscliv2.zip -d /tmp && $SUDO /tmp/aws/install
   # Pinned to v2.4.5 because we apply a patch below
   #export EBS_AUTOSCALE_VERSION=$(curl --silent "https://api.github.com/repos/awslabs/amazon-ebs-autoscale/releases/latest" | jq -r .tag_name)
-  export EBS_AUTOSCALE_VERSION="5ca6e24e05787b8ae1184c2a10db80053ddd3038"
+  export EBS_AUTOSCALE_VERSION="ee323f0751c2b6f733692e805b51b9bf3c251bac"
   cd /opt && $SUDO git clone https://github.com/arvados/amazon-ebs-autoscale.git
   cd /opt/amazon-ebs-autoscale && $SUDO git checkout $EBS_AUTOSCALE_VERSION
 
@@ -215,8 +186,7 @@ if [ "$NVIDIA_GPU_SUPPORT" == "1" ]; then
   $SUDO apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$DIST/x86_64/3bf863cc.pub
   $SUDO apt-get -y install software-properties-common
   $SUDO add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/$DIST/x86_64/ /"
-  # Ubuntu 18.04's add-apt-repository does not understand 'contrib'
-  $SUDO add-apt-repository contrib || true
+  $SUDO add-apt-repository contrib
   $SUDO apt-get update
   $SUDO apt-get -y install cuda
 
@@ -248,4 +218,36 @@ if [ "$NVIDIA_GPU_SUPPORT" == "1" ]; then
   $SUDO systemctl disable nvidia-persistenced.service
 fi
 
+# Get Go and build singularity
+mkdir -p /var/lib/arvados
+rm -rf /var/lib/arvados/go/
+curl -s https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz | tar -C /var/lib/arvados -xzf -
+ln -sf /var/lib/arvados/go/bin/* /usr/local/bin/
+
+singularityversion=3.10.4
+cd /var/lib/arvados
+git clone --recurse-submodules https://github.com/sylabs/singularity
+cd singularity
+git checkout v${singularityversion}
+
+# build dependencies for singularity
+wait_for_apt_locks && $SUDO DEBIAN_FRONTEND=noninteractive apt-get -qq --yes install \
+                           make build-essential libssl-dev uuid-dev cryptsetup \
+                           squashfs-tools libglib2.0-dev libseccomp-dev
+
+
+echo $singularityversion > VERSION
+./mconfig --prefix=/var/lib/arvados
+make -C ./builddir
+make -C ./builddir install
+ln -sf /var/lib/arvados/bin/* /usr/local/bin/
+
+# set `mksquashfs mem` in the singularity config file if it is configured
+if [ "$MKSQUASHFS_MEM" != "" ]; then
+  echo "mksquashfs mem = ${MKSQUASHFS_MEM}" >> /var/lib/arvados/etc/singularity/singularity.conf
+fi
+
+# Print singularity version installed
+singularity --version
+
 $SUDO apt-get clean