https://github.com/Angstrom-distribution/meta-angstrom/commit/8228b2d56ef2415c8b96d1463fb38816279d4c74
changes the time format written to /etc/timestamp
When the system time is set from the content of /etc/timestamp,
one has to use the new format also.

While at it
- remove the now unneeded cut and concatenation as the string is already
  correctly ordered.
- consistently use absolute pathnames to programs
- don't print warnings when /etc/timestamp does not exist

Signed-off-by: Koen Kooi <k...@dominion.thruhere.net>
(cherry picked from commit 7776d287c3a6666d3789ac0fc706a12b079c1dc7)
Signed-off-by: Max Krummenacher <max.oss...@gmail.com>
---
 recipes-core/systemd/timestamp-service/load-timestamp.sh | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/recipes-core/systemd/timestamp-service/load-timestamp.sh 
b/recipes-core/systemd/timestamp-service/load-timestamp.sh
index f1c9723..d65c729 100755
--- a/recipes-core/systemd/timestamp-service/load-timestamp.sh
+++ b/recipes-core/systemd/timestamp-service/load-timestamp.sh
@@ -5,16 +5,11 @@
 # use the timestamp instead.
 SYSTEMDATE=$(/bin/date -u "+%4Y%2m%2d%2H%2M")
 
-YEAR=$(cat /etc/timestamp | cut -b 1-4)
-MONTH=$(cat /etc/timestamp | cut -b 5-6)
-DAY=$(cat /etc/timestamp | cut -b 7-8)
-TIME=$(cat /etc/timestamp | cut -b 9-12)
+TIMESTAMP=$(/bin/cat /etc/timestamp 2>/dev/null)
 
-TIMESTAMP="$YEAR$MONTH$DAY$TIME"
-
-if [ $SYSTEMDATE -lt $TIMESTAMP ]; then 
+if [ $SYSTEMDATE -lt $TIMESTAMP ] 2>/dev/null ; then
        echo "Update systemtime from /etc/timestamp"
-       date -u $(cat /etc/timestamp)
+       /bin/date -u ${TIMESTAMP#????}${TIMESTAMP%????????}
 fi
 
 if [ "$1" = "--save" ] ; then
-- 
1.9.3


_______________________________________________
Angstrom-distro-devel mailing list
Angstrom-distro-devel@linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/angstrom-distro-devel

Reply via email to