On Tue, 15 Nov 2016 17:17:46 -0600 William Hubbs <willi...@gentoo.org> wrote:
> # Copyright 1999-2016 Gentoo Foundation > # Distributed under the terms of the GNU General Public License v2 > # $Id$ > > # @ECLASS: tmpfiles.eclass > # @MAINTAINER: > # Gentoo systemd project <syst...@gentoo.org> > # William Hubbs <willi...@gentoo.org> > # @AUTHOR: > # Mike Gilbert <flop...@gentoo.org> > # William Hubbs <willi...@gentoo.org> > # @BLURB: Functions related to tmpfiles.d files > # @DESCRIPTION: > # This eclass provides functionality related to installing and > # creating volatile and temporary files based on configuration files$and > # locations defined at this URL: > # > # https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html > # > # the dotmpfiles.d and newtmpfiles.d functions are used to install > # configuration files into /usr/lib, then in pkg_postinst, the > # tmpfiles.d_create function can be called to process the newly > # installed tmpfiles.d entries. > # > # @EXAMPLE: > # Typical usage of this eclass: > # > # @CODE > # EAPI=6 > # inherit tmpfiles > # > # ... > # > # src_install() { > # ... > # dotmpfiles.d "${FILESDIR}"/file1.conf "${FILESDIR}"/file2.conf > # newtmpfiles.d "${FILESDIR}"/file3 file3.conf Maybe something more realistic: newtmpfiles.d "${FILESDIR}"/file3.conf-r1 file3.conf > # @FUNCTION: tmpfiles.d_create I still don't like the function name. It suggests that it creates a tmpfiles.d file which is going to be confusing. Furthermore, I'm not convinced about the 'tmpfiles.d' prefix here. The eclass is named 'tmpfiles' after all. So... tmpfiles_apply? > # @USAGE: tmpfiles.d_create <filename> <filename> ... By the way, are we going to allow passing additional options here? Maybe we should assert for that. > # @DESCRIPTION: > # Call a tmpfiles.d implementation to create new volatile and temporary > # files and directories. > tmpfiles.d_create() { > debug-print-function "${FUNCNAME}" "$@" > > [[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in > pkg_postinst" > [[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one > filename" > [[ ${ROOT} == / ]] || return 0 > > if type systemd-tmpfiles &> /dev/null; then > systemd-tmpfiles --create "$@" > elif type opentmptmpfiles &> /dev/null; then > opentmpfiles --create "$@" > fi > } > > fi -- Best regards, Michał Górny <http://dev.gentoo.org/~mgorny/>
pgpeoZRapl7RS.pgp
Description: OpenPGP digital signature