- Ensure systemd macros never fails (if systemd isn't install)

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=296
This commit is contained in:
Andreas Jaeger 2012-07-30 11:55:33 +00:00 committed by Git OBS Bridge
parent 55453f8b31
commit f30a0599e1
2 changed files with 10 additions and 3 deletions

View File

@ -32,10 +32,11 @@ Requires(postun): systemd \
%service_add_pre() \ %service_add_pre() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \ test -n "$FIRST_ARG" || FIRST_ARG=$1 \
# disable migration if initial install under systemd \ # disable migration if initial install under systemd \
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
if [ $FIRST_ARG -eq 1 ]; then \ if [ $FIRST_ARG -eq 1 ]; then \
for service in %{?*} ; do \ for service in %{?*} ; do \
sysv_service=${service%.*} \ sysv_service=${service%.*} \
touch "/var/lib/systemd/migrated/$sysv_service" \ touch "/var/lib/systemd/migrated/$sysv_service" || : \
done \ done \
else \ else \
for service in %{?*} ; do \ for service in %{?*} ; do \
@ -53,11 +54,12 @@ fi \
# On install, tell systemd to reload its unit files # On install, tell systemd to reload its unit files
%service_add_post() \ %service_add_post() \
test -n "$FIRST_ARG" || FIRST_ARG=$1 \ test -n "$FIRST_ARG" || FIRST_ARG=$1 \
[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \
for service in %{?*} ; do \ for service in %{?*} ; do \
sysv_service=${service%.*} \ sysv_service=${service%.*} \
if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \ if [ ! -e "/var/lib/systemd/migrated/$sysv_service" ]; then \
services_to_migrate="$services_to_migrate $sysv_service" \ services_to_migrate="$services_to_migrate $sysv_service" \
touch "/var/lib/systemd/migrated/$sysv_service" \ touch "/var/lib/systemd/migrated/$sysv_service" || : \
fi \ fi \
done \ done \
/bin/systemctl daemon-reload >/dev/null 2>&1 || : \ /bin/systemctl daemon-reload >/dev/null 2>&1 || : \
@ -87,7 +89,7 @@ if [ $FIRST_ARG -ge 1 ]; then \
else # package uninstall \ else # package uninstall \
for service in %{?*} ; do \ for service in %{?*} ; do \
sysv_service=${service%.*} \ sysv_service=${service%.*} \
rm -f "/var/lib/systemd/migrated/$sysv_service" 2> /dev/null \ rm -f "/var/lib/systemd/migrated/$sysv_service" 2> /dev/null || : \
done \ done \
/bin/systemctl daemon-reload >/dev/null 2>&1 || : \ /bin/systemctl daemon-reload >/dev/null 2>&1 || : \
fi \ fi \

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Jul 30 11:37:17 UTC 2012 - fcrozat@suse.com
- Ensure systemd macros never fails (if systemd isn't install)
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jul 23 08:28:15 UTC 2012 - fcrozat@suse.com Mon Jul 23 08:28:15 UTC 2012 - fcrozat@suse.com