File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
pkg/cidata/cidata.TEMPLATE.d/boot Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,22 @@ command -v systemctl >/dev/null 2>&1 || exit 0
13
13
systemctl enable systemd-time-wait-sync.service
14
14
15
15
# For the first boot, where the above setting is not yet active, wait for NTP synchronization here.
16
- until ntp_synchronized=$( timedatectl show --property=NTPSynchronized --value) && [ " ${ntp_synchronized} " = " yes" ]; do
16
+ max_retry=60 retry=0
17
+ until ntp_synchronized=$( timedatectl show --property=NTPSynchronized --value) && [ " ${ntp_synchronized} " = " yes" ] ||
18
+ [ " ${retry} " -gt " ${max_retry} " ]; do
17
19
time_usec=$( timedatectl show --property=TimeUSec)
18
20
echo " ${time_usec} , Waiting for NTP synchronization..."
21
+ retry=$(( retry + 1 ))
19
22
sleep 1
20
23
done
21
24
# Print the result of NTP synchronization
22
25
ntp_message=$( timedatectl show-timesync --property=NTPMessage)
23
26
time_usec=$( timedatectl show --property=TimeUSec)
24
- echo " ${time_usec} , NTP synchronization complete."
25
- echo " ${ntp_message} "
27
+ if [ " ${ntp_synchronized} " = " yes" ]; then
28
+ echo " ${time_usec} , NTP synchronization complete."
29
+ echo " ${ntp_message} "
30
+ else
31
+ echo " ${time_usec} , NTP synchronization timed out."
32
+ echo " ${ntp_message} "
33
+ exit 1
34
+ fi
You can’t perform that action at this time.
0 commit comments