|
|
@ -12,8 +12,18 @@ end
|
|
|
|
local ntp_cmd
|
|
|
|
local ntp_cmd
|
|
|
|
-- Check if we have access to ntpd or ntpdate
|
|
|
|
-- Check if we have access to ntpd or ntpdate
|
|
|
|
if os.execute("command -v ntpd >/dev/null") == 0 then
|
|
|
|
if os.execute("command -v ntpd >/dev/null") == 0 then
|
|
|
|
ntp_cmd = "ntpd -q -n -p pool.ntp.org"
|
|
|
|
-- Make sure it's actually busybox's implementation, as the syntax may otherwise differ...
|
|
|
|
elseif os.execute("command -v ntpdate >/dev/null") == 0 then
|
|
|
|
-- (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"
|
|
|
|
ntp_cmd = "ntpdate pool.ntp.org"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if not ntp_cmd then
|
|
|
|
if not ntp_cmd then
|
|
|
|