mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2024-11-22 11:36:20 +00:00
750dd4add2
connman's NTP client can't be used if it's not managing the network interface so use systemd's timesyncd as we already build it. timesyncd is automatically configured to use the NTP servers provided by kernel ip config, if they are missing the default fallback NTP servers (currently the ones from Google) are used. Users can also provide timesyncd configuration files via /storage/.config/timesyncd.conf.d/ eg to change the (fallback) servers. Signed-off-by: Matthias Reichl <hias@horus.com>
23 lines
552 B
Bash
Executable File
23 lines
552 B
Bash
Executable File
#!/bin/sh
|
|
KERNEL_NTP="${1:-/proc/net/ipconfig/ntp_servers}"
|
|
NTP_SERVERS=""
|
|
if [ -f /proc/net/ipconfig/ntp_servers ]; then
|
|
for srv in $(cat /proc/net/ipconfig/ntp_servers); do
|
|
if [ -n "$srv" -a "$srv" != "0.0.0.0" ]; then
|
|
if [ -z "$NTP_SERVERS" ]; then
|
|
NTP_SERVERS="$srv"
|
|
else
|
|
NTP_SERVERS="${NTP_SERVERS} $srv"
|
|
fi
|
|
fi
|
|
done
|
|
if [ -n "$NTP_SERVERS" ]; then
|
|
mkdir -p /run/systemd/timesyncd.conf.d/
|
|
cat << EOF > /run/systemd/timesyncd.conf.d/kernel-ntp-servers.conf
|
|
[Time]
|
|
NTP=$NTP_SERVERS
|
|
EOF
|
|
fi
|
|
fi
|
|
|