4295f9
#  -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
4295f9
#  SPDX-License-Identifier: LGPL-2.1-or-later
4295f9
#
4295f9
#  This file is part of systemd.
4295f9
#
4295f9
#  Copyright 2018 Neal Gompa
4295f9
4295f9
# The contents of this are an example to be copied into systemd.spec.
4295f9
#
4295f9
# Minimum rpm version supported: 4.14.0
4295f9
4295f9
%transfiletriggerin -P 900900 -- /usr/lib/systemd/system /etc/systemd/system
4295f9
# This script will run after any package is initially installed or
4295f9
# upgraded. We care about the case where a package is initially
4295f9
# installed, because other cases are covered by the *un scriptlets,
4295f9
# so sometimes we will reload needlessly.
4295f9
if test -d "/run/systemd/system"; then
4295f9
  %{_bindir}/systemctl daemon-reload || :
4295f9
  %{_bindir}/systemctl reload-or-restart --marked || :
4295f9
fi
4295f9
4295f9
%transfiletriggerpostun -P 1000100 -- /usr/lib/systemd/system /etc/systemd/system
4295f9
# On removal, we need to run daemon-reload after any units have been
4295f9
# removed.
4295f9
# On upgrade, we need to run daemon-reload after any new unit files
4295f9
# have been installed, but before %postun scripts in packages get
4295f9
# executed.
4295f9
if test -d "/run/systemd/system"; then
4295f9
  %{_bindir}/systemctl daemon-reload || :
4295f9
fi
4295f9
4295f9
%transfiletriggerpostun -P 10000 -- /usr/lib/systemd/system /etc/systemd/system
4295f9
# We restart remaining services that should be restarted here.
4295f9
if test -d "/run/systemd/system"; then
4295f9
  %{_bindir}/systemctl reload-or-restart --marked || :
4295f9
fi
4295f9
4295f9
%transfiletriggerin -P 1000700 -- /usr/lib/sysusers.d
4295f9
# This script will process files installed in /usr/lib/sysusers.d to create
4295f9
# specified users automatically. The priority is set such that it
4295f9
# will run before the tmpfiles file trigger.
4295f9
if test -d "/run/systemd/system"; then
4295f9
  %{_bindir}/systemd-sysusers || :
4295f9
fi
4295f9
4295f9
%transfiletriggerin -P 1000700 udev -- /usr/lib/udev/hwdb.d
4295f9
# This script will automatically invoke hwdb update if files have been
4295f9
# installed or updated in /usr/lib/udev/hwdb.d.
4295f9
if test -d "/run/systemd/system"; then
4295f9
  %{_bindir}/systemd-hwdb update || :
4295f9
fi
4295f9
4295f9
%transfiletriggerin -P 1000700 -- /usr/lib/systemd/catalog
4295f9
# This script will automatically invoke journal catalog update if files
4295f9
# have been installed or updated in /usr/lib/systemd/catalog.
4295f9
if test -d "/run/systemd/system"; then
4295f9
  %{_bindir}/journalctl --update-catalog || :
4295f9
fi
4295f9
4295f9
%transfiletriggerin -P 1000700 -- /usr/lib/binfmt.d
4295f9
# This script will automatically apply binfmt rules if files have been
4295f9
# installed or updated in /usr/lib/binfmt.d.
4295f9
if test -d "/run/systemd/system"; then
4295f9
  # systemd-binfmt might fail if binfmt_misc kernel module is not loaded
4295f9
  # during install
4295f9
  /usr/lib/systemd/systemd-binfmt || :
4295f9
fi
4295f9
4295f9
%transfiletriggerin -P 1000600 -- /usr/lib/tmpfiles.d
4295f9
# This script will process files installed in /usr/lib/tmpfiles.d to create
4295f9
# tmpfiles automatically. The priority is set such that it will run
4295f9
# after the sysusers file trigger, but before any other triggers.
4295f9
if test -d "/run/systemd/system"; then
4295f9
  %{_bindir}/systemd-tmpfiles --create || :
4295f9
fi
4295f9
4295f9
%transfiletriggerin -P 1000600 udev -- /usr/lib/udev/rules.d
4295f9
# This script will automatically update udev with new rules if files
4295f9
# have been installed or updated in /usr/lib/udev/rules.d.
4295f9
if test -e /run/udev/control; then
4295f9
  %{_bindir}/udevadm control --reload || :
4295f9
fi
4295f9
4295f9
%transfiletriggerin -P 1000500 -- /usr/lib/sysctl.d
4295f9
# This script will automatically apply sysctl rules if files have been
4295f9
# installed or updated in /usr/lib/sysctl.d.
4295f9
if test -d "/run/systemd/system"; then
4295f9
  /usr/lib/systemd/systemd-sysctl || :
4295f9
fi