-
Notifications
You must be signed in to change notification settings - Fork 0
/
bin.sh
executable file
·71 lines (70 loc) · 2.13 KB
/
bin.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Provides multi-arch xrDebug binary for Linux and macOS
#!/usr/bin/env bash
set -e
cat <<'EOM'
____ _
__ ___ __| _ \ ___| |__ _ _ __ _
\ \/ / '__| | | |/ _ \ '_ \| | | |/ _` |
> <| | | |_| | __/ |_) | |_| | (_| |
/_/\_\_| |____/ \___|_.__/ \__,_|\__, |
|___/
EOM
ARTIFACT_BASE_URL="https://github.com/xrdebug/xrdebug/releases/latest/download/"
MAC_BINARY_ARM64="${ARTIFACT_BASE_URL}xrdebug-macos-arm64.pkg"
MAC_BINARY_X86_64="${ARTIFACT_BASE_URL}xrdebug-macos-x86_64.pkg"
LINUX_BINARY_AARCH64="${ARTIFACT_BASE_URL}xrdebug-linux-aarch64.tar.gz"
LINUX_BINARY_X86_64="${ARTIFACT_BASE_URL}xrdebug-linux-x86_64.tar.gz"
useArchitecture=$(uname -m)
useSystem=$(uname -s)
architecture=""
system=""
case "${useArchitecture}" in
x86_64) architecture="amd64" ;;
arm64) architecture="arm64" ;;
aarch64) architecture="arm64" ;;
esac
case "${useSystem}" in
Linux*) system=Linux ;;
Darwin*) system=Mac ;;
*) ;;
esac
if [ -z "${architecture}" ]; then
echo "[!] Unsupported architecture [${useArchitecture}]"
exit 1
fi
if [ -z "${system}" ]; then
echo "[!] Unsupported system [${useSystem}]"
exit 1
fi
echo "* Requesting xrDebug for ${system} [${architecture}]"
if [ "${system}" = "Linux" ]; then
if [ "${architecture}" = "arm64" ]; then
DOWNLOAD_URL=${LINUX_BINARY_AARCH64}
fi
if [ "${architecture}" = "amd64" ]; then
DOWNLOAD_URL=${LINUX_BINARY_X86_64}
fi
fi
if [ "${system}" = "Mac" ]; then
if [ "${architecture}" = "arm64" ]; then
DOWNLOAD_URL=${MAC_BINARY_ARM64}
fi
if [ "${architecture}" = "amd64" ]; then
DOWNLOAD_URL=${MAC_BINARY_X86_64}
fi
fi
echo "* Downloading ${DOWNLOAD_URL}"
curl -sLO ${DOWNLOAD_URL}
echo "* Download complete"
if [ "${system}" = "Linux" ]; then
echo "* Extracting xrdebug-linux-*.tar.gz"
tar -xvf xrdebug-linux-*.tar.gz
echo "* Setting xrdebug as executable"
chmod +x xrdebug
echo "* Moving xrdebug to /usr/local/bin"
mv xrdebug /usr/local/bin/xrdebug
fi
if [ "${system}" = "Mac" ]; then
echo "* Opening xrdebug-macos-*.pkg to continue installation"
open xrdebug-macos-*.pkg
fi