Le dimanche 08 septembre 2013 à 13:12 +0200, Michał Górny a écrit : > This function can be used to install service configuration templates. > Usage: > > systemd_install_serviced "${FILESDIR}"/foo.service.conf > > or: > > systemd_install_serviced "${FILESDIR}"/barbaz foo.service > > with the latter specifying related service name explicitly, former > expecting it to match ${basename%.conf}. The files are installed as: > > /etc/systemd/system/foo.service.d/00gentoo.conf > > They should be commented out templates that users can use to customize > the service easily.
Looks like a good idea, do you have a few example packages where that could be used ? > --- > gx86/eclass/systemd.eclass | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/gx86/eclass/systemd.eclass b/gx86/eclass/systemd.eclass > index 4566631..1575b78 100644 > --- a/gx86/eclass/systemd.eclass > +++ b/gx86/eclass/systemd.eclass > @@ -131,6 +131,32 @@ systemd_newunit() { > newins "${@}" > } > > +# @FUNCTION: systemd_install_serviced > +# @USAGE: <conf-file> [<service.d>] > +# @DESCRIPTION: > +# Install the file <conf-file> as service.d/00gentoo.conf template. > +# The <service.d> argument specifies the configured service name. > +# If not specified, the configuration file name will be used with .conf > +# suffix stripped (e.g. foo.service.conf -> foo.service). > +systemd_install_serviced() { > + debug-print-function ${FUNCNAME} "${@}" > + > + local src=${1} > + local service=${2} > + > + if [[ ! ${service} ]]; then > + [[ ${src} == *.conf ]] || die "Source file needs .conf suffix" > + service=${src##*/} > + service=${service%.conf} > + fi > + # avoid potentially common mistake > + [[ ${service} != *.d ]] || die "Service must not have .d suffix" > + > + local INSDESTTREE I guess this is a leftover ? > + insinto /etc/systemd/system/"${service}".d > + newins "${src}" 00gentoo.conf > +} > + > # @FUNCTION: systemd_dotmpfilesd > # @USAGE: tmpfilesd1 [...] > # @DESCRIPTION: -- Gilles Dartiguelongue <e...@gentoo.org> Gentoo