2015-11-15 01:14:34 +01:00
|
|
|
# -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
|
2017-11-18 18:18:16 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1+
|
2012-06-21 22:14:17 +02:00
|
|
|
#
|
|
|
|
# This file is part of systemd.
|
|
|
|
|
|
|
|
# RPM macros for packages installing systemd unit files
|
|
|
|
|
|
|
|
%_unitdir @systemunitdir@
|
2013-06-17 18:37:07 +02:00
|
|
|
%_userunitdir @userunitdir@
|
2012-09-13 22:17:46 +02:00
|
|
|
%_presetdir @systempresetdir@
|
2017-08-09 09:45:02 +02:00
|
|
|
%_userpresetdir @userpresetdir@
|
2012-11-16 19:54:19 +01:00
|
|
|
%_udevhwdbdir @udevhwdbdir@
|
|
|
|
%_udevrulesdir @udevrulesdir@
|
|
|
|
%_journalcatalogdir @catalogdir@
|
2014-06-13 19:18:55 +02:00
|
|
|
%_binfmtdir @binfmtdir@
|
2018-05-19 17:02:37 +02:00
|
|
|
%_sysctldir @sysctldir@
|
|
|
|
%_sysusersdir @sysusersdir@
|
|
|
|
%_tmpfilesdir @tmpfilesdir@
|
2018-06-25 18:56:50 +02:00
|
|
|
%_environmentdir @environmentdir@
|
2018-05-19 17:02:37 +02:00
|
|
|
%_modulesloaddir @modulesloaddir@
|
|
|
|
%_modprobedir @modprobedir@
|
2016-07-15 09:35:49 +02:00
|
|
|
%_systemdgeneratordir @systemgeneratordir@
|
|
|
|
%_systemdusergeneratordir @usergeneratordir@
|
manager: run environment generators
Environment file generators are a lot like unit file generators, but not
exactly:
1. environment file generators are run for each manager instance, and their
output is (or at least can be) individualized.
The generators themselves are system-wide, the same for all users.
2. environment file generators are run sequentially, in priority order.
Thus, the lifetime of those files is tied to lifecycle of the manager
instance. Because generators are run sequentially, later generators can use or
modify the output of earlier generators.
Each generator is run with no arguments, and the whole state is stored in the
environment variables. The generator can echo a set of variable assignments to
standard output:
VAR_A=something
VAR_B=something else
This output is parsed, and the next and subsequent generators run with those
updated variables in the environment. After the last generator is done, the
environment that the manager itself exports is updated.
Each generator must return 0, otherwise the output is ignored.
The generators in */user-env-generator are for the user session managers,
including root, and the ones in */system-env-generator are for pid1.
2017-01-22 07:13:47 +01:00
|
|
|
%_systemd_system_env_generator_dir @systemenvgeneratordir@
|
|
|
|
%_systemd_user_env_generator_dir @userenvgeneratordir@
|
2012-06-21 22:14:17 +02:00
|
|
|
|
2018-06-26 13:42:29 +02:00
|
|
|
# Because we had one release with a typo...
|
|
|
|
# This is temporary (Remove after systemd 240 is released)
|
2018-07-03 15:40:53 +02:00
|
|
|
%_environmnentdir %{warn:Use %%_environmentdir instead}%_environmentdir
|
2018-06-26 13:42:29 +02:00
|
|
|
|
2012-06-21 22:14:17 +02:00
|
|
|
%systemd_requires \
|
|
|
|
Requires(post): systemd \
|
|
|
|
Requires(preun): systemd \
|
|
|
|
Requires(postun): systemd \
|
|
|
|
%{nil}
|
|
|
|
|
2016-07-22 15:33:13 +02:00
|
|
|
%systemd_ordering \
|
|
|
|
OrderWithRequires(post): systemd \
|
|
|
|
OrderWithRequires(preun): systemd \
|
|
|
|
OrderWithRequires(postun): systemd \
|
|
|
|
%{nil}
|
|
|
|
|
2012-06-21 22:14:17 +02:00
|
|
|
%systemd_post() \
|
|
|
|
if [ $1 -eq 1 ] ; then \
|
|
|
|
# Initial installation \
|
2018-05-19 13:04:21 +02:00
|
|
|
systemctl --no-reload preset %{?*} &>/dev/null || : \
|
2012-06-21 22:14:17 +02:00
|
|
|
fi \
|
|
|
|
%{nil}
|
|
|
|
|
2018-05-19 13:01:55 +02:00
|
|
|
%systemd_user_post() %{expand:%systemd_post \\--global %%{?*}}
|
2014-10-28 03:34:09 +01:00
|
|
|
|
2012-06-21 22:14:17 +02:00
|
|
|
%systemd_preun() \
|
|
|
|
if [ $1 -eq 0 ] ; then \
|
|
|
|
# Package removal, not upgrade \
|
2018-05-19 13:04:21 +02:00
|
|
|
systemctl --no-reload disable --now %{?*} &>/dev/null || : \
|
2012-06-21 22:14:17 +02:00
|
|
|
fi \
|
|
|
|
%{nil}
|
|
|
|
|
2014-10-28 03:34:09 +01:00
|
|
|
%systemd_user_preun() \
|
|
|
|
if [ $1 -eq 0 ] ; then \
|
|
|
|
# Package removal, not upgrade \
|
2018-05-19 13:04:21 +02:00
|
|
|
systemctl --global disable %{?*} &>/dev/null || : \
|
2014-10-28 03:34:09 +01:00
|
|
|
fi \
|
|
|
|
%{nil}
|
|
|
|
|
2015-11-15 01:14:34 +01:00
|
|
|
%systemd_postun() %{nil}
|
2012-06-21 22:14:17 +02:00
|
|
|
|
2014-10-28 03:34:09 +01:00
|
|
|
%systemd_user_postun() %{nil}
|
|
|
|
|
2012-06-21 22:14:17 +02:00
|
|
|
%systemd_postun_with_restart() \
|
|
|
|
if [ $1 -ge 1 ] ; then \
|
|
|
|
# Package upgrade, not uninstall \
|
2018-05-19 13:04:21 +02:00
|
|
|
systemctl try-restart %{?*} &>/dev/null || : \
|
2012-06-21 22:14:17 +02:00
|
|
|
fi \
|
|
|
|
%{nil}
|
2012-11-16 19:54:19 +01:00
|
|
|
|
2014-10-28 03:34:09 +01:00
|
|
|
%systemd_user_postun_with_restart() %{nil}
|
|
|
|
|
Add more file triggers to handle more aspects of systemd (#8090)
For quite a while now, there have been file triggers to handle
automatically setting up service units in upstream systemd. However,
most of the actions being done by these macros upon files can be set up
as RPM file triggers.
In fact, in Mageia, we had been doing this for most of these. In particular,
we have file triggers in place for sysusers, tmpfiles, hwdb, and the journal.
This change adds Lua versions of the original file triggers used in Mageia,
based on the existing Lua-based file triggers for service units.
In addition, we can also have useful file triggers for udev rules, sysctl
directives, and binfmt directives. These are based on the other existing
file triggers.
2018-02-06 10:11:36 +01:00
|
|
|
%udev_hwdb_update() %{nil}
|
2012-11-16 19:54:19 +01:00
|
|
|
|
Add more file triggers to handle more aspects of systemd (#8090)
For quite a while now, there have been file triggers to handle
automatically setting up service units in upstream systemd. However,
most of the actions being done by these macros upon files can be set up
as RPM file triggers.
In fact, in Mageia, we had been doing this for most of these. In particular,
we have file triggers in place for sysusers, tmpfiles, hwdb, and the journal.
This change adds Lua versions of the original file triggers used in Mageia,
based on the existing Lua-based file triggers for service units.
In addition, we can also have useful file triggers for udev rules, sysctl
directives, and binfmt directives. These are based on the other existing
file triggers.
2018-02-06 10:11:36 +01:00
|
|
|
%udev_rules_update() %{nil}
|
2012-11-16 19:54:19 +01:00
|
|
|
|
Add more file triggers to handle more aspects of systemd (#8090)
For quite a while now, there have been file triggers to handle
automatically setting up service units in upstream systemd. However,
most of the actions being done by these macros upon files can be set up
as RPM file triggers.
In fact, in Mageia, we had been doing this for most of these. In particular,
we have file triggers in place for sysusers, tmpfiles, hwdb, and the journal.
This change adds Lua versions of the original file triggers used in Mageia,
based on the existing Lua-based file triggers for service units.
In addition, we can also have useful file triggers for udev rules, sysctl
directives, and binfmt directives. These are based on the other existing
file triggers.
2018-02-06 10:11:36 +01:00
|
|
|
%journal_catalog_update() %{nil}
|
2013-07-16 18:15:48 +02:00
|
|
|
|
2018-02-05 15:02:07 +01:00
|
|
|
# Deprecated. Use %tmpfiles_create_package instead
|
2013-07-16 18:15:48 +02:00
|
|
|
%tmpfiles_create() \
|
2018-05-19 13:04:21 +02:00
|
|
|
systemd-tmpfiles --create %{?*} &>/dev/null || : \
|
2013-07-16 18:15:48 +02:00
|
|
|
%{nil}
|
2014-06-13 19:18:55 +02:00
|
|
|
|
2018-01-31 16:07:59 +01:00
|
|
|
# Deprecated. Use %sysusers_create_package instead
|
2014-06-13 19:18:55 +02:00
|
|
|
%sysusers_create() \
|
2018-05-19 13:04:21 +02:00
|
|
|
systemd-sysusers %{?*} &>/dev/null || : \
|
2014-06-13 19:18:55 +02:00
|
|
|
%{nil}
|
|
|
|
|
2014-08-19 02:16:27 +02:00
|
|
|
%sysusers_create_inline() \
|
2018-05-19 13:04:21 +02:00
|
|
|
systemd-sysusers - <<SYSTEMD_INLINE_EOF &>/dev/null || : \
|
2018-03-19 18:05:49 +01:00
|
|
|
%{?*} \
|
2018-03-19 09:07:44 +01:00
|
|
|
SYSTEMD_INLINE_EOF \
|
2014-08-19 02:16:27 +02:00
|
|
|
%{nil}
|
|
|
|
|
2018-02-05 15:02:07 +01:00
|
|
|
# This should be used by package installation scripts which require users or
|
|
|
|
# groups to be present before the files installed by the package are present on
|
|
|
|
# disk (for example because some files are owned by those users or groups).
|
2018-01-31 16:07:59 +01:00
|
|
|
#
|
|
|
|
# Example:
|
2018-02-05 15:02:07 +01:00
|
|
|
# Source1: %{name}-sysusers.conf
|
2018-01-31 16:07:59 +01:00
|
|
|
# ...
|
|
|
|
# %install
|
2018-02-05 15:02:07 +01:00
|
|
|
# install -D %SOURCE1 %{buildroot}%{_sysusersdir}/%{name}.conf
|
2018-01-31 16:07:59 +01:00
|
|
|
# %pre
|
|
|
|
# %sysusers_create_package %{name} %SOURCE1
|
|
|
|
# %files
|
2018-02-05 15:02:07 +01:00
|
|
|
# %{_sysusersdir}/%{name}.conf
|
2018-01-31 16:07:59 +01:00
|
|
|
%sysusers_create_package() \
|
2018-05-19 13:04:21 +02:00
|
|
|
systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF &>/dev/null || : \
|
2018-03-19 09:07:44 +01:00
|
|
|
%(cat %2) \
|
|
|
|
SYSTEMD_INLINE_EOF \
|
2018-01-31 16:07:59 +01:00
|
|
|
%{nil}
|
|
|
|
|
2018-02-05 15:02:07 +01:00
|
|
|
# This may be used by package installation scripts to create files according to
|
|
|
|
# their tmpfiles configuration from a package installation script, even before
|
|
|
|
# the files of that package are installed on disk.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# Source1: %{name}-tmpfiles.conf
|
|
|
|
# ...
|
|
|
|
# %install
|
|
|
|
# install -D %SOURCE1 %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
|
|
|
# %pre
|
|
|
|
# %tmpfiles_create_package %{name} %SOURCE1
|
|
|
|
# %files
|
|
|
|
# %{_tmpfilesdir}/%{name}.conf
|
|
|
|
%tmpfiles_create_package() \
|
2018-05-19 13:04:21 +02:00
|
|
|
systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - <<SYSTEMD_INLINE_EOF &>/dev/null || : \
|
2018-03-19 09:07:44 +01:00
|
|
|
%(cat %2) \
|
|
|
|
SYSTEMD_INLINE_EOF \
|
2018-02-05 15:02:07 +01:00
|
|
|
%{nil}
|
|
|
|
|
2014-06-13 19:18:55 +02:00
|
|
|
%sysctl_apply() \
|
2018-05-19 13:04:21 +02:00
|
|
|
@rootlibexecdir@/systemd-sysctl %{?*} &>/dev/null || : \
|
2014-06-13 19:18:55 +02:00
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%binfmt_apply() \
|
2018-05-19 13:04:21 +02:00
|
|
|
@rootlibexecdir@/systemd-binfmt %{?*} &>/dev/null || : \
|
2014-06-13 19:18:55 +02:00
|
|
|
%{nil}
|