-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbootstrap.sh
87 lines (79 loc) · 2.69 KB
/
bootstrap.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
# ______________________________________________________
# Container bootstrap script.
#
# @file bootstrap.sh
# @author Mustafa Kemal GILOR <[email protected]>
# @date 10.05.2020
#
# All rights reserved. Licensed under the MIT license.
# See LICENSE in the project root for license information.
#
# SPDX-License-Identifier: MIT
# ______________________________________________________
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
SCRIPT_ROOT="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
# Enable abort on error
set -e
readonly apt_command='apt-get'
readonly apt_args='-y install'
readonly pip_command='pip3'
readonly pip_args='install'
# Packages to be installed via apt
apt_package_list=(
# Verify git, process tools, lsb-release (useful for CLI installs) installed
git git-flow iproute2 procps lsb-release
# Install GNU GCC Toolchain, version 10
gcc-10 g++-10 gdb libstdc++-10-dev libc6-dev
# Install LLVM Toolchain, version 10
llvm-10 lldb-10 clang-10 clangd-10 libc++-10-dev
# Install build generator & dependency resolution and build accelarator tools
make ninja-build autoconf automake libtool m4 cmake ccache
# Install python & pip
python3 python3-pip
# Install static analyzers, formatting, tidying,
clang-format-10 clang-tidy-10 iwyu cppcheck
# Debugging/tracing
valgrind
# Install test framework & benchmark
libgtest-dev libgmock-dev libbenchmark-dev
# Install code coverage
lcov gcovr
# Documentation & graphing
doxygen doxygen-latex doxygen-doxyparse graphviz
# User-specified packages
${apt_extra_package_list[@]}
)
# Packages to be installed via pip
pip_package_list=(
conan
# User-specified packages
${pip_extra_package_list[@]}
)
apt-get update && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
&&
# Install apt packages
$apt_command $apt_args ${apt_package_list[@]} \
&&
# Install pip packages
( ( which $pip_command && $pip_command $pip_args ${pip_package_list[@]}) || true ) \
&&
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
groupadd --gid $USER_GID $USERNAME \
&&
useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
&&
# [Optional] Add sudo support for the non-root user
apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&&
# Clean up
apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*