- commit
- dc18187
- parent
- b5e22d7
- author
- Anto
- date
- 2026-01-04 21:31:01 +0000 UTC
Update stubdl
1 files changed,
+16,
-37
M
stubdl
M
stubdl
+16,
-37
1@@ -1,51 +1,30 @@
2 #!/bin/sh
3
4-DEST="${TMPDIR:-/tmp}/._bdlstub_dbin.bin"
5-
6-# Determine architecture
7 ARCH="$(uname -m)"
8 case "$ARCH" in
9- x86_64) ARCH_SUFFIX="amd64" ;;
10- aarch64) ARCH_SUFFIX="arm64" ;;
11- *) echo "Unsupported architecture: $ARCH"; exit 1 ;;
12+ x86_64|amd64) ARCH="amd64" ;;
13+ aarch64|arm64) ARCH="arm64" ;;
14+ riscv64) ARCH="riscv64" ;;
15+ loongarch64|loong64) ARCH="loong64" ;;
16+ *) echo "dbin: unsupported architecture: $ARCH" >&2; exit 1 ;;
17 esac
18
19-DBIN_URL="https://github.com/xplshn/dbin/releases/latest/download/dbin_${ARCH_SUFFIX}.upx"
20+DEST="${TMPDIR:-/tmp}/.dbin_$ARCH"
21+URL="https://github.com/xplshn/dbin/releases/download/1.7/dbin_$ARCH"
22+[ "$ARCH" = "amd64" ] || [ "$ARCH" = "arm64" ] && URL="$URL.upx"
23
24-# Handle --install option
25-if [ "$1" = "--install" ]; then
26- DEST="$2"
27- shift 2
28-fi
29+[ "$1" = "--install" ] && { DEST="$2"; shift 2; }
30
31-# Function to download the binary
32-download_dbin() {
33+if [ ! -x "$DEST" ]; then
34 if command -v curl >/dev/null 2>&1; then
35- curl -qfsSL "$DBIN_URL" -o "$DEST"
36+ curl -fsSL "$URL" -o "$DEST" || exit 1
37 elif command -v wget >/dev/null 2>&1; then
38- wget -q "$DBIN_URL" -O "$DEST"
39+ wget -q "$URL" -O "$DEST" || exit 1
40 else
41- echo "Neither curl nor wget are available."
42- exit 1
43+ echo "dbin: curl or wget required" >&2; exit 1
44 fi
45-}
46-
47-# Check if binary exists and is executable
48-if [ -e "$DEST" ] && [ ! "$1" = "--install" ]; then
49- # Run the binary
50- "$DEST" "$@"
51-else
52- # Download and install the binary
53- mkdir -p "$(dirname "$DEST")"
54- download_dbin
55-
56- if [ "$1" = "--install" ]; then
57- chmod +x "$DEST"
58- echo "DBIN IS NOW AVAILABLE. ($DEST)"
59- exit 0
60- fi
61-
62- # Make the binary executable and run it
63 chmod +x "$DEST"
64- "$DEST" "$@"
65+ [ "$1" = "--install" ] && { echo "dbin: installed to $DEST"; exit 0; }
66 fi
67+
68+exec "$DEST" "$@"