Skip to content

Commit d163a37

Browse files
committed
fix install script
1 parent cac2ea4 commit d163a37

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/scripts/install-sdk.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,37 @@ INSTALL_LOCATION=$(eval "echo $ORB_EVAL_INSTALL_LOCATION")
55
function install_flutter() {
66
local machine=${1:-"Linux"}
77
local arch=${2:-"amd64"}
8+
89
[[ $machine == "Darwin" ]] && uname=macos || uname=linux
9-
[[ $arch == "arm64" ]] && version="flutter_${uname}_arm64" || version="flutter_${uname}"
10+
[[ $arch =~ "arm64" ]] && version="flutter_${uname}_arm64" || version="flutter_${uname}"
1011
[[ $uname == "linux" ]] && suffix="tar.xz" || suffix="zip"
1112

1213
baseurl="https://storage.googleapis.com/flutter_infra_release/releases/stable"
13-
1414
fullurl="$baseurl/$uname/${version}_$ORB_VAL_FLUTTER_SDK_VERSION-stable.${suffix}"
1515

1616
curl -o "flutter_sdk.${suffix}" "$fullurl"
17+
18+
mkdir -p $INSTALL_LOCATION
19+
20+
if [ $suffix == "tar.xz" ]; then
21+
tar xf flutter_sdk.tar.xz -C "$INSTALL_LOCATION"
22+
else
23+
unzip -oqq flutter_sdk.zip -d "$INSTALL_LOCATION"
24+
fi
25+
26+
rm -f "flutter_sdk.${suffix}"
1727
}
1828

19-
install_flutter "$(uname)" "$(uname -a)"
29+
30+
if ! command -v flutter &> /dev/null; then
31+
install_flutter "$(uname)" "$(uname -m)"
32+
else
33+
echo "Previous Flutter installation detected: $(eval command -v flutter)"
34+
exit 0
35+
fi
2036

2137
echo "export PATH=$INSTALL_LOCATION/flutter/bin:\$PATH" >> "$BASH_ENV"
2238

2339
# shellcheck source=/dev/null
2440
source "$BASH_ENV"
2541
which flutter
26-

0 commit comments

Comments
 (0)