]> code.ossystems Code Review - openembedded-core.git/commitdiff
initscripts: Add support for /etc/default/timestamp
authorJeroen Hofstee via Openembedded-core <openembedded-core@lists.openembedded.org>
Fri, 1 Mar 2019 20:16:02 +0000 (20:16 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 4 Mar 2019 14:34:17 +0000 (14:34 +0000)
Source /etc/default/timestamp if present. This allows the rootfs to be
read-only / store the file in a persistant location if the whole rootfs
is updated.

Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh

index df553bc079dba63a842d3b47433737066a6df001..591591f87fd7b7a0c879e5407d4f9f801efa61aa 100755 (executable)
@@ -8,7 +8,10 @@
 # Short-Description: Misc and other.
 ### END INIT INFO
 
+TIMESTAMP_FILE=/etc/timestamp
+
 . /etc/default/rcS
+[ -f /etc/default/timestamp ] && . /etc/default/timestamp
 #
 # Put a nologin file in /etc to prevent people from logging in before
 # system startup is complete.
@@ -64,10 +67,10 @@ fi
 # If the timestamp is more recent than the current time,
 # use the timestamp instead.
 test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
-if test -e /etc/timestamp
+if test -e "$TIMESTAMP_FILE"
 then
        SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S`
-       read TIMESTAMP < /etc/timestamp
+       read TIMESTAMP < "$TIMESTAMP_FILE"
        if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
                # format the timestamp as date expects it (2m2d2H2M4Y.2S)
                TS_YR=${TIMESTAMP%??????????}
index 1632a5f649fd2542898101355b421c0f7d082273..ffa1eee43df097139f4a2b91544f44145f2710f9 100644 (file)
@@ -9,5 +9,9 @@
 # Description:       
 ### END INIT INFO
 
+TIMESTAMP_FILE=/etc/timestamp
+
+[ -f /etc/default/timestamp ] && . /etc/default/timestamp
+
 # Update the timestamp
-date -u +%4Y%2m%2d%2H%2M%2S 2>/dev/null > /etc/timestamp
+date -u +%4Y%2m%2d%2H%2M%2S 2>/dev/null > "$TIMESTAMP_FILE"