Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/lxcfs/files/, sys-fs/lxcfs/
Date: Thu, 08 Sep 2022 06:43:16
Message-Id: 1662619332.cb81fce5810abaf904df8bf3df43cb07b18bf376.juippis@gentoo
1 commit: cb81fce5810abaf904df8bf3df43cb07b18bf376
2 Author: Joonas Niilola <juippis <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 8 06:38:36 2022 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 8 06:42:12 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb81fce5
7
8 sys-fs/lxcfs: tweak init/service files for fuse:3
9
10 - dependency is on fuse:3 instead of fuse:0,
11 - update openrc files to call fusermount3,
12 - update openrc files to have LXCFS_PATH config option,
13 - update systemd service file to call fusermount3.
14
15 Closes: https://bugs.gentoo.org/868477
16 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
17
18 sys-fs/lxcfs/files/lxcfs-5.0.2.confd | 8 ++++
19 sys-fs/lxcfs/files/lxcfs-5.0.2.initd | 27 ++++++++++++
20 sys-fs/lxcfs/files/lxcfs-5.0.2.service | 18 ++++++++
21 sys-fs/lxcfs/lxcfs-5.0.2-r1.ebuild | 77 ++++++++++++++++++++++++++++++++++
22 4 files changed, 130 insertions(+)
23
24 diff --git a/sys-fs/lxcfs/files/lxcfs-5.0.2.confd b/sys-fs/lxcfs/files/lxcfs-5.0.2.confd
25 new file mode 100644
26 index 000000000000..bc853aa681be
27 --- /dev/null
28 +++ b/sys-fs/lxcfs/files/lxcfs-5.0.2.confd
29 @@ -0,0 +1,8 @@
30 +# /etc/conf.d/lxcfs: config file for /etc/init.d/lxcfs
31 +
32 +# lxcfs options:
33 +# -l == calculate container load average instead of displaying host load average
34 +# -u == don't display swap usage to containers
35 +
36 +LXCFS_OPTS="-l -u"
37 +LXCFS_PATH="/var/lib/lxcfs"
38
39 diff --git a/sys-fs/lxcfs/files/lxcfs-5.0.2.initd b/sys-fs/lxcfs/files/lxcfs-5.0.2.initd
40 new file mode 100644
41 index 000000000000..f3119f2e8e82
42 --- /dev/null
43 +++ b/sys-fs/lxcfs/files/lxcfs-5.0.2.initd
44 @@ -0,0 +1,27 @@
45 +#!/sbin/openrc-run
46 +# Copyright 1999-2022 Gentoo Authors
47 +# Distributed under the terms of the GNU General Public License v2
48 +
49 +DAEMON=/usr/bin/lxcfs
50 +PIDFILE=/run/lxcfs.pid
51 +
52 +start() {
53 + ebegin "Starting lxcfs."
54 + /sbin/modprobe -q fuse
55 + install -d "${LXCFS_PATH}"
56 + start-stop-daemon --start \
57 + --pidfile ${PIDFILE} \
58 + --exec ${DAEMON} \
59 + --background \
60 + --make-pidfile \
61 + -- ${LXCFS_OPTS} \
62 + "${LXCFS_PATH}"
63 + eend ${?}
64 +}
65 +
66 +stop() {
67 + ebegin "Stopping lxcfs."
68 + /usr/bin/fusermount3 -u "${LXCFS_PATH}"
69 + start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE}
70 + eend ${?}
71 +}
72
73 diff --git a/sys-fs/lxcfs/files/lxcfs-5.0.2.service b/sys-fs/lxcfs/files/lxcfs-5.0.2.service
74 new file mode 100644
75 index 000000000000..dc3dc9f18f63
76 --- /dev/null
77 +++ b/sys-fs/lxcfs/files/lxcfs-5.0.2.service
78 @@ -0,0 +1,18 @@
79 +[Unit]
80 +Description=FUSE filesystem for LXC
81 +ConditionVirtualization=!container
82 +Before=lxc.service
83 +Documentation=man:lxcfs(1)
84 +
85 +[Service]
86 +ExecStartPre=/sbin/modprobe -q fuse
87 +ExecStartPre=install -d /var/lib/lxcfs
88 +ExecStart=/usr/bin/lxcfs /var/lib/lxcfs
89 +KillMode=process
90 +Restart=on-failure
91 +ExecStopPost=-/usr/bin/fusermount3 -u /var/lib/lxcfs
92 +Delegate=yes
93 +ExecReload=/bin/kill -USR1 ${MAINPID}
94 +
95 +[Install]
96 +WantedBy=multi-user.target
97
98 diff --git a/sys-fs/lxcfs/lxcfs-5.0.2-r1.ebuild b/sys-fs/lxcfs/lxcfs-5.0.2-r1.ebuild
99 new file mode 100644
100 index 000000000000..23eccfc4b1f7
101 --- /dev/null
102 +++ b/sys-fs/lxcfs/lxcfs-5.0.2-r1.ebuild
103 @@ -0,0 +1,77 @@
104 +# Copyright 2022 Gentoo Authors
105 +# Distributed under the terms of the GNU General Public License v2
106 +
107 +EAPI=8
108 +
109 +PYTHON_COMPAT=( python3_{9..11} )
110 +
111 +inherit cmake meson python-any-r1 systemd verify-sig
112 +
113 +DESCRIPTION="FUSE filesystem for LXC"
114 +HOMEPAGE="https://linuxcontainers.org/lxcfs/introduction/ https://github.com/lxc/lxcfs/"
115 +SRC_URI="https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz
116 + verify-sig? ( https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz.asc )"
117 +
118 +LICENSE="Apache-2.0 LGPL-2+"
119 +SLOT="0"
120 +KEYWORDS="~amd64 ~arm64 ~riscv ~x86"
121 +IUSE="doc test"
122 +
123 +DEPEND="sys-fs/fuse:3"
124 +RDEPEND="${DEPEND}"
125 +BDEPEND="${PYTHON_DEPS}
126 + $(python_gen_any_dep '
127 + dev-python/jinja[${PYTHON_USEDEP}]
128 + ')
129 + doc? ( sys-apps/help2man )
130 + verify-sig? ( sec-keys/openpgp-keys-linuxcontainers )"
131 +
132 +# Needs some black magic to work inside container/chroot.
133 +RESTRICT="test"
134 +
135 +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/linuxcontainers.asc
136 +
137 +python_check_deps() {
138 + python_has_version -b "dev-python/jinja[${PYTHON_USEDEP}]"
139 +}
140 +
141 +pkg_setup() {
142 + python-any-r1_pkg_setup
143 +}
144 +
145 +src_prepare() {
146 + default
147 +
148 + # Fix python shebangs for python-exec[-native-symlinks], #851480
149 + local shebangs=($(grep -rl "#!/usr/bin/env python3" || die))
150 + python_fix_shebang -q ${shebangs[*]}
151 +}
152 +
153 +src_configure() {
154 + local emesonargs=(
155 + $(meson_use doc docs)
156 + $(meson_use test tests)
157 +
158 + -Dfuse-version=3
159 + -Dinit-script=""
160 + -Dwith-init-script=""
161 + )
162 +
163 + meson_src_configure
164 +}
165 +
166 +src_test() {
167 + cd "${BUILD_DIR}"/tests || die "failed to change into tests/ directory."
168 + ./main.sh || die
169 +}
170 +
171 +src_install() {
172 + meson_src_install
173 +
174 + newconfd "${FILESDIR}"/lxcfs-5.0.2.confd lxcfs
175 + newinitd "${FILESDIR}"/lxcfs-5.0.2.initd lxcfs
176 +
177 + # Provide our own service file (copy of upstream) due to paths being different from upstream,
178 + # #728470
179 + systemd_newunit "${FILESDIR}"/lxcfs-5.0.2.service lxcfs.service
180 +}