-
Notifications
You must be signed in to change notification settings - Fork 0
/
stubdl
37 lines (31 loc) 路 985 Bytes
/
stubdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
DEST="/tmp/._bdlstub_bigdl.bin"
ARCH="$(uname -m)"
if [ "$ARCH" = "x86_64" ]; then
ARCH_SUFFIX="amd64"
elif [ "$ARCH" = "aarch64" ]; then
ARCH_SUFFIX="arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
BIGDL="https://github.com/xplshn/bigdl/releases/latest/download/bigdl_${ARCH_SUFFIX}_upx"
if [ "$1" = "--install" ]; then
DEST="$2"
fi
if [ -e "$DEST" ] && [ ! "$1" = "--install" ]; then
"$DEST" "$@"
else
mkdir -p "$(dirname "$DEST")"
if command -v wget >/dev/null 2>&1; then
wget -q "$BIGDL" -O "$DEST"
elif command -v curl >/dev/null 2>&1; then
curl -qfsSL "$BIGDL" -o "$DEST"
else
echo "Neither wget nor curl is available."
exit 1
fi
[ -e "$DEST" ] && [ "$1" = "--install" ] && echo "BIGDL IS NOW AVAILABLE. ($DEST)"
chmod +x "$DEST"
[ ! "$1" = "--install" ] && "$DEST" "$@"
fi