daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ff6046
#  -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
ff6046
#  SPDX-License-Identifier: LGPL-2.1+
ff6046
#
ff6046
#  This file is part of systemd.
ff6046
#
ff6046
#  Copyright 2015 Zbigniew Jędrzejewski-Szmek
ff6046
#  Copyright 2018 Neal Gompa
ff6046
#
ff6046
#  systemd is free software; you can redistribute it and/or modify it
ff6046
#  under the terms of the GNU Lesser General Public License as published by
ff6046
#  the Free Software Foundation; either version 2.1 of the License, or
ff6046
#  (at your option) any later version.
ff6046
#
ff6046
#  systemd is distributed in the hope that it will be useful, but
ff6046
#  WITHOUT ANY WARRANTY; without even the implied warranty of
ff6046
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ff6046
#  Lesser General Public License for more details.
ff6046
#
ff6046
#  You should have received a copy of the GNU Lesser General Public License
ff6046
#  along with systemd; If not, see <http://www.gnu.org/licenses/>.
ff6046
ff6046
# The contents of this are an example to be copied into systemd.spec.
ff6046
#
ff6046
# Minimum rpm version supported: 4.13.0
ff6046
ff6046
%transfiletriggerin -P 900900 -- /usr/lib/systemd/system /etc/systemd/system
ff6046
# This script will run after any package is initially installed or
ff6046
# upgraded. We care about the case where a package is initially
ff6046
# installed, because other cases are covered by the *un scriptlets,
ff6046
# so sometimes we will reload needlessly.
ff6046
if test -d /run/systemd/system; then
ff6046
  %{_bindir}/systemctl daemon-reload
ff6046
fi
ff6046
ff6046
%transfiletriggerun -- /usr/lib/systemd/system /etc/systemd/system
ff6046
# On removal, we need to run daemon-reload after any units have been
ff6046
# removed. %transfiletriggerpostun would be ideal, but it does not get
ff6046
# executed for some reason.
ff6046
# On upgrade, we need to run daemon-reload after any new unit files
ff6046
# have been installed, but before %postun scripts in packages get
ff6046
# executed. %transfiletriggerun gets the right list of files
ff6046
# but it is invoked too early (before changes happen).
ff6046
# %filetriggerpostun happens at the right time, but it fires for
ff6046
# every package.
ff6046
# To execute the reload at the right time, we create a state
ff6046
# file in %transfiletriggerun and execute the daemon-reload in
ff6046
# the first %filetriggerpostun.
ff6046
ff6046
if test -d "/run/systemd/system"; then
ff6046
    mkdir -p "%{_localstatedir}/lib/rpm-state/systemd"
ff6046
    touch "%{_localstatedir}/lib/rpm-state/systemd/needs-reload"
ff6046
fi
ff6046
ff6046
%filetriggerpostun -P 1000100 -- /usr/lib/systemd/system /etc/systemd/system
ff6046
if test -f "%{_localstatedir}/lib/rpm-state/systemd/needs-reload"; then
ff6046
    rm -rf "%{_localstatedir}/lib/rpm-state/systemd"
ff6046
    %{_bindir}/systemctl daemon-reload
ff6046
fi
ff6046
ff6046
%transfiletriggerin -P 100700 -- /usr/lib/sysusers.d
ff6046
# This script will process files installed in /usr/lib/sysusers.d to create
ff6046
# specified users automatically. The priority is set such that it
ff6046
# will run before the tmpfiles file trigger.
ff6046
if test -d /run/systemd/system; then
ff6046
  %{_bindir}/systemd-sysusers
ff6046
fi
ff6046
ff6046
%transfiletriggerin -P 100500 -- /usr/lib/tmpfiles.d
ff6046
# This script will process files installed in /usr/lib/tmpfiles.d to create
ff6046
# tmpfiles automatically. The priority is set such that it will run
ff6046
# after the sysusers file trigger, but before any other triggers.
ff6046
if test -d /run/systemd/system; then
ff6046
  %{_bindir}/systemd-tmpfiles --create
ff6046
fi
ff6046
ff6046
%transfiletriggerin udev -- /usr/lib/udev/hwdb.d
ff6046
# This script will automatically invoke hwdb update if files have been
ff6046
# installed or updated in /usr/lib/udev/hwdb.d.
ff6046
if test -d /run/systemd/system; then
ff6046
  %{_bindir}/systemd-hwdb update
ff6046
fi
ff6046
ff6046
%transfiletriggerin -- /usr/lib/systemd/catalog
ff6046
# This script will automatically invoke journal catalog update if files
ff6046
# have been installed or updated in /usr/lib/systemd/catalog.
ff6046
if test -d /run/systemd/system; then
ff6046
  %{_bindir}/journalctl --update-catalog
ff6046
fi
ff6046
ff6046
%transfiletriggerin udev -- /usr/lib/udev/rules.d
ff6046
# This script will automatically update udev with new rules if files
ff6046
# have been installed or updated in /usr/lib/udev/rules.d.
ff6046
if test -d /run/systemd/system; then
ff6046
  %{_bindir}/udevadm control --reload
ff6046
fi
ff6046
ff6046
%transfiletriggerin -- /usr/lib/sysctl.d
ff6046
# This script will automatically apply sysctl rules if files have been
ff6046
# installed or updated in /usr/lib/sysctl.d.
ff6046
if test -d /run/systemd/system; then
ff6046
  /usr/lib/systemd/systemd-sysctl
ff6046
fi
ff6046
ff6046
%transfiletriggerin -- /usr/lib/binfmt.d
ff6046
# This script will automatically apply binfmt rules if files have been
ff6046
# installed or updated in /usr/lib/binfmt.d.
ff6046
if test -d /run/systemd/system; then
ff6046
  /usr/lib/systemd/systemd-binfmt
ff6046
fi