forked from kata-containers/tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_env_ubuntu.sh
executable file
·111 lines (92 loc) · 3.02 KB
/
setup_env_ubuntu.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
#
# Copyright (c) 2017-2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
cidir=$(dirname "$0")
source "/etc/os-release" || source "/usr/lib/os-release"
source "${cidir}/lib.sh"
echo "Update apt repositories"
sudo -E apt update
echo "Install chronic"
sudo -E apt install -y moreutils
declare -A minimal_packages=( \
[spell-check]="hunspell hunspell-en-gb hunspell-en-us pandoc" \
[xml_validator]="libxml2-utils" \
[yaml_validator]="yamllint" \
)
declare -A packages=( \
[kata_containers_dependencies]="libtool automake autotools-dev autoconf bc libpixman-1-dev coreutils" \
[qemu_dependencies]="libcap-dev libattr1-dev libcap-ng-dev librbd-dev" \
[kernel_dependencies]="libelf-dev flex" \
[crio_dependencies]="libglib2.0-dev libseccomp-dev libapparmor-dev libgpgme11-dev thin-provisioning-tools" \
[bison_binary]="bison" \
[libudev-dev]="libudev-dev" \
[build_tools]="build-essential python pkg-config zlib1g-dev" \
[crio_dependencies_for_ubuntu]="libdevmapper-dev btrfs-tools util-linux" \
[metrics_dependencies]="smem jq" \
[cri-containerd_dependencies]="libseccomp-dev libapparmor-dev btrfs-tools make gcc pkg-config" \
[crudini]="crudini" \
[procenv]="procenv" \
[haveged]="haveged" \
[gnu_parallel]="parallel" \
[libsystemd]="libsystemd-dev" \
[redis]="redis-server" \
)
if [ "$(uname -m)" == "x86_64" ] && [ "${NAME}" == "Ubuntu" ] && [ "$(echo "${VERSION_ID} >= 18.04" | bc -q)" == "1" ]; then
packages[qemu_dependencies]+=" libpmem-dev"
fi
rust_agent_pkgs=()
rust_agent_pkgs+=("build-essential")
rust_agent_pkgs+=("g++")
rust_agent_pkgs+=("make")
rust_agent_pkgs+=("cmake")
rust_agent_pkgs+=("automake")
rust_agent_pkgs+=("autoconf")
rust_agent_pkgs+=("m4")
rust_agent_pkgs+=("libc6-dev")
rust_agent_pkgs+=("libstdc++-8-dev")
rust_agent_pkgs+=("coreutils")
rust_agent_pkgs+=("binutils")
rust_agent_pkgs+=("debianutils")
rust_agent_pkgs+=("gcc")
rust_agent_pkgs+=("musl")
rust_agent_pkgs+=("musl-dev")
rust_agent_pkgs+=("musl-tools")
rust_agent_pkgs+=("git")
main()
{
local setup_type="$1"
[ -z "$setup_type" ] && die "need setup type"
local pkgs_to_install
local pkgs
for pkgs in "${minimal_packages[@]}"; do
info "The following package will be installed: $pkgs"
pkgs_to_install+=" $pkgs"
done
if [ "$setup_type" = "default" ]; then
for pkgs in "${packages[@]}"; do
info "The following package will be installed: $pkgs"
pkgs_to_install+=" $pkgs"
done
fi
# packages for rust agent, build on 18.04 or later
if [[ ! "${VERSION_ID}" < "18.04" ]]; then
pkgs_to_install+=" ${rust_agent_pkgs[@]}"
fi
chronic sudo -E apt -y install $pkgs_to_install
[ "$setup_type" = "minimal" ] && exit 0
if [ "$VERSION_ID" == "16.04" ] && [ "$(arch)" != "ppc64le" ]; then
chronic sudo -E add-apt-repository ppa:alexlarsson/flatpak -y
chronic sudo -E apt update
fi
echo "Install os-tree"
chronic sudo -E apt install -y libostree-dev
if [ "$KATA_KSM_THROTTLER" == "yes" ]; then
echo "Install ${KATA_KSM_THROTTLER_JOB}"
chronic sudo -E apt install -y ${KATA_KSM_THROTTLER_JOB}
fi
}
main "$@"