@@ -54,6 +54,11 @@ config BR2_PACKAGE_NTP_NTPDATE
The ntpdate utility program is used to set the local date
and time from an NTP server given as an argument.
+ This option is deprecated by upstream and replaced with the
+ -gq options of ntpd. The package/ntp/S49ntp script has an
+ example implementation.
+ (http://support.ntp.org/bin/view/Dev/DeprecatingNtpdate)
+
config BR2_PACKAGE_NTP_NTPDC
bool "ntpdc"
help
@@ -2,6 +2,7 @@
NAME=ntpd
+NTP_WAIT_DELAY=15 #sec
# Read config file if it is present.
if [ -r /etc/default/$NAME ]
then
@@ -10,8 +11,26 @@ fi
case "$1" in
start)
+ CURRENT_UNIX_TIME="$(date +%s)"
+ if [ $CURRENT_UNIX_TIME -lt 1000000000 ]; then
+ printf "Checking for time"
+ # stderr redirected to hide output if IPv6 not enabled
+ /usr/sbin/ntpd -g -q > /dev/null 2>&1 &
+ NTP_PID=$!
+ while [ ${NTP_WAIT_DELAY} -gt 0 ]; do
+ [ ! -e /proc/$NTP_PID ] && break
+ sleep 1
+ printf "."
+ : $((NTP_WAIT_DELAY -= 1))
+ done
+ # ntpd never returns if it can't access the NTP server(s)
+ # noted in /etc/ntp.conf.
+ kill $NTP_PID > /dev/null 2>&1
+ [ $? = 0 ] && printf "(Not set)"
+ fi
+ echo " OK"
printf "Starting $NAME: "
- start-stop-daemon -S -q -x /usr/sbin/ntpd -- -g
+ start-stop-daemon -S -q -x /usr/sbin/ntpd --
[ $? = 0 ] && echo "OK" || echo "FAIL"
;;
stop)