-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathInstallDebugTools.sh
More file actions
67 lines (62 loc) · 2.48 KB
/
Copy pathInstallDebugTools.sh
File metadata and controls
67 lines (62 loc) · 2.48 KB
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
#!/bin/sh
# Echo commands
set -x
# Exit on error
set -e
# Install VS debug tools to /vsdbg
# https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-dotnet-core-linux-with-ssh
# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes
echo "Installing VS debug tools to /vsdbg"
wget -O ./getvsdbg.sh https://aka.ms/getvsdbgsh
chmod ug=rwx,o=rx getvsdbg.sh
./getvsdbg.sh -v latest -l /vsdbg
rm -f getvsdbg.sh
# Get the RID for this OS using the same technique as used by getvsdbg.sh get_dotnet_runtime_id()
__RuntimeID=
get_dotnet_runtime_id()
{
if [ "$(uname)" = "Darwin" ]; then
if [ "$(uname -m)" = "arm64" ]; then
__RuntimeID=osx-arm64
else
__RuntimeID=osx-x64
fi
elif [ "$(uname -m)" = "x86_64" ]; then
__RuntimeID=linux-x64
if [ -e /etc/os-release ]; then
# '.' is the same as 'source' but is POSIX compliant
. /etc/os-release
if [ "$ID" = "alpine" ]; then
__RuntimeID=linux-musl-x64
fi
fi
elif [ "$(uname -m)" = "armv7l" ]; then
__RuntimeID=linux-arm
elif [ "$(uname -m)" = "aarch64" ]; then
__RuntimeID=linux-arm64
if [ -e /etc/os-release ]; then
# '.' is the same as 'source' but is POSIX compliant
. /etc/os-release
if [ "$ID" = "alpine" ]; then
__RuntimeID=linux-musl-arm64
# Check to see if we have dpkg to get the real architecture on debian based linux OS.
elif hash dpkg 2>/dev/null; then
# Raspbian 32-bit will return aarch64 in 'uname -m', but it can only use the linux-arm debugger
if [ "$(dpkg --print-architecture)" = "armhf" ]; then
echo 'Info: Overriding Runtime ID from linux-arm64 to linux-arm'
__RuntimeID=linux-arm
fi
fi
fi
fi
}
get_dotnet_runtime_id
# Install .NET diagnostic tools to /dotnet-tools
# https://learn.microsoft.com/en-us/dotnet/core/diagnostics/tools-overview
# https://github.com/dotnet/diagnostics/blob/main/documentation/single-file-tools.md
echo "Installing .NET diagnostic tools for $__RuntimeID to /dotnet-tools"
mkdir -p /dotnet-tools
wget -O /dotnet-tools/dotnet-counters https://aka.ms/dotnet-counters/$__RuntimeID
chmod ug=rwx,o=rx /dotnet-tools/dotnet-counters
wget -O /dotnet-tools/dotnet-dump https://aka.ms/dotnet-dump/$__RuntimeID
chmod ug=rwx,o=rx /dotnet-tools/dotnet-dump