TimeSync: Double-check that ntpd is busybox (#10992)

Kindle ships another implementation, with incompatible syntax...

Regression since #10935
Thanks to @yparitcher ;).
reviewable/pr10997/r1
NiLuJe 7 months ago committed by GitHub
parent 27104ea011
commit 16e96969c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,8 +12,18 @@ end
local ntp_cmd
-- Check if we have access to ntpd or ntpdate
if os.execute("command -v ntpd >/dev/null") == 0 then
ntp_cmd = "ntpd -q -n -p pool.ntp.org"
elseif os.execute("command -v ntpdate >/dev/null") == 0 then
-- Make sure it's actually busybox's implementation, as the syntax may otherwise differ...
-- (Of particular note, Kobo ships busybox ntpd, but not ntpdate; and Kindle ships ntpdate and !busybox ntpd).
local path = os.getenv("PATH") or ""
for p in path:gmatch("([^:]+)") do
local sym = lfs.symlinkattributes(p .. "/ntpd")
if sym and sym.mode == "link" and string.sub(sym.target, -7) == "busybox" then
ntp_cmd = "ntpd -q -n -p pool.ntp.org"
break
end
end
end
if not ntp_cmd and os.execute("command -v ntpdate >/dev/null") == 0 then
ntp_cmd = "ntpdate pool.ntp.org"
end
if not ntp_cmd then

Loading…
Cancel
Save