shared: add generic logic for waiting for a unit to enter some state
This is a generic implementation of a client-side logic of waiting until
a unit enters or leaves some state.
This is a more generic implementation of the WaitContext logic currently
in systemctl.c, and is supposed to replace it (a later commit does
this). It's similar to bus-wait-for-jobs.c and we probably should fold
that one into it later on.
This code is more powerful and cleaner than the WaitContext logic
however. In addition to waiting for a unit to exit this also allows us
to wait for a unit to leave the "maintainance" state.
This commit only implements the generic logic, and adds no users of it
yet.
(cherry picked from commit 3572d3df8f822d4cf1601428401a837f723771cf)
Related: #1830861
patch_name: 0420-shared-add-generic-logic-for-waiting-for-a-unit-to-e.patch
present_in_specfile: true
location_in_specfile: 420
squash_commits: true