-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostCreateCommand.sh
More file actions
74 lines (62 loc) · 1.96 KB
/
Copy pathpostCreateCommand.sh
File metadata and controls
74 lines (62 loc) · 1.96 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
68
69
70
71
72
73
74
#!/bin/bash
function configure_git_excludes {
local devcontainer_dir repo_root exclude_file pattern
devcontainer_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(dirname -- "$devcontainer_dir")"
exclude_file="$(git -C "$repo_root" rev-parse --path-format=absolute --git-path info/exclude)"
for pattern in '/.vscode/' '/.devcontainer/' '/.agents/'; do
grep -qxF "$pattern" "$exclude_file" || printf '%s\n' "$pattern" >> "$exclude_file"
done
}
function configure_vscode {
./.devcontainer/setup-vscode.sh
if [ ! -f .vscode/c_cpp_properties.json ]; then
cat <<EOL > ".vscode/c_cpp_properties.json"
{
"configurations": [
{
"name": "Postgres Development Configuration",
"includePath": [
"\${workspaceFolder}/**",
"\${workspaceFolder}/src/include/",
"\${workspaceFolder}/Debug/src/include/"
]
}
],
"version": 4
}
EOL
fi
if [ ! -f .vscode/pgsql_hacker_helper.json ]; then
cat <<EOL > ".vscode/pgsql_hacker_helper.json"
{
"version": 3,
"typedefs": "src/tools/pgindent/typedefs.list"
}
EOL
fi
}
# https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD
function configure_coredumps {
sudo sh -c "echo 'core.%p.sig%s.%ts' > /proc/sys/kernel/core_pattern"
}
function configure_perf {
sudo sh -c "echo 0 > /proc/sys/kernel/kptr_restrict"
sudo su -c "echo -1 > /proc/sys/kernel/perf_event_paranoid"
if [ ! -d /opt/freedom/tools/FlameGraph ]; then
git clone --depth 1 https://github.com/brendangregg/FlameGraph.git /opt/freedom/tools/FlameGraph
fi
}
function configure_pg_plugins {
if [ ! -d /opt/freedom/extensions/pg_plugins ]; then
git clone --depth 1 https://github.com/michaelpq/pg_plugins.git /opt/freedom/extensions/pg_plugins
fi
}
function main {
configure_git_excludes
configure_coredumps
configure_vscode
configure_perf
configure_pg_plugins
}
main $@