-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathstubdl
More file actions
executable file
·30 lines (25 loc) · 882 Bytes
/
Copy pathstubdl
File metadata and controls
executable file
·30 lines (25 loc) · 882 Bytes
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
#!/bin/sh
ARCH="$(uname -m)"
case "$ARCH" in
x86_64|amd64) ARCH="amd64" ;;
aarch64|arm64) ARCH="arm64" ;;
riscv64) ARCH="riscv64" ;;
loongarch64|loong64) ARCH="loong64" ;;
*) echo "dbin: unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
DEST="${TMPDIR:-/tmp}/.dbin_$ARCH"
URL="https://github.com/xplshn/dbin/releases/download/1.7/dbin_$ARCH"
[ "$ARCH" = "amd64" ] || [ "$ARCH" = "arm64" ] && URL="$URL.upx"
[ "$1" = "--install" ] && { DEST="$2"; shift 2; }
if [ ! -x "$DEST" ]; then
if command -v curl >/dev/null 2>&1; then
curl -fsSL "$URL" -o "$DEST" || exit 1
elif command -v wget >/dev/null 2>&1; then
wget -q "$URL" -O "$DEST" || exit 1
else
echo "dbin: curl or wget required" >&2; exit 1
fi
chmod +x "$DEST"
[ "$1" = "--install" ] && { echo "dbin: installed to $DEST"; exit 0; }
fi
exec "$DEST" "$@"