File tree 2 files changed +18
-14
lines changed
2 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,11 @@ function download_version() {
12
12
local version=$1
13
13
local download_path=$2
14
14
15
- local platform
16
- platform=$( get_platform)
17
-
18
- local arch
19
- arch=$( get_arch)
15
+ local bin_target
16
+ bin_target=$( get_bin_target)
20
17
21
18
local bin_url
22
- bin_url=$( get_bin_url " $version " " $platform " " $arch " )
19
+ bin_url=$( get_bin_url " $version " " $bin_target " )
23
20
24
21
local tmpdir
25
22
tmpdir=$( get_temp_dir)
@@ -31,7 +28,7 @@ function download_version() {
31
28
echo " Downloading Bun v$version ..."
32
29
curl " ${curl_opts[@]} " -o " $tmpdir /bun.zip" " $bin_url " || fail " Couldn't download the Bun binary from $bin_url "
33
30
34
- unzip -j " $tmpdir /bun.zip" " bun- $platform - $arch /bun" -d " $download_path "
31
+ unzip -j " $tmpdir /bun.zip" " $bin_target /bun" -d " $download_path "
35
32
) || (rm -rf " $download_path " ; fail " Failed to download Bun v$version " )
36
33
}
37
34
Original file line number Diff line number Diff line change @@ -46,22 +46,29 @@ function get_arch() {
46
46
esac
47
47
}
48
48
49
- function get_bin_url() {
50
- local version=$1
51
- local platform=$2
52
- local arch=$3
49
+ function get_bin_target() {
50
+ local platform
51
+ platform=$( get_platform)
52
+
53
+ local arch
54
+ arch=$( get_arch)
53
55
54
56
local target=" $platform -$arch "
55
57
if [[ " $target " = " linux-x64" ]]; then
56
58
# See https://github.com/cometkim/asdf-bun/issues/21
57
59
if [[ " $( grep " avx2" < /proc/cpuinfo) " = " " ]]; then
58
60
target=" linux-x64-baseline"
59
61
fi
60
- fi
62
+ fi
61
63
62
- local url=" $REPO_URL /releases/download/bun-v$version /bun-$target .zip"
64
+ echo -n " bun-$target "
65
+ }
66
+
67
+ function get_bin_url() {
68
+ local version=$1
69
+ local target=$2
63
70
64
- echo -n " $url "
71
+ echo -n " $REPO_URL /releases/download/bun-v $version / $target .zip "
65
72
}
66
73
67
74
function get_source_url() {
You can’t perform that action at this time.
0 commit comments