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