|
| 1 | +#!/usr/bin/env bash |
| 2 | +# https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/Cloud/setup_apptainer.sh |
| 3 | + |
| 4 | +#-------------------------------------------------------# |
| 5 | +#Install |
| 6 | +export DEBIAN_FRONTEND="noninteractive" |
| 7 | +echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections |
| 8 | +command -v apt-fast &>/dev/null || echo -e "\[X] FATAL: apt-fast is NOT Installed\n$(exit 1)" |
| 9 | +BASE_PKGS=(bash binutils coreutils cryptsetup curl fakeroot findutils file g++ git grep jq libc-dev libseccomp-dev moreutils patchelf rsync sed strace tar tree tzdata xz-utils zstd) |
| 10 | +for pkg in "${BASE_PKGS[@]}"; do DEBIAN_FRONTEND="noninteractive" sudo apt-fast install "${pkg}" -y --ignore-missing 2>/dev/null; done |
| 11 | +sudo apt --fix-broken install |
| 12 | +sudo apt autoremove -y -qq |
| 13 | +sudo apt autoclean -y -qq |
| 14 | +pushd &>/dev/null &&\ |
| 15 | + curl -qfsSL "https://api.gh.pkgforge.dev/repos/apptainer/apptainer/releases/latest?per_page=100" | jq -r ".. | objects | .browser_download_url? // empty" | grep -Ei "amd64" |\ |
| 16 | + grep -Eiv "tar\.gz|\.b3sum" | grep -Eiv "dbg|debug|suid" | grep -Ei "deb" | sort --version-sort | tail -n 1 | tr -d "[:space:]" | xargs -I "{}" curl -qfsSL "{}" -o "./apptainer.deb" |
| 17 | + sudo chmod -v "a+x" "./apptainer.deb" |
| 18 | + sudo dpkg -i "./apptainer.deb" || sudo apt --fix-broken install && sudo dpkg -i "./apptainer.deb" |
| 19 | + command -v apptainer &>/dev/null || echo -e "\[X] FATAL: apptainer is NOT Installed\n$(exit 1)" |
| 20 | + sudo apt autoremove -y -qq |
| 21 | + sudo apt autoclean -y -qq |
| 22 | +popd &>/dev/null |
| 23 | +#-------------------------------------------------------# |
| 24 | + |
| 25 | +#-------------------------------------------------------# |
| 26 | +#Pull & Prep Containers |
| 27 | +sudo rm -rf "/containers" 2>/dev/null |
| 28 | +sudo mkdir -pv "/containers" && sudo chown -R "colab:colab" "/containers" |
| 29 | +sudo chmod -R 755 "/containers" |
| 30 | +sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/alpine.sif" "docker://docker.io/alpine:edge" |
| 31 | +du -sh "/containers/alpine.sif" |
| 32 | +sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/alpine-builder.sif" "docker://ghcr.io/pkgforge/devscripts/alpine-builder:latest" |
| 33 | +du -sh "/containers/alpine-builder.sif" |
| 34 | +sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/debian.sif" "docker://docker.io/debian:latest" |
| 35 | +du -sh "/containers/debian.sif" |
| 36 | +sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/debian-builder-unstable.sif" "docker://ghcr.io/pkgforge/devscripts/debian-builder-unstable:$(uname -m)" |
| 37 | +du -sh "/containers/debian-builder-unstable.sif" |
| 38 | +ls -lah "/containers" |
| 39 | +#-------------------------------------------------------# |
0 commit comments