Skip to content

Commit d25560c

Browse files
committed
use local copy of bun
1 parent 0857cf4 commit d25560c

File tree

2 files changed

+23
-31
lines changed

2 files changed

+23
-31
lines changed

gib.sh

+22-30
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,39 @@
2727

2828
{ # this ensures the entire script is downloaded #
2929

30-
set -e # exit on err
30+
set -euo pipefail # exit on err
3131

32-
echo -ne "\033[K ⏳ Setting up bun..."
32+
gib_version=v0.7.7
33+
bun_version=bun-v1.2.2
34+
gib_dir=${!GIB_INSTALL:-$HOME/.gib}
3335

34-
# ensure bun is installed
35-
if ! command -v bun >/dev/null; then
36-
# ensure bun env vars are set
37-
if [ -z "$BUN_INSTALL" ]; then
38-
export BUN_INSTALL="$HOME/.bun"
39-
fi
36+
while getopts :v: arg; do
37+
case $arg in
38+
v) gib_version=$OPTARG ;;
39+
esac
40+
done
4041

41-
curl -fsSL https://bun.sh/install | bash &>/dev/null
42+
echo -ne "\033[K ⏳ Preparing to launch gib..."
4243

43-
case ":$PATH:" in
44-
*":$BUN_INSTALL:"*) ;;
45-
*) export PATH="$BUN_INSTALL/bin:$PATH" ;;
46-
esac
44+
bun_dir=${gib_dir}/env/bun
45+
bun=${bun_dir}/bin/bun
46+
47+
# ensure bun is installed
48+
if ! command -v $bun >/dev/null; then
49+
(
50+
export BUN_INSTALL=$bun_dir
51+
export SHELL=""
52+
curl -fsSL https://bun.sh/install | bash -s $bun_version &>/dev/null
53+
)
4754

4855
# check for bun command and let user know if not found
49-
if ! command -v bun >/dev/null; then
56+
if ! command -v $bun >/dev/null; then
5057
echo -e "\r\033[K ❌ Installing bun failed"
51-
echo "Bun not found in PATH!"
52-
echo "Please reload your terminal and run this script again."
5358
exit 1
5459
fi
5560
fi
5661

57-
echo -ne "\r\033[K ⏳ Preparing to launch gib..."
58-
59-
if ! bun pm cache rm -g &>/dev/null; then
60-
bun i noop -g &>/dev/null
61-
bun rm noop -g &>/dev/null
62-
bun pm cache rm -g &>/dev/null
63-
fi
64-
6562
echo -ne "\r\033[2K"
6663

67-
package=toebeann/gib
68-
if [ -n "${GIB_VERSION}" ]; then
69-
package=${package}\#${GIB_VERSION}
70-
fi
71-
72-
bun x --bun ${package}
64+
$bun x --bun github:toebeann/gib#${!GIB_VERSION:-$gib_version} -- $@
7365
} # this ensures the entire script is downloaded #

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "gib",
4-
"version": "0.7.6",
4+
"version": "0.7.7",
55
"description": "A TUI application for automating the installation of BepInEx",
66
"license": "ISC",
77
"author": "Tobey Blaber",

0 commit comments

Comments
 (0)