forked from kata-containers/tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_env_sles.sh
executable file
·109 lines (87 loc) · 3.15 KB
/
setup_env_sles.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
#!/bin/bash
#
# Copyright (c) 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"
arch=$("${cidir}"/kata-arch.sh -d)
# Use at least openSUSE 15.3 on s390x because that is the first release
major="${VERSION_ID%.*}"
minor="${VERSION_ID#*.}"
[ "${arch}" == "s390x" ] && ([[ "${major}" -le 12 ]] || ([ "${major}" == "15" ] && [ "${minor}" -le 2 ])) && \
VERSION_ID="15.3"
leap_repo="http://download.opensuse.org/distribution/leap/${VERSION_ID}/repo/oss/"
leap_repo_name="leap-oss"
sudo -E zypper removerepo ${leap_repo} || true
sudo -E zypper addrepo --no-gpgcheck ${leap_repo} ${leap_repo_name}
sudo -E zypper refresh ${leap_repo_name}
echo "Install perl-IPC-Run"
sudo -E zypper -n install perl-IPC-Run
echo "Install chronic"
sudo -E zypper -n install moreutils
declare -A minimal_packages=( \
[spell-check]="hunspell myspell-en_GB myspell-en_US" \
[xml_validator]="libxml2-tools" \
[yaml_validator_dependencies]="python-setuptools" \
)
declare -A packages=( \
[general_dependencies]="curl git patch expect"
[kata_containers_dependencies]="libtool automake autoconf bc libpixman-1-0-devel coreutils" \
[qemu_dependencies]="libcap-devel libattr1 libcap-ng-devel librbd-devel ninja" \
[kernel_dependencies]="libelf-devel flex" \
[crio_dependencies]="libglib-2_0-0 libseccomp-devel libapparmor-devel libgpg-error-devel glibc-devel-static libgpgme-devel libassuan-devel glib2-devel glibc-devel util-linux" \
[gperf_dependencies]="gcc-c++" \
[bison_binary]="bison" \
[libudev-dev]="libudev-devel" \
[build_tools]="gcc python zlib-devel" \
[metrics_dependencies]="jq" \
[cri-containerd_dependencies]="libseccomp-devel libapparmor-devel make pkg-config" \
[haveged]="haveged" \
[libsystemd]="systemd-devel" \
[agent_shutdown_test]="tmux" \
[virtiofsd_dependencies]="unzip" \
)
if [ "${arch}" == "x86_64" ] || [ "${arch}" == "ppc64le" ]; then
packages[qemu_dependencies]+=" libpmem-devel"
fi
if [ "$(uname -m)" == "ppc64le" ] || [ "$(uname -m)" == "s390x" ]; then
packages[kata_containers_dependencies]+=" protobuf-devel"
fi
if [ "$(uname -m)" == "s390x" ]; then
packages[kernel_dependencies]+=" libopenssl-devel"
fi
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
chronic sudo -E zypper -n install $pkgs_to_install
# Pandoc currently unavailable in openSUSE s390x repos
# Allow install failure, is not required for mainstream CI workflow
echo "Try to install pandoc"
sudo -E zypper -n install pandoc || true
echo "Install YAML validator"
chronic sudo -E easy_install pip
chronic sudo -E pip install yamllint
echo "Install redis"
chronic sudo -E zypper -n install redis
[ "$setup_type" = "minimal" ] && exit 0
echo "Install crudini"
chronic sudo -E zypper -n install crudini
}
main "$@"