Gentoo Archives: gentoo-dev-announce

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-dev@l.g.o
Cc: gentoo-dev-announce@l.g.o
Subject: [gentoo-dev-announce] [RFC] new tmpfilesd.eclass
Date: Thu, 16 Aug 2012 00:05:07
Message-Id: 20120815235757.14b3053e@sf
As gentoo switched to /var/run/ -> /run in tmpfs recently
people got into problems [1] of missing directories like:


they did bite me personally.

openrc-0.10 brought [2] basic support for systemd's tmpfiles'd:

But there is no simple way to install such helpers from ebuilds.
The tmpfiles.d is aimed to help in such situations.

I've picked proftpd as an example as it's situation is very similar
to screen's situation. There is inetd mode (opposed to standalone
mode) when you don't have any init.d code to create /var/run/
directories for you. Thus tmpfiles.d for the rescue.

See attach for the whole eclass code. It's almost a copy of MichaƂ's
bash-completion-r1.eclass which I find very easy to use.

I'll show eclass usage example for proftpd:

--- proftpd-1.3.4a-r1.ebuild    2012-05-29 20:16:51.000000000 +0300
+++ proftpd-1.3.4a-r2.ebuild    2012-08-15 23:10:49.000000000 +0300
@@ -3,7 +3,7 @@
 # $Header: /var/cvsroot/gentoo-x86/net-ftp/proftpd/proftpd-1.3.4a-r1.ebuild,v 1.2 2012/05/13 10:49:47 swift Exp $
-inherit eutils
+inherit eutils tmpfilesd
@@ -216,6 +216,8 @@
                docinto rfc
                dodoc doc/rfc/*.txt
+       newtmpfilesd ${FILESDIR}/tmpfilesd.conf ${PN}.conf
 pkg_postinst() {

The caveats:
- files get created only if I run /lib/rc/sh/ manually
- haven't tested with systemd, but i'd expect it to work






File name MIME type
tmpfilesd.eclass application/octet-stream
signature.asc application/pgp-signature