Dominique Leuenberger 2018-01-02 15:31:39 +00:00 committed by Git OBS Bridge
commit d7bf56383d
3 changed files with 89 additions and 21 deletions

View File

@ -78,19 +78,24 @@ if [ "$FIRST_ARG" -eq 1 ]; then \
done \
else \
for service in %{?*} ; do \
# The tag file might have been left by a preceding \
# update (see 1059627) \
rm -f "/run/rpm-%{name}-update-$service-new-in-upgrade" \
\
if [ ! -e "/usr/lib/systemd/system/$service" ]; then \
touch "/run/rpm-%{name}-update-$service-new-in-upgrade" \
fi \
done \
for service in %{?*} ; do \
sysv_service="${service%%.*}" \
if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \
services_to_migrate="$services_to_migrate $sysv_service" \
if [ -e /var/lib/systemd/migrated/$sysv_service ]; then \
continue \
fi \
if [ ! -x /usr/sbin/systemd-sysv-convert ]; then \
continue \
fi \
/usr/sbin/systemd-sysv-convert --save $sysv_service || : \
done \
if [ -n "$services_to_migrate" -a -x /usr/sbin/systemd-sysv-convert ]; then \
/usr/sbin/systemd-sysv-convert --save $services_to_migrate || : \
fi \
fi \
%{nil}
@ -98,21 +103,11 @@ fi \
%service_add_post() \
test -n "$FIRST_ARG" || FIRST_ARG="$1" \
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
for service in %{?*} ; do \
sysv_service="${service%%.*}" \
if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \
services_to_migrate="$services_to_migrate $sysv_service" \
touch "/var/lib/systemd/migrated/$sysv_service" || : \
fi \
done \
\
if [ "$YAST_IS_RUNNING" != "instsys" -a -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl daemon-reload || : \
fi \
if [ -n "$services_to_migrate" ]; then \
if [ -x /usr/sbin/systemd-sysv-convert ]; then \
/usr/sbin/systemd-sysv-convert --apply $services_to_migrate || : \
fi \
elif [ "$FIRST_ARG" -eq 1 ]; then \
if [ "$FIRST_ARG" -eq 1 ]; then \
if [ -x /usr/bin/systemctl ]; then \
/usr/bin/systemctl preset %{?*} || : \
fi \
@ -127,6 +122,17 @@ elif [ "$FIRST_ARG" -gt 1 ]; then \
fi \
/usr/bin/systemctl preset "$service" || : \
done \
for service in %{?*} ; do \
sysv_service=${service%%.*} \
if [ -e /var/lib/systemd/migrated/$sysv_service ]; then \
continue \
fi \
if [ ! -x /usr/sbin/systemd-sysv-convert ]; then \
continue \
fi \
/usr/sbin/systemd-sysv-convert --apply $sysv_service || : \
touch /var/lib/systemd/migrated/$sysv_service || : \
done \
fi \
%{nil}

View File

@ -1,9 +1,72 @@
-------------------------------------------------------------------
Thu Dec 14 08:39:15 UTC 2017 - fbui@suse.com
- Move macros.systemd in /usr/lib/rpm
The file is not supposed to be customized by the user.
-------------------------------------------------------------------
Wed Dec 13 17:14:25 UTC 2017 - fbui@suse.com
- Make %systemd_add_pre() more similar to %systemd_add_post()
The main advantage is that we pass only one argument to
systemd-sysv-convert script. The later can now be improved/rewritten
to handle only one argument and return a useful exit status.
-------------------------------------------------------------------
Wed Dec 13 16:42:56 UTC 2017 - fbui@suse.com
- Make sure to apply presets if packages start shipping units during upgrades (bsc#1071543)
If a package started shipping units during upgrade only sysv
migration was done. However if the package didn't ship any sysv
scripts before no presets were applied.
Now during upgrades, preset are always applied (still only during
the first time the units are installed) then followed by the sysv
migration machinery.
The downside of this is that migrated services can have symlinks in
both runlevel.target.wants/ (created by the sysv migration) and in
the directory specified by the [Install] sections (created by
"systemctl preset")...
The whole thing should be rewritten.
-------------------------------------------------------------------
Fri Dec 1 10:47:29 UTC 2017 - fbui@suse.com
- Make sure to clean up "new-in-upgrade" tag file (bsc#1059627)
The tag file might have been incorrectly left by a preceding update.
-------------------------------------------------------------------
Wed Nov 22 14:41:00 UTC 2017 - fbui@suse.com
- Restore previous changes
-------------------------------------------------------------------
Fri Nov 17 09:23:14 UTC 2017 - fbui@suse.com
- Revert previous changes
Also added reasons why the previous changes would be needed.
-------------------------------------------------------------------
Fri Nov 17 07:44:55 CET 2017 - kukuk@suse.de
- Don't execute systemd-tmpfiles if we run in transactional update
mode
If you do transactional updates, it doesn't make any sense to
execute the tmpfiles. They will only create a lot of directories,
files or symlinks in empty directories without any use and later
hidden under the real mount points. With transactional updates, you
should do such things always during the boot phase, as designed by
systemd (and like Fedora and RHEL doing, but in their use case it's
in my opinion a bug).
-------------------------------------------------------------------
Thu Nov 2 16:09:29 UTC 2017 - fbui@suse.com

View File

@ -39,9 +39,8 @@ services files. This package provides these macros.
%build
%install
mkdir -p %{buildroot}%{_sysconfdir}/rpm
install -m644 %{S:0} %{buildroot}%{_sysconfdir}/rpm
UNITDIR="`cat %{S:0} | sed -n 's|.*_unitdir[[:blank:]]*||p'`"
install -Dm644 %{S:0} %{buildroot}%{_rpmconfigdir}/macros.d/macros.systemd
UNITDIR="$(sed -n 's/.*_unitdir[[:blank:]]*//p' %{S:0})"
for i in $UNITDIR `dirname $UNITDIR`; do
mkdir -p %{buildroot}$i
echo $i >> unitdir
@ -49,6 +48,6 @@ done
%files -f unitdir
%defattr(-,root,root)
%config %{_sysconfdir}/rpm/macros.systemd
%{_rpmconfigdir}/macros.d/macros.systemd
%changelog