Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-dev@l.g.o
Cc: gentoo-dev-announce@l.g.o
Subject: [gentoo-dev] [RFC] new tmpfilesd.eclass
Date: Wed, 15 Aug 2012 20:54:47
Message-Id: 20120815235757.14b3053e@sf
1 As gentoo switched to /var/run/ -> /run in tmpfs recently
2 people got into problems [1] of missing directories like:
3
4 /var/run/screen/
5 /var/run/openfire/
6 /var/run/proftpd/
7
8 they did bite me personally.
9
10 openrc-0.10 brought [2] basic support for systemd's tmpfiles'd:
11
12 http://0pointer.de/public/systemd-man/tmpfiles.d.html
13
14 But there is no simple way to install such helpers from ebuilds.
15 The tmpfiles.d is aimed to help in such situations.
16
17 I've picked proftpd as an example as it's situation is very similar
18 to screen's situation. There is inetd mode (opposed to standalone
19 mode) when you don't have any init.d code to create /var/run/
20 directories for you. Thus tmpfiles.d for the rescue.
21
22 See attach for the whole eclass code. It's almost a copy of Michał's
23 bash-completion-r1.eclass which I find very easy to use.
24
25 I'll show eclass usage example for proftpd:
26
27 --- proftpd-1.3.4a-r1.ebuild 2012-05-29 20:16:51.000000000 +0300
28 +++ proftpd-1.3.4a-r2.ebuild 2012-08-15 23:10:49.000000000 +0300
29 @@ -3,7 +3,7 @@
30 # $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 $
31
32 EAPI=4
33 -inherit eutils
34 +inherit eutils tmpfilesd
35
36 MOD_CASE="0.7"
37 MOD_CLAMAV="0.11rc"
38 @@ -216,6 +216,8 @@
39 docinto rfc
40 dodoc doc/rfc/*.txt
41 fi
42 +
43 + newtmpfilesd ${FILESDIR}/tmpfilesd.conf ${PN}.conf
44 }
45
46 pkg_postinst() {
47
48 The caveats:
49 - files get created only if I run /lib/rc/sh/tmpfiles.sh manually
50 - haven't tested with systemd, but i'd expect it to work
51
52 Thanks!
53
54 [1]: https://bugs.gentoo.org/show_bug.cgi?id=361349
55 [2]: https://bugs.gentoo.org/show_bug.cgi?id=396003
56
57 --
58
59 Sergei

Attachments

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

Replies

Subject Author
Re: [gentoo-dev] [RFC] new tmpfilesd.eclass "Michał Górny" <mgorny@g.o>
Re: [gentoo-dev] [RFC] new tmpfilesd.eclass William Hubbs <williamh@g.o>
Re: [gentoo-dev] [RFC] new tmpfilesd.eclass "Robin H. Johnson" <robbat2@g.o>