From f30a0599e197feae34e3721889cfa6b9c8c5aebe210c309f21ccf1593e98bb16 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 30 Jul 2012 11:55:33 +0000 Subject: [PATCH] - 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 --- macros.systemd | 8 +++++--- systemd.changes | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/macros.systemd b/macros.systemd index 9cb4392..802380d 100644 --- a/macros.systemd +++ b/macros.systemd @@ -32,10 +32,11 @@ Requires(postun): systemd \ %service_add_pre() \ test -n "$FIRST_ARG" || FIRST_ARG=$1 \ # disable migration if initial install under systemd \ +[ -d /var/lib/systemd/migrated ] || mkdir -p /var/lib/systemd/migrated || : \ if [ $FIRST_ARG -eq 1 ]; then \ for service in %{?*} ; do \ sysv_service=${service%.*} \ - touch "/var/lib/systemd/migrated/$sysv_service" \ + touch "/var/lib/systemd/migrated/$sysv_service" || : \ done \ else \ for service in %{?*} ; do \ @@ -53,11 +54,12 @@ fi \ # On install, tell systemd to reload its unit files %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" \ + touch "/var/lib/systemd/migrated/$sysv_service" || : \ fi \ done \ /bin/systemctl daemon-reload >/dev/null 2>&1 || : \ @@ -87,7 +89,7 @@ if [ $FIRST_ARG -ge 1 ]; then \ else # package uninstall \ for service in %{?*} ; do \ 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 \ /bin/systemctl daemon-reload >/dev/null 2>&1 || : \ fi \ diff --git a/systemd.changes b/systemd.changes index 2ed4bd0..4cff8ff 100644 --- a/systemd.changes +++ b/systemd.changes @@ -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