|
|
|
@@ -1,10 +1,9 @@
|
|
|
|
|
# -*- Mode: rpm-spec; indent-tabs-mode: t -*-
|
|
|
|
|
# -*- mode: shell-script; indent-tabs-mode: t -*-
|
|
|
|
|
# RPM macros for packages installing systemd unit files
|
|
|
|
|
#
|
|
|
|
|
###
|
|
|
|
|
#
|
|
|
|
|
# When a package install systemd unit files, it should use the
|
|
|
|
|
# following macros:
|
|
|
|
|
# When a package install systemd unit files, it should use the following macros:
|
|
|
|
|
#
|
|
|
|
|
# add %systemd_requires in the specfile
|
|
|
|
|
#
|
|
|
|
@@ -21,10 +20,10 @@
|
|
|
|
|
# %service_del_postun demo.service
|
|
|
|
|
# %service_del_postun_without_restart demo.service
|
|
|
|
|
#
|
|
|
|
|
# Note: the upstream variants are also available and are aliases to
|
|
|
|
|
# their SUSE counterparts. However for consistency the SUSE macros
|
|
|
|
|
# should be preferred unless the package is intended to be portable
|
|
|
|
|
# across multiple distributions based on RPM.
|
|
|
|
|
# Note: the upstream variants are also available and are aliases to their SUSE
|
|
|
|
|
# counterparts. However for consistency the SUSE macros should be preferred
|
|
|
|
|
# unless the package is intended to be portable across multiple distributions
|
|
|
|
|
# based on RPM.
|
|
|
|
|
|
|
|
|
|
%_systemd_util_dir /usr/lib/systemd
|
|
|
|
|
%_unitdir /usr/lib/systemd/system
|
|
|
|
@@ -175,7 +174,7 @@ fi \
|
|
|
|
|
%systemd_user_preun() \
|
|
|
|
|
%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_user_preun}} \
|
|
|
|
|
if [ $1 -eq 0 ] && [ -x /usr/lib/systemd/systemd-update-helper ]; then \
|
|
|
|
|
# Package removal, not upgrade \
|
|
|
|
|
# Package removal, not upgrade \
|
|
|
|
|
/usr/lib/systemd/systemd-update-helper remove-user-units %{?*} || : \
|
|
|
|
|
fi \
|
|
|
|
|
%{nil}
|
|
|
|
@@ -188,25 +187,24 @@ fi \
|
|
|
|
|
%systemd_user_postun_with_restart() \
|
|
|
|
|
%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# systemd_user_postun_with_restart}} \
|
|
|
|
|
if [ $1 -ge 1 ] && [ -x /usr/lib/systemd/systemd-update-helper ]; then \
|
|
|
|
|
# Package upgrade, not uninstall \
|
|
|
|
|
/usr/lib/systemd/systemd-update-helper mark-restart-user-units %{?*} || : \
|
|
|
|
|
# Package upgrade, not uninstall \
|
|
|
|
|
/usr/lib/systemd/systemd-update-helper mark-restart-user-units %{?*} || : \
|
|
|
|
|
fi \
|
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# The following macros are empty as we have file triggers in place for hwdb,
|
|
|
|
|
# journal catalog, udev rules, binfmt and sysctl.
|
|
|
|
|
# The following macros are empty as systemd trans-file-triggers are in place for
|
|
|
|
|
# hwdb, journal catalog, udev rules, binfmt and sysctl.
|
|
|
|
|
#
|
|
|
|
|
# Note: 'sysctl_apply' and 'binfmt_apply' don't have any users that rely on
|
|
|
|
|
# their immediate effect.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
%udev_hwdb_update() :%{nil}
|
|
|
|
|
|
|
|
|
|
%udev_rules_update() :%{nil}
|
|
|
|
|
|
|
|
|
|
%journal_catalog_update() :%{nil}
|
|
|
|
|
|
|
|
|
|
# Currently the 2 following macros don't have any interesting users. Leave them
|
|
|
|
|
# empty until a specific need appears.
|
|
|
|
|
|
|
|
|
|
%sysctl_apply() \
|
|
|
|
|
%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# sysctl_apply}} \
|
|
|
|
|
: \
|
|
|
|
@@ -217,26 +215,42 @@ fi \
|
|
|
|
|
: \
|
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
|
|
# For cases where the sysusers or tmpfiles data need to be created in advance
|
|
|
|
|
# (when a system user needs to be installed in %%pre so proper ownership are
|
|
|
|
|
# used when package's files are installed for example) then use the
|
|
|
|
|
# '*_create_package()' variants.
|
|
|
|
|
#
|
|
|
|
|
# FIXME: these macros could be converted to NOPs since we moved to file
|
|
|
|
|
# triggers. However some packages might assume that the macros effects are
|
|
|
|
|
# effective as soon as the macros return. This reason is actually moot since
|
|
|
|
|
# this can't work on transactional systems anyway.
|
|
|
|
|
# This should be used when a package needs to execute the shipped udev rules
|
|
|
|
|
# during its installation. It automatically triggers a reload of the rule files,
|
|
|
|
|
# as this step is often overlooked by packages.
|
|
|
|
|
#
|
|
|
|
|
# Note1: The version of this macro shipped with SLE < 16 only supports a limited
|
|
|
|
|
# subset of options, due to the older RPM versions (< 4.17), which lacks support
|
|
|
|
|
# for disabling option processing.
|
|
|
|
|
#
|
|
|
|
|
# Note2: This is suboptimal when multiple events need to be triggered, as it
|
|
|
|
|
# results in multiple reloads of the rule files.
|
|
|
|
|
#
|
|
|
|
|
%udev_trigger_with_reload(-) \
|
|
|
|
|
if [ -e /run/udev/control ]; then \
|
|
|
|
|
/usr/bin/udevadm control --reload && /usr/bin/udevadm trigger %{?*} || : \
|
|
|
|
|
fi \
|
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
|
|
# The 2 following macros have also been converted into NOPs since we moved to
|
|
|
|
|
# file triggers. Some packages might have assumed that their effects were
|
|
|
|
|
# effective as soon as the macros return. However such assumption on tmpfiles
|
|
|
|
|
# can't work on transactional systems anyways where changes must take place on
|
|
|
|
|
# reboot.
|
|
|
|
|
#
|
|
|
|
|
# When a system user/group needs to be created in %%pre, so proper ownership are
|
|
|
|
|
# used when package's files are installed, "sysusers_create_package()" should be
|
|
|
|
|
# used.
|
|
|
|
|
|
|
|
|
|
%tmpfiles_create() \
|
|
|
|
|
%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# tmpfiles_create}} \
|
|
|
|
|
[ -z "${TRANSACTIONAL_UPDATE}" ] && [ -x /usr/bin/systemd-tmpfiles ] && \
|
|
|
|
|
/usr/bin/systemd-tmpfiles --create %{?*} || : \
|
|
|
|
|
: \
|
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
|
|
%sysusers_create() \
|
|
|
|
|
%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# sysusers_create}} \
|
|
|
|
|
[ -z "${TRANSACTIONAL_UPDATE}" ] && [ -x /usr/bin/systemd-sysusers ] && \
|
|
|
|
|
/usr/bin/systemd-sysusers %{?*} || : \
|
|
|
|
|
: \
|
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
|
|
# This should be used by package installation scripts which require users or
|
|
|
|
|