Skip to content

Commit

Permalink
chore(root/containerd): clean up patches
Browse files Browse the repository at this point in the history
Seems newer versions of containerd does not work in termux, trying to
run docker with containerd 1.6.24 or 1.7.7 we get:

$ sudo docker run -it ubuntu bash
docker: Error response from daemon: failed to create task for container: failed to start shim: start failed: io.containerd.runc.v2: create new shim socket: listen unix /data/data/com.termux/files/usr/var/run/containerd/s/3f71828f1d6c1ead43fded842abc9c3cf5857c74c3e0704cd83ab177e17cfe6c: bind: invalid argument: exit status 1: unknown.
  • Loading branch information
Grimler91 committed Oct 23, 2023
1 parent 4d85c85 commit 8680546
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 102 deletions.
25 changes: 4 additions & 21 deletions root-packages/containerd/Makefile.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
diff --git a/data/data/com.termux/files/usr/tmp/docker-build/containerd-1.4.3/Makefile b/Makefile
index c0fecb9..e724e52 100644
--- a/data/data/com.termux/files/usr/tmp/docker-build/containerd-1.4.3/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@
VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.m' --always)
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
PACKAGE=github.com/containerd/containerd
-SHIM_CGO_ENABLED ?= 0
+SHIM_CGO_ENABLED ?= 1

ifneq "$(strip $(shell command -v $(GO) 2>/dev/null))" ""
GOOS ?= $(shell $(GO) env GOOS)
@@ -69,7 +69,7 @@ RELEASE=containerd-$(VERSION:v%=%).${GOOS}-${GOARCH}
--- ../cache/tmp-checkout/Makefile 2023-10-23 19:42:08.826348963 +0000
+++ ./Makefile 2023-10-23 19:48:19.356921771 +0000
@@ -81,7 +81,7 @@
PKG=github.com/containerd/containerd

# Project binaries.
Expand All @@ -29,7 +18,7 @@ index c0fecb9..e724e52 100644

# Project packages.
PACKAGES=$(shell $(GO) list ${GO_TAGS} ./... | grep -v /vendor/ | grep -v /integration)
@@ -274,15 +274,18 @@ genman: man/containerd.8 man/ctr.8
@@ -274,11 +274,13 @@

man/containerd.8: FORCE
@echo "$(WHALE) $@"
Expand All @@ -45,9 +34,3 @@ index c0fecb9..e724e52 100644

man/%: docs/man/%.md FORCE
@echo "$(WHALE) $@"
- go-md2man -in "$<" -out "$@"
+ CC=gcc CFLAGS= LDFLAGS= GOOS= GOARCH= $(GO) build -o "bin/go-md2man" ./vendor/github.com/cpuguy83/go-md2man/v2
+ bin/go-md2man -in "$<" -out "$@"

define installmanpage
$(INSTALL) -d $(DESTDIR)$(MANDIR)/man$(2);
9 changes: 3 additions & 6 deletions root-packages/containerd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ TERMUX_PKG_HOMEPAGE=https://containerd.io/
TERMUX_PKG_DESCRIPTION="An open and reliable container runtime"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
# Be sure to test docker before pushing an update. With 1.7.7 we get
# the following error:
# Be sure to test docker before pushing an update. With 1.6.24 or
# 1.7.7 we get the following error:
# $ sudo docker run -it ubuntu bash
# docker: Error response from daemon: failed to create task for container: failed to start shim: start failed: io.containerd.runc.v2: create new shim socket: listen unix /data/data/com.termux/files/usr/var/run/containerd/s/3f71828f1d6c1ead43fded842abc9c3cf5857c74c3e0704cd83ab177e17cfe6c: bind: invalid argument: exit status 1: unknown.
TERMUX_PKG_VERSION=1.6.21
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=git+https://github.com/containerd/containerd
TERMUX_PKG_DEPENDS="runc"
TERMUX_PKG_CONFFILES="etc/containerd/config.toml"
Expand All @@ -25,9 +25,6 @@ termux_step_make() {
ln -sf "${TERMUX_PKG_SRCDIR}" "${GOPATH}/src/github.com/containerd/containerd"
cd "${GOPATH}/src/github.com/containerd/containerd"

# apply some patches in a batch
xargs sed -i "s_\(/etc/containerd\)_${TERMUX_PREFIX}\1_g" < <(grep -R /etc/containerd | cut -d':' -f1 | sort | uniq)

# issue the build command
export BUILDTAGS=no_btrfs
make -j ${TERMUX_MAKE_PROCESSES}
Expand Down
17 changes: 0 additions & 17 deletions root-packages/containerd/database.go.patch

This file was deleted.

5 changes: 4 additions & 1 deletion root-packages/containerd/defaults_unix.go.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/defaults/defaults_unix.go
+++ b/defaults/defaults_unix.go
@@ -22,17 +22,17 @@
@@ -22,19 +22,19 @@
const (
// DefaultRootDir is the default location used by containerd to store
// persistent data
Expand All @@ -23,3 +23,6 @@
// DefaultRuntime is the default linux runtime
DefaultRuntime = "io.containerd.runc.v2"
// DefaultConfigDir is the default location for config files.
- DefaultConfigDir = "/etc/containerd"
+ DefaultConfigDir = "@TERMUX_PREFIX@/etc/containerd"
)
48 changes: 48 additions & 0 deletions root-packages/containerd/fix-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff -ur ../src.orig/cluster/gce/configure.sh ./cluster/gce/configure.sh
--- ../src.orig/cluster/gce/configure.sh 2023-10-15 18:45:05.281722654 +0000
+++ ./cluster/gce/configure.sh 2023-10-15 18:45:27.488481779 +0000
@@ -189,7 +189,7 @@
rm -f "${CONTAINERD_HOME}/etc/crictl.yaml"

# Generate containerd config
-config_path="${CONTAINERD_CONFIG_PATH:-"/etc/containerd/config.toml"}"
+config_path="${CONTAINERD_CONFIG_PATH:-"@TERMUX_PREFIX@/etc/containerd/config.toml"}"
mkdir -p $(dirname ${config_path})
cni_bin_dir="${CONTAINERD_HOME}/opt/cni/bin"
cni_template_path="${CONTAINERD_HOME}/opt/containerd/cluster/gce/cni.template"
diff -ur ../src.orig/contrib/ansible/cri-containerd.yaml ./contrib/ansible/cri-containerd.yaml
--- ../src.orig/contrib/ansible/cri-containerd.yaml 2023-10-15 18:45:05.278389306 +0000
+++ ./contrib/ansible/cri-containerd.yaml 2023-10-15 18:45:27.488481779 +0000
@@ -11,7 +11,7 @@
- include_tasks: tasks/binaries.yaml # Contains tasks for pulling containerd components

- name: "Create a directory for containerd config"
- file: path=/etc/containerd state=directory
+ file: path=@TERMUX_PREFIX@/etc/containerd state=directory

- name: "Start Containerd"
systemd: name=containerd daemon_reload=yes state=started enabled=yes
diff -ur ../src.orig/script/setup/config-containerd ./script/setup/config-containerd
--- ../src.orig/script/setup/config-containerd 2023-10-15 18:45:05.351722947 +0000
+++ ./script/setup/config-containerd 2023-10-15 18:45:27.495148474 +0000
@@ -15,7 +15,7 @@
# limitations under the License.

#
-# establishes /etc/containerd/config.toml
+# establishes @TERMUX_PREFIX@/etc/containerd/config.toml
# parameterized by the current SELinux mode
#
set -eux -o pipefail
@@ -26,9 +26,9 @@
enable_selinux=true
fi

-mkdir -p /etc/containerd
+mkdir -p @TERMUX_PREFIX@/etc/containerd

-cat << EOF | sudo tee /etc/containerd/config.toml
+cat << EOF | sudo tee @TERMUX_PREFIX@/etc/containerd/config.toml
version = 2
[plugins]
[plugins."io.containerd.grpc.v1.cri"]
57 changes: 0 additions & 57 deletions root-packages/containerd/md2man.go.patch

This file was deleted.

0 comments on commit 8680546

Please sign in to comment.