From a55654d598c78f8e084aa6a18fec6eff900c9aed Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 13 Jun 2014 12:52:31 +0200 Subject: core: add new ConditionNeedsUpdate= unit condition This new condition allows checking whether /etc or /var are out-of-date relative to /usr. This is the counterpart for the update flag managed by systemd-update-done.service. Services that want to be started once after /usr got updated should use: [Unit] ConditionNeedsUpdate=/etc Before=systemd-update-done.service This makes sure that they are only run if /etc is out-of-date relative to /usr. And that it will be executed after systemd-update-done.service which is responsible for marking /etc up-to-date relative to the current /usr. ConditionNeedsUpdate= will also checks whether /etc is actually writable, and not trigger if it isn't, since no update is possible then. --- src/shared/condition-util.c | 1 + src/shared/condition-util.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src/shared') diff --git a/src/shared/condition-util.c b/src/shared/condition-util.c index 1c7d1f6a5e..7b89b0fbaf 100644 --- a/src/shared/condition-util.c +++ b/src/shared/condition-util.c @@ -256,6 +256,7 @@ static const char* const condition_type_table[_CONDITION_TYPE_MAX] = { [CONDITION_HOST] = "ConditionHost", [CONDITION_AC_POWER] = "ConditionACPower", [CONDITION_ARCHITECTURE] = "ConditionArchitecture", + [CONDITION_NEEDS_UPDATE] = "ConditionNeedsUpdate", [CONDITION_NULL] = "ConditionNull" }; diff --git a/src/shared/condition-util.h b/src/shared/condition-util.h index 63d945efac..0b09f83f90 100644 --- a/src/shared/condition-util.h +++ b/src/shared/condition-util.h @@ -44,6 +44,7 @@ typedef enum ConditionType { CONDITION_HOST, CONDITION_AC_POWER, CONDITION_ARCHITECTURE, + CONDITION_NEEDS_UPDATE, CONDITION_NULL, _CONDITION_TYPE_MAX, _CONDITION_TYPE_INVALID = -1 -- cgit v1.2.3-54-g00ecf