diff options
author | Joonas Niilola <juippis@gentoo.org> | 2022-09-08 09:38:36 +0300 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2022-09-08 09:42:12 +0300 |
commit | cb81fce5810abaf904df8bf3df43cb07b18bf376 (patch) | |
tree | 440496db5cc04150a34546ff23f5b8319a8af914 /sys-fs/lxcfs | |
parent | media-sound/schismtracker: Stabilize 20220807 x86, #869137 (diff) | |
download | gentoo-cb81fce5810abaf904df8bf3df43cb07b18bf376.tar.gz gentoo-cb81fce5810abaf904df8bf3df43cb07b18bf376.tar.bz2 gentoo-cb81fce5810abaf904df8bf3df43cb07b18bf376.zip |
sys-fs/lxcfs: tweak init/service files for fuse:3
- dependency is on fuse:3 instead of fuse:0,
- update openrc files to call fusermount3,
- update openrc files to have LXCFS_PATH config option,
- update systemd service file to call fusermount3.
Closes: https://bugs.gentoo.org/868477
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'sys-fs/lxcfs')
-rw-r--r-- | sys-fs/lxcfs/files/lxcfs-5.0.2.confd | 8 | ||||
-rw-r--r-- | sys-fs/lxcfs/files/lxcfs-5.0.2.initd | 27 | ||||
-rw-r--r-- | sys-fs/lxcfs/files/lxcfs-5.0.2.service | 18 | ||||
-rw-r--r-- | sys-fs/lxcfs/lxcfs-5.0.2-r1.ebuild | 77 |
4 files changed, 130 insertions, 0 deletions
diff --git a/sys-fs/lxcfs/files/lxcfs-5.0.2.confd b/sys-fs/lxcfs/files/lxcfs-5.0.2.confd new file mode 100644 index 000000000000..bc853aa681be --- /dev/null +++ b/sys-fs/lxcfs/files/lxcfs-5.0.2.confd @@ -0,0 +1,8 @@ +# /etc/conf.d/lxcfs: config file for /etc/init.d/lxcfs + +# lxcfs options: +# -l == calculate container load average instead of displaying host load average +# -u == don't display swap usage to containers + +LXCFS_OPTS="-l -u" +LXCFS_PATH="/var/lib/lxcfs" diff --git a/sys-fs/lxcfs/files/lxcfs-5.0.2.initd b/sys-fs/lxcfs/files/lxcfs-5.0.2.initd new file mode 100644 index 000000000000..f3119f2e8e82 --- /dev/null +++ b/sys-fs/lxcfs/files/lxcfs-5.0.2.initd @@ -0,0 +1,27 @@ +#!/sbin/openrc-run +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +DAEMON=/usr/bin/lxcfs +PIDFILE=/run/lxcfs.pid + +start() { + ebegin "Starting lxcfs." + /sbin/modprobe -q fuse + install -d "${LXCFS_PATH}" + start-stop-daemon --start \ + --pidfile ${PIDFILE} \ + --exec ${DAEMON} \ + --background \ + --make-pidfile \ + -- ${LXCFS_OPTS} \ + "${LXCFS_PATH}" + eend ${?} +} + +stop() { + ebegin "Stopping lxcfs." + /usr/bin/fusermount3 -u "${LXCFS_PATH}" + start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE} + eend ${?} +} diff --git a/sys-fs/lxcfs/files/lxcfs-5.0.2.service b/sys-fs/lxcfs/files/lxcfs-5.0.2.service new file mode 100644 index 000000000000..dc3dc9f18f63 --- /dev/null +++ b/sys-fs/lxcfs/files/lxcfs-5.0.2.service @@ -0,0 +1,18 @@ +[Unit] +Description=FUSE filesystem for LXC +ConditionVirtualization=!container +Before=lxc.service +Documentation=man:lxcfs(1) + +[Service] +ExecStartPre=/sbin/modprobe -q fuse +ExecStartPre=install -d /var/lib/lxcfs +ExecStart=/usr/bin/lxcfs /var/lib/lxcfs +KillMode=process +Restart=on-failure +ExecStopPost=-/usr/bin/fusermount3 -u /var/lib/lxcfs +Delegate=yes +ExecReload=/bin/kill -USR1 ${MAINPID} + +[Install] +WantedBy=multi-user.target diff --git a/sys-fs/lxcfs/lxcfs-5.0.2-r1.ebuild b/sys-fs/lxcfs/lxcfs-5.0.2-r1.ebuild new file mode 100644 index 000000000000..23eccfc4b1f7 --- /dev/null +++ b/sys-fs/lxcfs/lxcfs-5.0.2-r1.ebuild @@ -0,0 +1,77 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{9..11} ) + +inherit cmake meson python-any-r1 systemd verify-sig + +DESCRIPTION="FUSE filesystem for LXC" +HOMEPAGE="https://linuxcontainers.org/lxcfs/introduction/ https://github.com/lxc/lxcfs/" +SRC_URI="https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz + verify-sig? ( https://linuxcontainers.org/downloads/lxcfs/${P}.tar.gz.asc )" + +LICENSE="Apache-2.0 LGPL-2+" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~riscv ~x86" +IUSE="doc test" + +DEPEND="sys-fs/fuse:3" +RDEPEND="${DEPEND}" +BDEPEND="${PYTHON_DEPS} + $(python_gen_any_dep ' + dev-python/jinja[${PYTHON_USEDEP}] + ') + doc? ( sys-apps/help2man ) + verify-sig? ( sec-keys/openpgp-keys-linuxcontainers )" + +# Needs some black magic to work inside container/chroot. +RESTRICT="test" + +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/linuxcontainers.asc + +python_check_deps() { + python_has_version -b "dev-python/jinja[${PYTHON_USEDEP}]" +} + +pkg_setup() { + python-any-r1_pkg_setup +} + +src_prepare() { + default + + # Fix python shebangs for python-exec[-native-symlinks], #851480 + local shebangs=($(grep -rl "#!/usr/bin/env python3" || die)) + python_fix_shebang -q ${shebangs[*]} +} + +src_configure() { + local emesonargs=( + $(meson_use doc docs) + $(meson_use test tests) + + -Dfuse-version=3 + -Dinit-script="" + -Dwith-init-script="" + ) + + meson_src_configure +} + +src_test() { + cd "${BUILD_DIR}"/tests || die "failed to change into tests/ directory." + ./main.sh || die +} + +src_install() { + meson_src_install + + newconfd "${FILESDIR}"/lxcfs-5.0.2.confd lxcfs + newinitd "${FILESDIR}"/lxcfs-5.0.2.initd lxcfs + + # Provide our own service file (copy of upstream) due to paths being different from upstream, + # #728470 + systemd_newunit "${FILESDIR}"/lxcfs-5.0.2.service lxcfs.service +} |