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
1313systemctl enable systemd-time-wait-sync.service
1414
1515# 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
1719 time_usec=$( timedatectl show --property=TimeUSec)
1820 echo " ${time_usec} , Waiting for NTP synchronization..."
21+ retry=$(( retry + 1 ))
1922 sleep 1
2023done
2124# Print the result of NTP synchronization
2225ntp_message=$( timedatectl show-timesync --property=NTPMessage)
2326time_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