set-datetime: Use timedatectl to force flush the time to disk
Previously if you "rudely" unplugged the board and plugged it back in, it would
revert to 2016 because systemd-timesync didn't write its timestamp to disk.
Change-Id: If5830cb26152381814190dfbd732081a38880992
diff --git a/debian/changelog b/debian/changelog
index 7b746f3..8866c26 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+mendel-minimal (4-1) mendel-beaker; urgency=medium
+
+ * Fixes the set-datetime runonce script to make use of timedatectl for
+ force write its timestamp to disk.
+
+ -- AIY Projects <support-aiyprojects@google.com> Mon, 28 Jan 2019 13:31:00 -0800
+
mendel-minimal (3-1) mendel-beaker; urgency=medium
* Reverts the multistrap source lists change below.
diff --git a/etc/runonce.d/98-set-datetime b/etc/runonce.d/98-set-datetime
index e998d6a..9cdfd79 100755
--- a/etc/runonce.d/98-set-datetime
+++ b/etc/runonce.d/98-set-datetime
@@ -1,4 +1,7 @@
#!/bin/bash
PROGNAME=$(basename $(readlink -f $0))
-date --set="$(stat /etc/runonce.d/ |grep Change |sed -e 's/^Change: //g' -e 's/+0000//g')"
+date --set="$(stat /lost+found |grep Change |sed -e 's/^Change: //g' -e 's/+0000//g')"
+timedatectl set-ntp false
+timedatectl set-time "$(date '+%Y-%m-%d %H:%M:%S')"
+timedatectl set-ntp true