Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(install): update install script to support more OS types #1244

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions downloads/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,28 @@ case $UNAME_ARC in
;;
esac

# If OS uses musl, set distinct OS type to ensure the binary
# with statically linked libraries and dependencies is used
if command -v ldd >/dev/null 2>&1 && [[ "$(ldd /bin/ls | grep -m1 'musl')" ]]; then
OSTYPE="linux-musl"
fi

case $OSTYPE in
"linux-gnu"*)
OS="linux"
STATIC="false"
kate-goldenring marked this conversation as resolved.
Show resolved Hide resolved
;;
"darwin"*)
OS="macos"
STATIC="false"
;;
"linux-musl"*)
OS="linux"
STATIC="true"
;;
"linux"*)
OS="linux"
STATIC="false"
;;
*)
fancy_print 1 "The OSTYPE: ${OSTYPE} is not supported by this script."
Expand All @@ -109,17 +125,21 @@ if [[ $VERSION = "" ]]; then
fi

# Constructing download FILE and URL
FILE="spin-${VERSION}-${OS}-${ARC}.tar.gz"
if [[ $STATIC = "true" ]]; then
FILE="spin-${VERSION}-static-${OS}-${ARC}.tar.gz"
else
FILE="spin-${VERSION}-${OS}-${ARC}.tar.gz"
fi
URL="https://github.com/fermyon/spin/releases/download/${VERSION}/${FILE}"

# Establish the location of current working environment
current_dir=$(pwd)

# Define Spin directory name
spin_directory_name=("/spin")
spin_directory_name="/spin"

if [ -d "${current_dir}${spin_directory_name}" ]; then
fancy_print 1 "Error: .${spin_directory_name} already exists, please delete ${current_dir}${spin_directory_name} and run the installer again."
if [ -d "${current_dir}$spin_directory_name" ]; then
fancy_print 1 "Error: .$spin_directory_name already exists, please delete ${current_dir}$spin_directory_name and run the installer again."
exit 1
fi

Expand Down
Loading