From: Roy Marples Date: Tue, 9 Aug 2022 16:32:49 +0000 (+0100) Subject: Amend prior so that NTP servers are removed if the option vanishes X-Git-Tag: v10.0.0~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ab00c2de58936b30be48611e9d402ad51de5abb;p=thirdparty%2Fdhcpcd.git Amend prior so that NTP servers are removed if the option vanishes --- diff --git a/hooks/50-timesyncd.conf b/hooks/50-timesyncd.conf index 064e0c03..7cf78b17 100644 --- a/hooks/50-timesyncd.conf +++ b/hooks/50-timesyncd.conf @@ -6,9 +6,20 @@ timesyncd_tmp="$timesyncd_tmp_d/$ifname" NL=" " +remove_timesyncd_conf() +{ + if [ -e "$timesyncd_conf" ]; then + rm "$timesyncd_conf" + systemctl try-reload-or-restart systemd-timesyncd + fi +} + add_timesyncd_conf() { - [ -n "$new_ntp_servers" ] || return + if [ -z "$new_ntp_servers" ]; then + remove_timesyncd_conf + return $? + fi mkdir -p "$timesyncd_tmp_d" "$timesyncd_conf_d" @@ -22,14 +33,6 @@ add_timesyncd_conf() fi } -remove_timesyncd_conf() -{ - if [ -e "$timesyncd_conf" ]; then - rm "$timesyncd_conf" - systemctl try-reload-or-restart systemd-timesyncd - fi -} - if $if_configured; then if $if_up; then add_timesyncd_conf