Skip to content

Commit 4de1102

Browse files
kate-goldenringitowlson
authored andcommitted
fix(install): update install script to support more OS types
Signed-off-by: Kate Goldenring <[email protected]>
1 parent 97e338c commit 4de1102

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

downloads/install.sh

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,28 @@ case $UNAME_ARC in
8989
;;
9090
esac
9191

92+
# If OS uses musl, set distinct OS type to ensure the binary
93+
# with statically linked libraries and dependencies is used
94+
if command -v ldd >/dev/null 2>&1 && [[ "$(ldd /bin/ls | grep -m1 'musl')" ]]; then
95+
OSTYPE="linux-musl"
96+
fi
97+
9298
case $OSTYPE in
9399
"linux-gnu"*)
94100
OS="linux"
101+
STATIC="false"
95102
;;
96103
"darwin"*)
97104
OS="macos"
105+
STATIC="false"
106+
;;
107+
"linux-musl"*)
108+
OS="linux"
109+
STATIC="true"
110+
;;
111+
"linux"*)
112+
OS="linux"
113+
STATIC="false"
98114
;;
99115
*)
100116
fancy_print 1 "The OSTYPE: ${OSTYPE} is not supported by this script."
@@ -109,17 +125,21 @@ if [[ $VERSION = "" ]]; then
109125
fi
110126

111127
# Constructing download FILE and URL
112-
FILE="spin-${VERSION}-${OS}-${ARC}.tar.gz"
128+
if [[ $STATIC = "true" ]]; then
129+
FILE="spin-${VERSION}-static-${OS}-${ARC}.tar.gz"
130+
else
131+
FILE="spin-${VERSION}-${OS}-${ARC}.tar.gz"
132+
fi
113133
URL="https://github.com/spinframework/spin/releases/download/${VERSION}/${FILE}"
114134

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

118138
# Define Spin directory name
119-
spin_directory_name=("/spin")
139+
spin_directory_name="/spin"
120140

121-
if [ -d "${current_dir}${spin_directory_name}" ]; then
122-
fancy_print 1 "Error: .${spin_directory_name} already exists, please delete ${current_dir}${spin_directory_name} and run the installer again."
141+
if [ -d "${current_dir}$spin_directory_name" ]; then
142+
fancy_print 1 "Error: .$spin_directory_name already exists, please delete ${current_dir}$spin_directory_name and run the installer again."
123143
exit 1
124144
fi
125145

0 commit comments

Comments
 (0)