public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Gilles Dartiguelongue <eva@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_install_serviced().
Date: Sun, 08 Sep 2013 17:14:54 +0200	[thread overview]
Message-ID: <1378653294.997.1.camel@kanae> (raw)
In-Reply-To: <1378638746-8626-1-git-send-email-mgorny@gentoo.org>

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 <eva@gentoo.org>
Gentoo



  reply	other threads:[~2013-09-08 15:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-08 11:12 [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_install_serviced() Michał Górny
2013-09-08 15:14 ` Gilles Dartiguelongue [this message]
2013-09-08 15:40   ` Pacho Ramos
2013-09-08 15:46   ` Michał Górny
2013-09-08 21:29     ` Alexis Ballier
2013-09-10 10:57 ` [gentoo-dev] " Steven J. Long
2013-09-10 16:36   ` Michał Górny
2013-09-10 17:28     ` Mike Gilbert
2013-09-12 11:48 ` [gentoo-dev] " Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378653294.997.1.camel@kanae \
    --to=eva@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox