X Tutup
Skip to content

Commit addf2c0

Browse files
committed
rpm: sync the shell version of triggers.systemd with the lua version
Note that this goes both ways: in particular the lua version had udev scriptlets in the wrong package, fixed in https://src.fedoraproject.org/rpms/systemd/c/3c9433d7cf4afc8d76660402f6c3d9d991596b83. Add missing "|| :" so the scriptlets never fail.
1 parent 8e56580 commit addf2c0

File tree

2 files changed

+34
-48
lines changed

2 files changed

+34
-48
lines changed

src/rpm/triggers.systemd.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ if posix.access("/run/systemd/system") then
8282
end
8383
end
8484

85-
%transfiletriggerin -p <lua> -- @udevhwdbdir@
85+
%transfiletriggerin udev -p <lua> -- @udevhwdbdir@
8686
-- This script will automatically invoke hwdb update if files have been
8787
-- installed or updated in @udevhwdbdir@.
8888
if posix.access("/run/systemd/system") then
@@ -106,7 +106,7 @@ if posix.access("/run/systemd/system") then
106106
end
107107
end
108108

109-
%transfiletriggerin -p <lua> -- @udevrulesdir@
109+
%transfiletriggerin udev -p <lua> -- @udevrulesdir@
110110
-- This script will automatically update udev with new rules if files
111111
-- have been installed or updated in @udevrulesdir@.
112112
if posix.access("/run/systemd/system") then

src/rpm/triggers.systemd.sh.in

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
11
# -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
2-
# SPDX-License-Identifier: LGPL-2.1+
2+
# SPDX-License-Identifier: LGPL-2.1-or-later
33
#
44
# This file is part of systemd.
55
#
6-
# Copyright 2015 Zbigniew Jędrzejewski-Szmek
76
# Copyright 2018 Neal Gompa
8-
#
9-
# systemd is free software; you can redistribute it and/or modify it
10-
# under the terms of the GNU Lesser General Public License as published by
11-
# the Free Software Foundation; either version 2.1 of the License, or
12-
# (at your option) any later version.
13-
#
14-
# systemd is distributed in the hope that it will be useful, but
15-
# WITHOUT ANY WARRANTY; without even the implied warranty of
16-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17-
# Lesser General Public License for more details.
18-
#
19-
# You should have received a copy of the GNU Lesser General Public License
20-
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
217

228
# The contents of this are an example to be copied into systemd.spec.
239
#
2410
# Minimum rpm version supported: 4.13.0
2511

26-
%transfiletriggerin -P 900900 -- /usr/lib/systemd/system /etc/systemd/system
12+
%transfiletriggerin -P 900900 -- @systemunitdir@ /etc/systemd/system
2713
# This script will run after any package is initially installed or
2814
# upgraded. We care about the case where a package is initially
2915
# installed, because other cases are covered by the *un scriptlets,
3016
# so sometimes we will reload needlessly.
31-
if test -d /run/systemd/system; then
32-
%{_bindir}/systemctl daemon-reload
17+
if test -d "/run/systemd/system"; then
18+
%{_bindir}/systemctl daemon-reload || :
3319
fi
3420

35-
%transfiletriggerun -- /usr/lib/systemd/system /etc/systemd/system
21+
%transfiletriggerun -- @systemunitdir@ /etc/systemd/system
3622
# On removal, we need to run daemon-reload after any units have been
3723
# removed. %transfiletriggerpostun would be ideal, but it does not get
3824
# executed for some reason.
@@ -47,65 +33,65 @@ fi
4733
# the first %filetriggerpostun.
4834

4935
if test -d "/run/systemd/system"; then
50-
mkdir -p "%{_localstatedir}/lib/rpm-state/systemd"
51-
touch "%{_localstatedir}/lib/rpm-state/systemd/needs-reload"
36+
mkdir -p "%{_localstatedir}/lib/rpm-state/systemd"
37+
touch "%{_localstatedir}/lib/rpm-state/systemd/needs-reload"
5238
fi
5339

54-
%filetriggerpostun -P 1000100 -- /usr/lib/systemd/system /etc/systemd/system
40+
%filetriggerpostun -P 1000100 -- @systemunitdir@ /etc/systemd/system
5541
if test -f "%{_localstatedir}/lib/rpm-state/systemd/needs-reload"; then
56-
rm -rf "%{_localstatedir}/lib/rpm-state/systemd"
57-
%{_bindir}/systemctl daemon-reload
42+
rm -rf "%{_localstatedir}/lib/rpm-state/systemd"
43+
%{_bindir}/systemctl daemon-reload || :
5844
fi
5945

60-
%transfiletriggerin -P 100700 -- /usr/lib/sysusers.d
61-
# This script will process files installed in /usr/lib/sysusers.d to create
46+
%transfiletriggerin -P 100700 -- @sysusersdir@
47+
# This script will process files installed in @sysusersdir@ to create
6248
# specified users automatically. The priority is set such that it
6349
# will run before the tmpfiles file trigger.
64-
if test -d /run/systemd/system; then
50+
if test -d "/run/systemd/system"; then
6551
%{_bindir}/systemd-sysusers || :
6652
fi
6753

68-
%transfiletriggerin -P 100500 -- /usr/lib/tmpfiles.d
69-
# This script will process files installed in /usr/lib/tmpfiles.d to create
54+
%transfiletriggerin -P 100500 -- @tmpfilesdir@
55+
# This script will process files installed in @tmpfilesdir@ to create
7056
# tmpfiles automatically. The priority is set such that it will run
7157
# after the sysusers file trigger, but before any other triggers.
72-
if test -d /run/systemd/system; then
58+
if test -d "/run/systemd/system"; then
7359
%{_bindir}/systemd-tmpfiles --create || :
7460
fi
7561

76-
%transfiletriggerin udev -- /usr/lib/udev/hwdb.d
62+
%transfiletriggerin udev -- @udevhwdbdir@
7763
# This script will automatically invoke hwdb update if files have been
78-
# installed or updated in /usr/lib/udev/hwdb.d.
79-
if test -d /run/systemd/system; then
64+
# installed or updated in @udevhwdbdir@.
65+
if test -d "/run/systemd/system"; then
8066
%{_bindir}/systemd-hwdb update || :
8167
fi
8268

83-
%transfiletriggerin -- /usr/lib/systemd/catalog
69+
%transfiletriggerin -- @catalogdir@
8470
# This script will automatically invoke journal catalog update if files
85-
# have been installed or updated in /usr/lib/systemd/catalog.
86-
if test -d /run/systemd/system; then
71+
# have been installed or updated in @catalogdir@.
72+
if test -d "/run/systemd/system"; then
8773
%{_bindir}/journalctl --update-catalog || :
8874
fi
8975

90-
%transfiletriggerin udev -- /usr/lib/udev/rules.d
76+
%transfiletriggerin udev -- @udevrulesdir@
9177
# This script will automatically update udev with new rules if files
92-
# have been installed or updated in /usr/lib/udev/rules.d.
78+
# have been installed or updated in @udevrulesdir@.
9379
if test -e /run/udev/control; then
9480
%{_bindir}/udevadm control --reload || :
9581
fi
9682

97-
%transfiletriggerin -- /usr/lib/sysctl.d
83+
%transfiletriggerin -- @sysctldir@
9884
# This script will automatically apply sysctl rules if files have been
99-
# installed or updated in /usr/lib/sysctl.d.
100-
if test -d /run/systemd/system; then
101-
/usr/lib/systemd/systemd-sysctl || :
85+
# installed or updated in @sysctldir@.
86+
if test -d "/run/systemd/system"; then
87+
@rootlibexecdir@/systemd-sysctl || :
10288
fi
10389

104-
%transfiletriggerin -- /usr/lib/binfmt.d
90+
%transfiletriggerin -- @binfmtdir@
10591
# This script will automatically apply binfmt rules if files have been
106-
# installed or updated in /usr/lib/binfmt.d.
107-
if test -d /run/systemd/system; then
92+
# installed or updated in @binfmtdir@.
93+
if test -d "/run/systemd/system"; then
10894
# systemd-binfmt might fail if binfmt_misc kernel module is not loaded
10995
# during install
110-
/usr/lib/systemd/systemd-binfmt || :
96+
@rootlibexecdir@/systemd-binfmt || :
11197
fi

0 commit comments

Comments
 (0)
X Tutup