aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ashcon Partovi <ashcon@partovi.net> 2022-11-10 20:14:41 -0800
committerGravatar GitHub <noreply@github.com> 2022-11-10 20:14:41 -0800
commit38141e3aa7c2db5b01a6fd9a97776f9257a10049 (patch)
tree4c4c7fd955d8a3f551dca9f4d61a6334d5c7f14f
parent5f5ef81f11403c399fc57f0fd3dc6b2dd85e492e (diff)
downloadbun-38141e3aa7c2db5b01a6fd9a97776f9257a10049.tar.gz
bun-38141e3aa7c2db5b01a6fd9a97776f9257a10049.tar.zst
bun-38141e3aa7c2db5b01a6fd9a97776f9257a10049.zip
Allow install script to specify debug-info variant with debug symbols (#1484)
-rw-r--r--src/cli/install.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cli/install.sh b/src/cli/install.sh
index b9cc03cd3..46b6652d4 100644
--- a/src/cli/install.sh
+++ b/src/cli/install.sh
@@ -52,8 +52,8 @@ success() {
command -v unzip >/dev/null ||
error 'unzip is required to install bun (see: https://github.com/oven-sh/bun#unzip-is-required)'
-if [[ $# -gt 1 ]]; then
- error 'Too many arguments, only 1 is allowed, which can be a specific tag of bun to install (e.g. "bun-v0.1.4")'
+if [[ $# -gt 2 ]]; then
+ error 'Too many arguments, only 2 are allowed. The first can be a specific tag of bun to install. (e.g. "bun-v0.1.4") The second can be a build variant of bun to install. (e.g. "debug-info")'
fi
case $(uname -ms) in
@@ -98,6 +98,14 @@ if [[ $target = linux-x64 ]]; then
fi
fi
+exe_name=bun
+
+if [[ $# = 2 && $2 = debug-info ]]; then
+ target=$target-profile
+ exe_name=bun-profile
+ info "You requested a debug build of bun. More infomation will be shown if a crash occurs."
+fi
+
if [[ $# = 0 ]]; then
bun_uri=$github_repo/releases/latest/download/bun-$target.zip
else
@@ -122,7 +130,7 @@ curl --fail --location --progress-bar --output "$exe.zip" "$bun_uri" ||
unzip -oqd "$bin_dir" "$exe.zip" ||
error 'Failed to extract bun'
-mv "$bin_dir/bun-$target/bun" "$exe" ||
+mv "$bin_dir/bun-$target/$exe_name" "$exe" ||
error 'Failed to move extracted bun to destination'
chmod +x "$exe" ||