Skip to content

Commit 53ceb2a

Browse files
committed
dhcp ntp: fix logic of ntp server override
1 parent 4de440b commit 53ceb2a

File tree

1 file changed

+3
-2
lines changed
  • overlay/usr/share/udhcpc/default.script.d

1 file changed

+3
-2
lines changed

overlay/usr/share/udhcpc/default.script.d/ntp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/bin/sh
22

3+
NTP_DEFAULT_FILE="/etc/default/ntp.conf"
34
NTP_WORKING_FILE="/tmp/ntp.conf"
45

56
setup_ntp_from_dhcp() {
67
echo "Use DHCP provided NTP servers: $ntpsrv"
78

8-
if [ -f "$NTP_WORKING_FILE" ] && [ '444' = "$(stat -c%a $NTP_WORKING_FILE)" ]; then
9-
echo "$NTP_WORKING_FILE is read-only, skipping update"
9+
if [ -f "$NTP_DEFAULT_FILE" ] && [ '444' = "$(stat -c%a $NTP_DEFAULT_FILE)" ]; then
10+
echo "$NTP_DEFAULT_FILE is read-only, skipping update"
1011
else
1112
echo "Add DHCP provided NTP servers to $NTP_WORKING_FILE"
1213
echo $ntpsrv | tr ' ' '\n' | sed 's/^/server /; s/$/ iburst #added by DHCP/' > $NTP_WORKING_FILE

0 commit comments

Comments
 (0)