From be5a5b7f95a430344b9bf54873c80eb8de9bac30 Mon Sep 17 00:00:00 2001 From: Tulip Blossom Date: Mon, 23 Sep 2024 01:20:22 -0300 Subject: [PATCH] user/cri-o: new package --- user/cri-o-recommends | 1 + user/cri-o/files/config.toml | 10 +++++ user/cri-o/files/crio | 4 ++ user/cri-o/files/tmpfiles.conf | 2 + user/cri-o/patches/cni-plugins-path.patch | 12 +++++ user/cri-o/patches/install.patch | 33 ++++++++++++++ user/cri-o/patches/no-systemd-install.patch | 12 +++++ user/cri-o/template.py | 49 +++++++++++++++++++++ 8 files changed, 123 insertions(+) create mode 120000 user/cri-o-recommends create mode 100644 user/cri-o/files/config.toml create mode 100644 user/cri-o/files/crio create mode 100644 user/cri-o/files/tmpfiles.conf create mode 100644 user/cri-o/patches/cni-plugins-path.patch create mode 100644 user/cri-o/patches/install.patch create mode 100644 user/cri-o/patches/no-systemd-install.patch create mode 100644 user/cri-o/template.py diff --git a/user/cri-o-recommends b/user/cri-o-recommends new file mode 120000 index 00000000000..6e63e8f6a8f --- /dev/null +++ b/user/cri-o-recommends @@ -0,0 +1 @@ +cri-o \ No newline at end of file diff --git a/user/cri-o/files/config.toml b/user/cri-o/files/config.toml new file mode 100644 index 00000000000..d31247a49b9 --- /dev/null +++ b/user/cri-o/files/config.toml @@ -0,0 +1,10 @@ +[crio.runtime] +conmon_cgroup = "pod" +cgroup_manager = "cgroupfs" +default_runtime = "crun" + +[crio.runtime.runtimes.crun] +monitor_path = "/usr/libexec/podman/conmon" + +[crio.runtime.runtimes.runc] +monitor_path = "/usr/libexec/podman/conmon" diff --git a/user/cri-o/files/crio b/user/cri-o/files/crio new file mode 100644 index 00000000000..1a11d476ace --- /dev/null +++ b/user/cri-o/files/crio @@ -0,0 +1,4 @@ +type = process +command = /usr/bin/crio +pid-file = /run/crio.pid +depends-on = pre-local.target diff --git a/user/cri-o/files/tmpfiles.conf b/user/cri-o/files/tmpfiles.conf new file mode 100644 index 00000000000..082a03e2669 --- /dev/null +++ b/user/cri-o/files/tmpfiles.conf @@ -0,0 +1,2 @@ +d /var/lib/crio 0755 root root - +d /var/log/crio 0755 root root - diff --git a/user/cri-o/patches/cni-plugins-path.patch b/user/cri-o/patches/cni-plugins-path.patch new file mode 100644 index 00000000000..cb8e7cb7ac4 --- /dev/null +++ b/user/cri-o/patches/cni-plugins-path.patch @@ -0,0 +1,12 @@ +from aports/cri-o/cni-plugins-path.patch + +--- a/pkg/config/config_unix.go 2024-09-09 19:22:50.000000000 -0300 ++++ b/pkg/config/config_unix.go 2024-09-22 21:08:00.826738793 -0300 +@@ -6,7 +6,7 @@ + // Defaults for linux/unix if none are specified. + const ( + cniConfigDir = "/etc/cni/net.d/" +- cniBinDir = "/opt/cni/bin/" ++ cniBinDir = "/usr/libexec/cni/" + containerExitsDir = "/var/run/crio/exits" + ContainerAttachSocketDir = "/var/run/crio" diff --git a/user/cri-o/patches/install.patch b/user/cri-o/patches/install.patch new file mode 100644 index 00000000000..d86a3c5c3b3 --- /dev/null +++ b/user/cri-o/patches/install.patch @@ -0,0 +1,33 @@ +--- a/Makefile 2024-09-22 21:37:03.576504562 -0300 ++++ b/Makefile 2024-09-22 21:49:31.372539262 -0300 +@@ -9,12 +9,12 @@ + PROJECT := github.com/cri-o/cri-o + CRIO_INSTANCE := crio_dev + PREFIX ?= ${DESTDIR}/usr/local +-BINDIR ?= ${PREFIX}/bin ++BINDIR ?= ${DESTDIR}/usr/bin + LIBEXECDIR ?= ${PREFIX}/libexec +-MANDIR ?= ${PREFIX}/share/man ++MANDIR ?= ${DESTDIR}/usr/share/man + ETCDIR ?= ${DESTDIR}/etc + ETCDIR_CRIO ?= ${ETCDIR}/crio +-DATAROOTDIR ?= ${PREFIX}/share/containers ++DATAROOTDIR ?= ${DESTDIR}/usr/share/containers + BUILDTAGS ?= containers_image_ostree_stub \ + $(shell hack/apparmor_tag.sh) \ + $(shell hack/btrfs_installed_tag.sh) \ +@@ -35,10 +35,10 @@ + TESTBIN_PATH := ${BUILD_PATH}/test + MOCK_PATH := ${PWD}/test/mocks + +-BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions +-FISHINSTALLDIR=${PREFIX}/share/fish/completions +-ZSHINSTALLDIR=${PREFIX}/share/zsh/site-functions +-OCIUMOUNTINSTALLDIR=$(PREFIX)/share/oci-umount/oci-umount.d ++BASHINSTALLDIR=${DESTDIR}/usr/share/bash-completion/completions ++FISHINSTALLDIR=${DESTDIR}/usr/share/fish/vendor_completions.d ++ZSHINSTALLDIR=${DESTDIR}/usr/share/zsh/site-functions ++OCIUMOUNTINSTALLDIR=${DESTDIR}/usr/share/oci-umount/oci-umount.d + + SELINUXOPT ?= $(shell selinuxenabled 2>/dev/null && echo -Z) + diff --git a/user/cri-o/patches/no-systemd-install.patch b/user/cri-o/patches/no-systemd-install.patch new file mode 100644 index 00000000000..dd23ed7c418 --- /dev/null +++ b/user/cri-o/patches/no-systemd-install.patch @@ -0,0 +1,12 @@ +--- a/Makefile 2024-09-09 19:22:50.000000000 -0300 ++++ b/Makefile 2024-09-22 21:11:08.522952422 -0300 +@@ -259,7 +259,7 @@ + -t quay.io/crio/metrics-exporter:latest + + .PHONY: install +-install: install.bin install.man install.completions install.systemd install.config ## Install the project locally. ++install: install.bin install.man install.completions install.config ## Install the project locally. + + .PHONY: install.bin-nobuild + install.bin-nobuild: ## Install the binaries. + diff --git a/user/cri-o/template.py b/user/cri-o/template.py new file mode 100644 index 00000000000..3a151490ab3 --- /dev/null +++ b/user/cri-o/template.py @@ -0,0 +1,49 @@ +pkgname = "cri-o" +pkgver = "1.31.0" +pkgrel = 0 +build_style = "makefile" +make_build_env = { + "BUILDTAGS": "seccomp containers_image_openpgp containers_image_ostree_stub" +} +hostmakedepends = [ + "bash", + "go", + "pkgconf", +] +makedepends = [ + "gpgme-devel", + "libbtrfs-devel", + "libseccomp-devel", + "linux-headers", +] +depends = ["cni-plugins", "containers-common", "util-linux-ns"] +pkgdesc = "OCI-based implementation of Kubernetes Container Runtime Interface" +maintainer = "tulilirockz " +license = "Apache-2.0" +url = "https://cri-o.io" +source = f"https://github.com/cri-o/cri-o/archive/refs/tags/v{pkgver}.tar.gz" +sha256 = "4b7e23f8920b7252132536acf5da66788b339bb05868c20e561a6c09b198c0f6" +# check: depends on networking (fetches a container) +options = ["!check"] + + +def post_install(self): + self.install_license("LICENSE") + self.install_service(self.files_path / "crio") + self.install_tmpfiles(self.files_path / "tmpfiles.conf") + self.install_file( + self.files_path / "config.toml", "etc/crio/crio.conf.d/99-default.toml" + ) + self.install_files("contrib/cni", "usr/share/examples/crio/cni") + + +@subpackage("cri-o-recommends") +def _(self): + self.depends = [ + "crun", + "conmon", + ] + self.subdesc = "recommended dependencies" + self.install_if = [self.parent] + self.options = ["empty"] + return []