Skip to content

Commit 8628c47

Browse files
authored
saner
1 parent 1d6b904 commit 8628c47

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

Misc/Cloud/setup_apptainer_colab.sh

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#Install
66
export DEBIAN_FRONTEND="noninteractive"
77
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)"
8+
command -v apt-fast &>/dev/null || echo -e "\n[X] FATAL: apt-fast is NOT Installed\n$(exit 1)"
99
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)
1010
for pkg in "${BASE_PKGS[@]}"; do DEBIAN_FRONTEND="noninteractive" sudo apt-fast install "${pkg}" -y --ignore-missing 2>/dev/null; done
1111
sudo apt --fix-broken install
@@ -24,24 +24,28 @@ pushd &>/dev/null
2424
done
2525
sudo chmod -v "a+x" "./apptainer.deb"
2626
sudo dpkg -i "./apptainer.deb" || sudo apt --fix-broken install && sudo dpkg -i "./apptainer.deb"
27-
command -v apptainer &>/dev/null || echo -e "\[X] FATAL: apptainer is NOT Installed\n$(exit 1)"
2827
sudo apt autoremove -y -qq
2928
sudo apt autoclean -y -qq
3029
popd &>/dev/null
3130
#-------------------------------------------------------#
3231

3332
#-------------------------------------------------------#
3433
#Pull & Prep Containers
35-
sudo rm -rf "/containers" 2>/dev/null
36-
sudo mkdir -pv "/containers" && sudo chown -R "colab:colab" "/containers"
37-
sudo chmod -R 755 "/containers"
38-
sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/alpine.sif" "docker://docker.io/alpine:edge"
39-
du -sh "/containers/alpine.sif"
40-
sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/alpine-builder.sif" "docker://ghcr.io/pkgforge/devscripts/alpine-builder:latest"
41-
du -sh "/containers/alpine-builder.sif"
42-
sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/debian.sif" "docker://docker.io/debian:latest"
43-
du -sh "/containers/debian.sif"
44-
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)"
45-
du -sh "/containers/debian-builder-unstable.sif"
46-
ls -lah "/containers"
34+
if command -v apptainer &> /dev/null; then
35+
sudo rm -rf "/containers" 2>/dev/null
36+
sudo mkdir -pv "/containers" && sudo chown -R "colab:colab" "/containers"
37+
sudo chmod -R 755 "/containers"
38+
sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/alpine.sif" "docker://docker.io/alpine:edge"
39+
du -sh "/containers/alpine.sif"
40+
sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/alpine-builder.sif" "docker://ghcr.io/pkgforge/devscripts/alpine-builder:latest"
41+
du -sh "/containers/alpine-builder.sif"
42+
sudo -u "colab" apptainer build --disable-cache --fix-perms --force --sandbox "/containers/debian.sif" "docker://docker.io/debian:latest"
43+
du -sh "/containers/debian.sif"
44+
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)"
45+
du -sh "/containers/debian-builder-unstable.sif"
46+
ls -lah "/containers"
47+
else
48+
echo -e "\n[X] FATAL: apptainer is NOT Installed\n"
49+
exit 1
50+
fi
4751
#-------------------------------------------------------#

0 commit comments

Comments
 (0)