[FIX] hw_drivers: Synchronize time before starting Odoo

Some features need the time to be synchronized before starting:
- A certificate might be considered valid and therefore not renewed if
the time is not synced.
- If the time is not correct when the pairing code is retrieved, it
will disappear as soon as the time is synced because more than 5
minutes will have "passed" since the code was retrieved.

We then make sure that the time is synced, or that the box is not
connected to the internet (because in this case the time will never be
synced and those features cannot work with a connection anyway).

closes odoo/odoo#53953

X-original-commit: b9b02dba67cd0a91b8c49a5f57fb2f7eb4bdd690
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
This commit is contained in:
Antoine Prieels
2020-07-02 08:21:47 +00:00
parent a86e90af53
commit 17e198db3a
@@ -26,6 +26,11 @@ test -x $DAEMON || exit 0
set -e
function _start() {
# Wait for time to be synced or AP to start or max 30 seconds
cnt=30
while ! test -a /run/systemd/timesync/synchronized && ! ip route | grep 10.11.12.1 && ((cnt--)); do
sleep 1
done
start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER:$USER --background --make-pidfile --exec $DAEMON -- --config $CONFIG --logfile $LOGFILE --load=web,hw_proxy,hw_posbox_homepage,hw_escpos,hw_drivers --limit-time-cpu=600 --limit-time-real=1200
}