Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to create a reload_timesyncd function where we make this check? That way if a user installs timesyncd it functions correctly from the get-go.
Not suggesting to make this change unless you agree, more of a question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is copied verbatim from Debian's dhclient exit hook, and similar to many other Debian scripts. They all start by checking for the existence of systemd's run directory. This one also checks whether timesyncd has been made executable.
Anyhow, the key point here is that the timesynd hook ships by default on a distro where the user might have intentionally disabled timesyncd to use e.g. Crony with a fixed NTP server instead, or may even have intentionally removed systemd to revert to a more traditional sysv init. Without this double check right at the start of the hook, errors appear.
If you prefer putting these in a function, I don't have any objection, but doing what dhclient does (i.e. stick these as-is at the start of the script) would probably be the safest bet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rsmarples are we merging this?