1 |
Le dimanche 08 septembre 2013 à 13:12 +0200, Michał Górny a écrit : |
2 |
> This function can be used to install service configuration templates. |
3 |
> Usage: |
4 |
> |
5 |
> systemd_install_serviced "${FILESDIR}"/foo.service.conf |
6 |
> |
7 |
> or: |
8 |
> |
9 |
> systemd_install_serviced "${FILESDIR}"/barbaz foo.service |
10 |
> |
11 |
> with the latter specifying related service name explicitly, former |
12 |
> expecting it to match ${basename%.conf}. The files are installed as: |
13 |
> |
14 |
> /etc/systemd/system/foo.service.d/00gentoo.conf |
15 |
> |
16 |
> They should be commented out templates that users can use to customize |
17 |
> the service easily. |
18 |
|
19 |
Looks like a good idea, do you have a few example packages where that |
20 |
could be used ? |
21 |
|
22 |
> --- |
23 |
> gx86/eclass/systemd.eclass | 26 ++++++++++++++++++++++++++ |
24 |
> 1 file changed, 26 insertions(+) |
25 |
> |
26 |
> diff --git a/gx86/eclass/systemd.eclass b/gx86/eclass/systemd.eclass |
27 |
> index 4566631..1575b78 100644 |
28 |
> --- a/gx86/eclass/systemd.eclass |
29 |
> +++ b/gx86/eclass/systemd.eclass |
30 |
> @@ -131,6 +131,32 @@ systemd_newunit() { |
31 |
> newins "${@}" |
32 |
> } |
33 |
> |
34 |
> +# @FUNCTION: systemd_install_serviced |
35 |
> +# @USAGE: <conf-file> [<service.d>] |
36 |
> +# @DESCRIPTION: |
37 |
> +# Install the file <conf-file> as service.d/00gentoo.conf template. |
38 |
> +# The <service.d> argument specifies the configured service name. |
39 |
> +# If not specified, the configuration file name will be used with .conf |
40 |
> +# suffix stripped (e.g. foo.service.conf -> foo.service). |
41 |
> +systemd_install_serviced() { |
42 |
> + debug-print-function ${FUNCNAME} "${@}" |
43 |
> + |
44 |
> + local src=${1} |
45 |
> + local service=${2} |
46 |
> + |
47 |
> + if [[ ! ${service} ]]; then |
48 |
> + [[ ${src} == *.conf ]] || die "Source file needs .conf suffix" |
49 |
> + service=${src##*/} |
50 |
> + service=${service%.conf} |
51 |
> + fi |
52 |
> + # avoid potentially common mistake |
53 |
> + [[ ${service} != *.d ]] || die "Service must not have .d suffix" |
54 |
> + |
55 |
> + local INSDESTTREE |
56 |
|
57 |
I guess this is a leftover ? |
58 |
|
59 |
> + insinto /etc/systemd/system/"${service}".d |
60 |
> + newins "${src}" 00gentoo.conf |
61 |
> +} |
62 |
> + |
63 |
> # @FUNCTION: systemd_dotmpfilesd |
64 |
> # @USAGE: tmpfilesd1 [...] |
65 |
> # @DESCRIPTION: |
66 |
|
67 |
-- |
68 |
Gilles Dartiguelongue <eva@g.o> |
69 |
Gentoo |