Skip to content

Instantly share code, notes, and snippets.

@sdruskat
Last active July 2, 2019 09:00
Show Gist options
  • Save sdruskat/9aa7318bf76e072c27851c01185f371f to your computer and use it in GitHub Desktop.
Save sdruskat/9aa7318bf76e072c27851c01185f371f to your computer and use it in GitHub Desktop.
Bash script to install Singularity from GitHub releases

Install Singularity

This is a simple bash script to install Singularity.

Requirements

  • Go >= 1.11
  • build-essential
  • libssl-dev
  • uuid-dev
  • libgpgme11-dev
  • squashfs-tools
  • libseccomp-dev
  • pkg-config
#!/usr/bin/env bash
# Check if we have 2 parameters (i.e., version AND path name)
if [ "$#" == 2 ]
then
export VERSION=$1 &&
export PATHVERSION=$2
# If we have only one parameter (i.e., only version number)
elif [ "$#" == 1 ]
then
export VERSION=$1 &&
export PATHVERSION=$1
# Else display some help text and exit
else
echo "Usage:"
echo " ./install-release [version number] [optional: path name w/out 'v' (if different from version number)]"
echo ""
echo "Example: For 'https://github.com/sylabs/singularity/releases/download/v3.3.0-rc.1/singularity-3.3.0.tar.gz', use:"
echo " ./install-release.sh 3.3.0 3.3.0-rc.1"
exit 0
fi
echo "Installing Singularity version $1"
# Get local dir and save in variable
DIR=$(pwd) && \
# Get Singularity relesae from GitHub
mkdir -p $DIR/src/github.com/sylabs && \
cd $DIR/src/github.com/sylabs && \
wget https://github.com/sylabs/singularity/releases/download/v${PATHVERSION}/singularity-${VERSION}.tar.gz && \
tar -xzf singularity-${VERSION}.tar.gz && \
cd ./singularity && \
# Configure make
./mconfig && \
# Make build
make -C ./builddir && \
# Install
sudo make -C ./builddir install
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment