#!/bin/sh # This script is meant to be invoked with VERSION given as a parameter. # Installs the given version of minimesos on the box { # Prevent execution if the script is only partially downloaded command_exists() { command -v "$@" > /dev/null 2>&1 } if ! command_exists curl; then echo "Please install curl to fetch the minimesos files" exit 1 fi if [ ! "$#" -eq 1 ]; then echo "Version is not given as parameter" exit 1 fi INSTALL_LOCATION=$HOME/.minimesos/bin VERSION=$1 echo "Installing version " $VERSION mkdir -p $INSTALL_LOCATION curl -sSL https://raw.githubusercontent.com/ContainerSolutions/minimesos/$VERSION/bin/minimesos > $INSTALL_LOCATION/minimesos chmod +x $INSTALL_LOCATION/minimesos if [ -f "/usr/local/bin/minimesos" ]; then echo "Found an old version of minimesos, please remove it:" && echo echo "rm -f /usr/local/bin/minimesos" && echo fi echo "minimesos is installed into ${INSTALL_LOCATION}/minimesos" echo "Run the following command to add it to your executables path:" && echo echo "export PATH=\$PATH:$INSTALL_LOCATION" exit 0 } # Prevent execution if the script is only partially downloaded