-
Notifications
You must be signed in to change notification settings - Fork 146
/
install-containerd-helpers
83 lines (69 loc) · 2.98 KB
/
install-containerd-helpers
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
#!/usr/bin/env bash
###
# Script Name: install-containerd-helpers
#
# Description: A library that containers helpers to install containerd on different
# distributions based on a package manager
###
set -x extglob
# Steps taken from: https://docs.docker.com/install/linux/docker-ce/centos/
function install_rpm_containerd() {
if [ "${PACKAGE_REPO}" = "stage" ]; then
REPO_URL="https://download-stage.docker.com/linux/${DIST_ID}/docker-ce-staging.repo"
else
REPO_URL="https://download.docker.com/linux/${DIST_ID}/docker-ce.repo"
fi
# Install containerd dependency for non-zypper dependecies
echo "[DEBUG] Installing engine dependencies from ${REPO_URL}"
# Note: we enable test channel to be able to test non-stable containerd packages as well.
# Once a containerd package becomes stable it will also be available in the test channel,
# so this logic works for both cases.
# (See also same logic in install_debian_containerd)
if command -v dnf5; then
dnf --version
# FIXME(thaJeztah); strip empty lines as workaround for https://github.com/rpm-software-management/dnf5/issues/1603
TMP_REPO_FILE="$(mktemp --dry-run)"
curl -fsSL "${REPO_URL}" | tr -s '\n' > "${TMP_REPO_FILE}"
dnf config-manager addrepo --save-filename=docker-ce.repo --overwrite --from-repofile="${TMP_REPO_FILE}"
rm -f "${TMP_REPO_FILE}"
# dnf config-manager addrepo --save-filename=docker-ce.repo --from-repofile="${REPO_URL}"
dnf config-manager setopt 'docker-ce-*.enabled=0'
dnf config-manager setopt 'docker-ce-test.enabled=1'
dnf makecache
elif command -v dnf; then
dnf --version
dnf config-manager --add-repo "${REPO_URL}"
dnf config-manager --set-disabled 'docker-ce-*'
dnf config-manager --set-enabled 'docker-ce-test'
dnf makecache
else
yum-config-manager --add-repo "${REPO_URL}"
yum-config-manager --disable 'docker-ce-*'
yum-config-manager --enable 'docker-ce-test'
yum makecache
fi
}
# Steps taken from: https://docs.docker.com/install/linux/docker-ce/ubuntu/
function install_debian_containerd() {
if [ "${PACKAGE_REPO}" = "stage" ]; then
REPO_URL="https://download-stage.docker.com/linux/${DIST_ID}"
else
REPO_URL="https://download.docker.com/linux/${DIST_ID}"
fi
echo "[DEBUG] Installing engine dependencies from ${REPO_URL}"
#TODO include this step in the get.docker.com installation script
# Make sure ca-certificates are up-to-date
update-ca-certificates -f
curl -fsSL "${REPO_URL}/gpg" | apt-key add -
if [ "${DIST_VERSION}" = "sid" ]; then
echo 'Debian sid ("unstable") cannot be used for packaging: replace with the actual codename'
exit 1
fi
ARCH=$(dpkg --print-architecture)
# Note: we enable test channel to be able to test non-stable containerd packages as well.
# Once a containerd package becomes stable it will also be available in the test channel,
# so this logic works for both cases.
# (See also same logic in install_rpm_containerd)
echo "deb [arch=${ARCH}] ${REPO_URL} ${DIST_VERSION} test" > /etc/apt/sources.list.d/docker.list
apt-get update
}