From c7107512ea336a2bc773a33cf480a9694255c0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin-=C3=89ric=20RACINE?= <57731134+perkelix@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:04:53 +0200 Subject: [PATCH] Exit the timesyncd hook if not on systemd and not executable (#398) Exit the timesyncd hook immediately if not running on a systemd host AND timesyncd is not executable. --- hooks/50-timesyncd.conf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hooks/50-timesyncd.conf b/hooks/50-timesyncd.conf index dff881732..8ee722bda 100644 --- a/hooks/50-timesyncd.conf +++ b/hooks/50-timesyncd.conf @@ -1,3 +1,10 @@ +if [ ! -d /run/systemd/system ]; then + return +fi +if [ ! -x /lib/systemd/systemd-timesyncd ]; then + return +fi + : ${timesyncd_conf_d:=/run/systemd/timesyncd.conf.d} timesyncd_conf="${timesyncd_conf_d}/dhcpcd-$ifname.conf" timesyncd_tmp_d="$state_dir/timesyncd"