forked from pool/systemd
Accepting request 84925 from home:fcrozat:systemd
- Merge migration rpm macros into service_add/service_del macros. - Use systemd presets in rpm macros - Add fix-reload.patch: handle daemon-reload and start condition properly (bnc#719221). OBS-URL: https://build.opensuse.org/request/show/84925 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=198
This commit is contained in:
parent
c66fa86c13
commit
aeaa573a3f
43
fix-reload.patch
Normal file
43
fix-reload.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From a82e5507a6e03766957d43ca8818112ae9766288 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lennart Poettering <lennart@poettering.net>
|
||||||
|
Date: Thu, 22 Sep 2011 21:32:18 +0200
|
||||||
|
Subject: [PATCH] unit: don't recheck conditions when a unit is already starting but unit_start() is invoked
|
||||||
|
|
||||||
|
---
|
||||||
|
src/unit.c | 16 ++++++++++------
|
||||||
|
1 files changed, 10 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/unit.c b/src/unit.c
|
||||||
|
index 3ce87ea..0b435cb 100644
|
||||||
|
--- a/src/unit.c
|
||||||
|
+++ b/src/unit.c
|
||||||
|
@@ -888,16 +888,20 @@ int unit_start(Unit *u) {
|
||||||
|
if (u->meta.load_state != UNIT_LOADED)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
- /* If this is already (being) started, then this will
|
||||||
|
- * succeed. Note that this will even succeed if this unit is
|
||||||
|
- * not startable by the user. This is relied on to detect when
|
||||||
|
- * we need to wait for units and when waiting is finished. */
|
||||||
|
+ /* If this is already started, then this will succeed. Note
|
||||||
|
+ * that this will even succeed if this unit is not startable
|
||||||
|
+ * by the user. This is relied on to detect when we need to
|
||||||
|
+ * wait for units and when waiting is finished. */
|
||||||
|
state = unit_active_state(u);
|
||||||
|
if (UNIT_IS_ACTIVE_OR_RELOADING(state))
|
||||||
|
return -EALREADY;
|
||||||
|
|
||||||
|
- /* If the conditions failed, don't do anything at all */
|
||||||
|
- if (!unit_condition_test(u)) {
|
||||||
|
+ /* If the conditions failed, don't do anything at all. If we
|
||||||
|
+ * already are activating this call might still be useful to
|
||||||
|
+ * speed up activation in case there is some hold-off time,
|
||||||
|
+ * but we don't want to recheck the condition in that case. */
|
||||||
|
+ if (state != UNIT_ACTIVATING &&
|
||||||
|
+ !unit_condition_test(u)) {
|
||||||
|
log_debug("Starting of %s requested but condition failed. Ignoring.", u->meta.id);
|
||||||
|
return -EALREADY;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.7.3.4
|
||||||
|
|
@ -7,7 +7,10 @@
|
|||||||
# add %systemd_requires in the specfile
|
# add %systemd_requires in the specfile
|
||||||
#
|
#
|
||||||
# %post
|
# %post
|
||||||
# %service_add demo.service demo1.service
|
# %service_add_pre demo.service demo1.service
|
||||||
|
#
|
||||||
|
# %post
|
||||||
|
# %service_add_post demo.service demo1.service
|
||||||
#
|
#
|
||||||
# %preun
|
# %preun
|
||||||
# %service_del_preun demo.service
|
# %service_del_preun demo.service
|
||||||
@ -15,13 +18,6 @@
|
|||||||
# %postun
|
# %postun
|
||||||
# %service_del_postun demo.service
|
# %service_del_postun demo.service
|
||||||
#
|
#
|
||||||
#
|
|
||||||
# when migrating a package from sysvinit to systemd :
|
|
||||||
# %triggerun -- package_name < version_where_switch_occured
|
|
||||||
# %service_migrate_to_systemd [ -l run_level ] service_name.service
|
|
||||||
# foobar.socket
|
|
||||||
#
|
|
||||||
# -l <run_level> is optional
|
|
||||||
###
|
###
|
||||||
|
|
||||||
# This is for /bin/systemctl
|
# This is for /bin/systemctl
|
||||||
@ -33,15 +29,44 @@ Requires(postun): systemd \
|
|||||||
|
|
||||||
%_unitdir /lib/systemd/system
|
%_unitdir /lib/systemd/system
|
||||||
|
|
||||||
# On install, tell systemd to reload its unit files
|
%service_add_pre() \
|
||||||
%service_add() \
|
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
||||||
|
# disable migration if initial install under systemd \
|
||||||
if [ $FIRST_ARG -eq 1 ]; then \
|
if [ $FIRST_ARG -eq 1 ]; then \
|
||||||
# Initial installation \
|
for service in %{?*} ; do \
|
||||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || : \
|
sysv_service=`echo $service | sed -e 's/\\.[a-z]*//g'` \
|
||||||
|
touch "/var/lib/systemd/migrated/$sysv_service" \
|
||||||
|
done \
|
||||||
|
else \
|
||||||
|
for service in %{?*} ; do \
|
||||||
|
sysv_service=`echo $service | sed -e 's/\\.[a-z]*//g'` \
|
||||||
|
if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \
|
||||||
|
services_to_migrate="$services_to_migrate $sysv_service" \
|
||||||
|
fi \
|
||||||
|
done \
|
||||||
|
if [ -n "$services_to_migrate" ]; then \
|
||||||
|
/usr/sbin/systemd-sysv-convert --save $services_to_migrate >/dev/null 2>&1 || : \
|
||||||
|
fi \
|
||||||
fi \
|
fi \
|
||||||
%{nil}
|
%{nil}
|
||||||
|
|
||||||
|
# On install, tell systemd to reload its unit files
|
||||||
|
%service_add_post() \
|
||||||
|
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
||||||
|
for service in %{?*} ; do \
|
||||||
|
sysv_service=`echo $service | sed -e 's/\\.[a-z]*//g'` \
|
||||||
|
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 [ -n "$services_to_migrate" ]; then \
|
||||||
|
/usr/sbin/systemd-sysv-convert --apply $services_to_migrate >/dev/null 2>&1 || : \
|
||||||
|
fi \
|
||||||
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || : \
|
||||||
|
/bin/systemctl preset %{?*} >/dev/null 2>&1 || : \
|
||||||
|
%{nil}
|
||||||
|
|
||||||
# On uninstall, disable and stop services
|
# On uninstall, disable and stop services
|
||||||
%service_del_preun() \
|
%service_del_preun() \
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
||||||
@ -55,51 +80,15 @@ fi \
|
|||||||
# On uninstall, tell systemd to reload its unit files
|
# On uninstall, tell systemd to reload its unit files
|
||||||
%service_del_postun() \
|
%service_del_postun() \
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
||||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || : \
|
|
||||||
if [ $FIRST_ARG -ge 1 ]; then \
|
if [ $FIRST_ARG -ge 1 ]; then \
|
||||||
# Package upgrade, not uninstall \
|
# Package upgrade, not uninstall \
|
||||||
/bin/systemctl try-restart %{?*} >/dev/null 2>&1 || : \
|
/bin/systemctl try-restart %{?*} >/dev/null 2>&1 || : \
|
||||||
fi \
|
else # package uninstall \
|
||||||
%{nil}
|
|
||||||
|
|
||||||
%service_migrate_to_systemd_pre() \
|
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
|
||||||
# disable migration if initial install under systemd \
|
|
||||||
if [ $FIRST_ARG -eq 1 ]; then \
|
|
||||||
for service in %{?*} ; do \
|
for service in %{?*} ; do \
|
||||||
touch "/var/lib/systemd/migrated/$service" \
|
sysv_service=`echo $service | sed -e 's/\\.[a-z]*//g'` \
|
||||||
|
rm -f "/var/lib/systemd/migrated/$sysv_service" 2> /dev/null \
|
||||||
done \
|
done \
|
||||||
else \
|
|
||||||
for service in %{?*} ; do \
|
|
||||||
if [ ! -e "/var/lib/systemd/migrated/$service" ]; then \
|
|
||||||
services_to_migrate="$services_to_migrate $service" \
|
|
||||||
fi \
|
|
||||||
done \
|
|
||||||
if [ -n "$services_to_migrate" ]; then \
|
|
||||||
/usr/sbin/systemd-sysv-convert --save $services_to_migrate >/dev/null 2>&1 || : \
|
|
||||||
fi \
|
|
||||||
fi \
|
|
||||||
%{nil}
|
|
||||||
|
|
||||||
%service_migrate_to_systemd_post() \
|
|
||||||
for service in %{?*} ; do \
|
|
||||||
if [ ! -e "/var/lib/systemd/migrated/$service" ]; then \
|
|
||||||
services_to_migrate="$services_to_migrate $service" \
|
|
||||||
touch "/var/lib/systemd/migrated/$service" \
|
|
||||||
fi \
|
|
||||||
done \
|
|
||||||
if [ -n "$services_to_migrate" ]; then \
|
|
||||||
/usr/sbin/systemd-sysv-convert --apply $services_to_migrate >/dev/null 2>&1 || : \
|
|
||||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || : \
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || : \
|
||||||
fi \
|
fi \
|
||||||
%{nil}
|
%{nil}
|
||||||
|
|
||||||
%service_migrate_to_systemd_postun() \
|
|
||||||
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
|
||||||
if [ $FIRST_ARG -eq 0 ]; then \
|
|
||||||
for service in %{?*} ; do \
|
|
||||||
rm -f "/var/lib/systemd/migrated/$service" 2> /dev/null \
|
|
||||||
done \
|
|
||||||
fi \
|
|
||||||
%{nil}
|
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Sep 26 14:52:46 UTC 2011 - fcrozat@suse.com
|
||||||
|
|
||||||
|
- Merge migration rpm macros into service_add/service_del macros.
|
||||||
|
- Use systemd presets in rpm macros
|
||||||
|
- Add fix-reload.patch: handle daemon-reload and start condition
|
||||||
|
properly (bnc#719221).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Sep 23 15:39:03 UTC 2011 - fcrozat@suse.com
|
Fri Sep 23 15:39:03 UTC 2011 - fcrozat@suse.com
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Sep 26 14:52:46 UTC 2011 - fcrozat@suse.com
|
||||||
|
|
||||||
|
- Merge migration rpm macros into service_add/service_del macros.
|
||||||
|
- Use systemd presets in rpm macros
|
||||||
|
- Add fix-reload.patch: handle daemon-reload and start condition
|
||||||
|
properly (bnc#719221).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Sep 23 15:39:03 UTC 2011 - fcrozat@suse.com
|
Fri Sep 23 15:39:03 UTC 2011 - fcrozat@suse.com
|
||||||
|
|
||||||
|
@ -67,6 +67,8 @@ Patch10: revert_insserv_conf_parsing.patch
|
|||||||
# in the patch. Any patches added here without a very good reason to make
|
# in the patch. Any patches added here without a very good reason to make
|
||||||
# an exception will be silently removed with the next version update.
|
# an exception will be silently removed with the next version update.
|
||||||
Patch9: 0001-execute-fix-bus-serialization-for-commands.patch
|
Patch9: 0001-execute-fix-bus-serialization-for-commands.patch
|
||||||
|
# PATCH-FIX-UPSTREAM fix-reload.patch fcrozat@suse.com bnc#719221 -- Fix daemon-reload and conditions when service is starting
|
||||||
|
Patch11: fix-reload.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Systemd is a system and service manager, compatible with SysV and LSB
|
Systemd is a system and service manager, compatible with SysV and LSB
|
||||||
@ -121,6 +123,7 @@ Plymouth integration for systemd
|
|||||||
%patch8 -p1
|
%patch8 -p1
|
||||||
%patch9 -p1
|
%patch9 -p1
|
||||||
%patch10 -p1
|
%patch10 -p1
|
||||||
|
%patch11 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -fiv
|
autoreconf -fiv
|
||||||
@ -141,7 +144,7 @@ make %{?_smp_mflags}
|
|||||||
mkdir -p %{buildroot}%{_sysconfdir}/rpm
|
mkdir -p %{buildroot}%{_sysconfdir}/rpm
|
||||||
install -m644 %{S:4} %{buildroot}%{_sysconfdir}/rpm
|
install -m644 %{S:4} %{buildroot}%{_sysconfdir}/rpm
|
||||||
find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
|
find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
|
||||||
mkdir -p %{buildroot}/{sbin,var/lib/systemd/sysv-convert,var/lib/systemd/migrated}
|
mkdir -p %{buildroot}/{sbin,var/lib/systemd/sysv-convert,var/lib/systemd/migrated} %{buildroot}/lib/systemd/{system.preset,user.preset}
|
||||||
install -m755 %{S:3} -D %{buildroot}%{_sbindir}/systemd-sysv-convert
|
install -m755 %{S:3} -D %{buildroot}%{_sbindir}/systemd-sysv-convert
|
||||||
install -m755 %{S:5} %{buildroot}/lib/systemd/system-generators
|
install -m755 %{S:5} %{buildroot}/lib/systemd/system-generators
|
||||||
install -m755 %{S:7} %{buildroot}/lib/systemd/
|
install -m755 %{S:7} %{buildroot}/lib/systemd/
|
||||||
@ -251,6 +254,8 @@ rm -rf %{buildroot}
|
|||||||
%{_bindir}/systemd-cgls
|
%{_bindir}/systemd-cgls
|
||||||
/lib/systemd/systemd-*
|
/lib/systemd/systemd-*
|
||||||
%dir /lib/systemd/system-shutdown
|
%dir /lib/systemd/system-shutdown
|
||||||
|
%dir /lib/systemd/system.preset
|
||||||
|
%dir /lib/systemd/user.preset
|
||||||
/%{_lib}/security/pam_systemd.so
|
/%{_lib}/security/pam_systemd.so
|
||||||
%dir %{_sysconfdir}/systemd/system
|
%dir %{_sysconfdir}/systemd/system
|
||||||
%dir %{_sysconfdir}/systemd/user
|
%dir %{_sysconfdir}/systemd/user
|
||||||
|
Loading…
Reference in New Issue
Block a user