From 118afc7e4b3a1b39dabba3ceeb29fb46f1c4eb4c Mon Sep 17 00:00:00 2001 From: Alexander Miroshnichenko Date: Fri, 1 Jan 2021 22:27:19 +0300 Subject: [PATCH] app-emulation/libpod: add package --- app-emulation/libpod/Manifest | 4 + ...ble-Makefile-selinux-install-options.patch | 28 +++++ app-emulation/libpod/files/podman.initd | 17 +++ app-emulation/libpod/files/podman.logrotated | 7 ++ app-emulation/libpod/libpod-2.2.1-r9.ebuild | 112 ++++++++++++++++++ 5 files changed, 168 insertions(+) create mode 100644 app-emulation/libpod/Manifest create mode 100644 app-emulation/libpod/files/0001-Disable-Makefile-selinux-install-options.patch create mode 100644 app-emulation/libpod/files/podman.initd create mode 100644 app-emulation/libpod/files/podman.logrotated create mode 100644 app-emulation/libpod/libpod-2.2.1-r9.ebuild diff --git a/app-emulation/libpod/Manifest b/app-emulation/libpod/Manifest new file mode 100644 index 0000000..975a55c --- /dev/null +++ b/app-emulation/libpod/Manifest @@ -0,0 +1,4 @@ +AUX 0001-Disable-Makefile-selinux-install-options.patch 1030 BLAKE2B 6bbf498617fbba959d7de39d992c6e057a04f37e9e14b4479ab257106ffdf9369e534b2e62059e4c46fd0280d09da64fc3057d413334a4f978a69b216b1e96af SHA512 9d4458be3e0fa5835076a8e0db7c46aa50dfd5d60585a5a9fb7d3854b0cc286e7cd532d908369a89d2c74804bc2f1569759b1a134f83cc6e64fea8f67e9b1151 +AUX podman.initd 566 BLAKE2B ccfedaea85b03a09446b678460d53591e62a9d8a1c205bd850fd95b4ce0ed47ebf767830fb9d30d32f1c0a4a1868eeb83c2c7deaef1617c0e6e91899807f0c36 SHA512 561c72d71827e523ab177b38961e38a594a14da8c6f0490d5743f35f4d02f4d813b43d9b3a66dd1aa72701c7d9a88ac6bb3a8435e72afcfa23289cce460bdb04 +AUX podman.logrotated 85 BLAKE2B 730899f93ee354e476629276b69224cfeaaa1603b6690cac3c0cd905cd75add19179f99e26f29edbd963d5f44c38a3a2db0b5a3613dc665ab801654eac13dc2e SHA512 0136d063b15b07c41a9370ba1845c4f368ec46a7a30683b7ff7cbb0b12e5b2711c9a45329f5102af6a969e562edcec006a8de9055e43e1caf9395847d0c5ec45 +EBUILD libpod-2.2.1-r9.ebuild 2962 BLAKE2B 93f2ba0751bcbb34ae3a0b7d0dec58db542323623bbea21d73e1839cabae91ee68c63bc3b743f981636a1c5796bc6bf4b0410721556ca6bb61bd2ee699495e72 SHA512 e4e8df0f4ca3ae4ab61ad58471776ea5afdb05937f67f02ff03968af022793eca5e1d80659b14af99860ec9f5486c0217dc585b5a91ffc375e36faa7aa4547f6 diff --git a/app-emulation/libpod/files/0001-Disable-Makefile-selinux-install-options.patch b/app-emulation/libpod/files/0001-Disable-Makefile-selinux-install-options.patch new file mode 100644 index 0000000..093ad9a --- /dev/null +++ b/app-emulation/libpod/files/0001-Disable-Makefile-selinux-install-options.patch @@ -0,0 +1,28 @@ +From 2b3cd87ab0470ed6857b80b34c60e118724523e3 Mon Sep 17 00:00:00 2001 +From: Alexander Miroshnichenko +Date: Fri, 1 Jan 2021 17:52:07 +0300 +Subject: [PATCH] Disable Makefile selinux install options +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Signed-off-by: Alexander Miroshnichenko +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 0316ea28452e..9bb06a1cad4b 100644 +--- a/Makefile ++++ b/Makefile +@@ -50,7 +50,7 @@ BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions + ZSHINSTALLDIR=${PREFIX}/share/zsh/site-functions + FISHINSTALLDIR=${PREFIX}/share/fish/vendor_completions.d + +-SELINUXOPT ?= $(shell test -x /usr/sbin/selinuxenabled && selinuxenabled && echo -Z) ++SELINUXOPT ?= $(shell /bin/false && echo -Z) + + COMMIT_NO ?= $(shell git rev-parse HEAD 2> /dev/null || true) + GIT_COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),${COMMIT_NO}-dirty,${COMMIT_NO}) +-- +2.26.2 + diff --git a/app-emulation/libpod/files/podman.initd b/app-emulation/libpod/files/podman.initd new file mode 100644 index 0000000..b590be1 --- /dev/null +++ b/app-emulation/libpod/files/podman.initd @@ -0,0 +1,17 @@ +#!/sbin/openrc-run +# Copyright 2015-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="Podman Remote API Service" +LOG_PATH="/var/log/${RC_SVCNAME}" +RUN_PATH="/run/${RC_SVCNAME}" +pidfile="${RUN_PATH}/${RC_SVCNAME}.pid" +command="/usr/bin/podman" +command_args="--log-level debug varlink -t 0 unix:/run/podman/io.podman" +command_background="true" +start_stop_daemon_args="--stdout ${LOG_PATH}/${RC_SVCNAME}.log --stderr ${LOG_PATH}/${RC_SVCNAME}.log" + +start() { + checkpath -d "${RUN_PATH}" "${LOG_PATH}" + default_start +} diff --git a/app-emulation/libpod/files/podman.logrotated b/app-emulation/libpod/files/podman.logrotated new file mode 100644 index 0000000..b9d7234 --- /dev/null +++ b/app-emulation/libpod/files/podman.logrotated @@ -0,0 +1,7 @@ +/var/log/podman/podman.log { + missingok + size 5M + rotate 3 + compress + copytruncate +} diff --git a/app-emulation/libpod/libpod-2.2.1-r9.ebuild b/app-emulation/libpod/libpod-2.2.1-r9.ebuild new file mode 100644 index 0000000..c9be052 --- /dev/null +++ b/app-emulation/libpod/libpod-2.2.1-r9.ebuild @@ -0,0 +1,112 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit eutils git-r3 + +DESCRIPTION="Library and podman tool for running OCI-based containers in Pods" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="amd64" + +EGIT_REPO_URI=https://github.com/containers/podman.git +EGIT_BRANCH=v2.2.1-rhel +EGIT_COMMIT=a0d478edea7f775b7ce32f8eb1a01e75374486cb + +IUSE="apparmor btrfs +fuse selinux systemd seccomp +rootless" + +COMMON_DEPEND=" + app-crypt/gpgme:= + >=app-emulation/conmon-2.0.0 + || ( >=app-emulation/runc-1.0.0_rc6 app-emulation/crun ) + dev-libs/libassuan:= + dev-libs/libgpg-error:= + >=net-misc/cni-plugins-0.8.6 + seccomp? ( sys-libs/libseccomp:= ) + rootless? ( app-emulation/slirp4netns ) + apparmor? ( sys-libs/libapparmor ) + btrfs? ( sys-fs/btrfs-progs ) + selinux? ( sys-libs/libselinux:= ) + systemd? ( sys-apps/systemd )" +DEPEND=" + ${COMMON_DEPEND} + dev-go/go-md2man" +RDEPEND="${COMMON_DEPEND} + fuse? ( sys-fs/fuse-overlayfs )" + +RESTRICT="network-sandbox" + +PATCHES=( + "${FILESDIR}"/0001-Disable-Makefile-selinux-install-options.patch +) + +src_compile() { + local myargs=( + $(usex btrfs "" exclude_graphdriver_btrfs) + $(usev apparmor) + $(usev seccomp) + $(usev selinux) + $(usev systemd) + exclude_graphdriver_devicemapper + ) + local tags="${myargs[@]}" + + emake PREFIX=/usr BUILDTAGS="${tags}" +} + +src_install() { + emake install PREFIX=/usr DESTDIR="${D}" + + insinto /etc/containers + newins test/registries.conf registries.conf.example + newins test/policy.json policy.json.example + + insinto /usr/share/containers + doins vendor/github.com/containers/common/pkg/seccomp/seccomp.json + + newinitd "${FILESDIR}"/podman.initd podman + + insinto /etc/logrotate.d + newins "${FILESDIR}/podman.logrotated" podman + + dobashcomp completions/bash/* + + insinto /usr/share/zsh/site-functions + doins completions/zsh/* + + insinto /usr/share/fish/vendor_completions.d + doins completions/fish/* + + keepdir /var/lib/containers +} + +pkg_preinst() { + LIBPOD_ROOTLESS_UPGRADE=false + if use rootless; then + has_version 'app-emulation/libpod[rootless]' || LIBPOD_ROOTLESS_UPGRADE=true + fi +} + +pkg_postinst() { + local want_newline=false + if [[ ! ( -e ${EROOT%/*}/etc/containers/policy.json && -e ${EROOT%/*}/etc/containers/registries.conf ) ]]; then + elog "You need to create the following config files:" + elog "/etc/containers/registries.conf" + elog "/etc/containers/policy.json" + elog "To copy over default examples, use:" + elog "cp /etc/containers/registries.conf{.example,}" + elog "cp /etc/containers/policy.json{.example,}" + want_newline=true + fi + if [[ ${LIBPOD_ROOTLESS_UPGRADE} == true ]] ; then + ${want_newline} && elog "" + elog "For rootless operation, you need to configure subuid/subgid" + elog "for user running podman. In case subuid/subgid has only been" + elog "configured for root, run:" + elog "usermod --add-subuids 1065536-1131071 " + elog "usermod --add-subgids 1065536-1131071 " + want_newline=true + fi +}