-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathcreate.sh
More file actions
73 lines (58 loc) · 2.54 KB
/
create.sh
File metadata and controls
73 lines (58 loc) · 2.54 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
#!/usr/bin/env bash
# vim: et ts=2 syn=bash
#
# The Docker sysext.
#
RELOAD_SERVICES_ON_MERGE="true"
function list_available_versions() {
# Hack alert: we're extracting the list of available versions
# from the release server's X86-64 release tarballs' HTML file listing.
# This should be improved with a better source.
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/ \
| sed -n 's/.*docker-\([0-9.]\+\).tgz.*/\1/p' \
| sort -Vr
}
# --
function populate_sysext_root_options() {
echo " --without <docker|containerd> : Build the sysext without docker or"
echo " containerd/runc, respectively."
}
# --
function populate_sysext_root() {
local sysextroot="$1"
local arch="$2"
local version="$3"
local without="$(get_optional_param "without" "" "$@")"
# The github release uses different arch identifiers
local rel_arch="$(arch_transform 'x86-64' 'x86_64' "$arch")"
rel_arch="$(arch_transform 'arm64' 'aarch64' "$rel_arch")"
curl -o "docker-${version}.tgz" \
-fsSL "https://download.docker.com/linux/static/stable/${rel_arch}/docker-${version}.tgz"
tar --force-local -xf "docker-${version}.tgz"
mkdir -p "${sysextroot}"/usr/bin
cp -R docker/* "${sysextroot}"/usr/bin/
if [[ "${without}" == docker ]] ; then
announce "Removing docker from sysext as requested (shipping containerd/runc only)"
rm "${sysextroot}/usr/bin/docker" \
"${sysextroot}/usr/bin/dockerd" \
"${sysextroot}/usr/bin/docker-init" \
"${sysextroot}/usr/bin/docker-proxy" \
"${sysextroot}/usr/lib/systemd/system/docker.socket" \
"${sysextroot}/usr/lib/systemd/system/sockets.target.d/10-docker-socket.conf" \
"${sysextroot}/usr/lib/systemd/system/docker.service"
rmdir "${sysextroot}/usr/lib/systemd/system/sockets.target.d"
elif [[ "${without}" == containerd ]] ; then
announce "Removing containerd / runc from sysext as requested (shipping docker only)"
rm "${sysextroot}/usr/bin/containerd" \
"${sysextroot}/usr/bin/containerd-shim-runc-v2" \
"${sysextroot}/usr/bin/ctr" \
"${sysextroot}/usr/bin/runc" \
"${sysextroot}/usr/lib/systemd/system/containerd.service" \
"${sysextroot}/usr/lib/systemd/system/multi-user.target.d/10-containerd-service.conf" \
"${sysextroot}/usr/share/containerd/config.toml" \
"${sysextroot}/usr/share/containerd/config-cgroups.toml"
rmdir "${sysextroot}/usr/share/containerd" \
"${sysextroot}/usr/lib/systemd/system/multi-user.target.d/"
fi
}
# --