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