diff options
| author | Jeroen Hofstee via Openembedded-core <openembedded-core@lists.openembedded.org> | 2019-03-01 20:16:02 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-03-04 22:57:05 +0000 |
| commit | ad8052440445a6cf0a1bf7df6fdaee27480591e4 (patch) | |
| tree | 3323105af23412c0b19bd2789c7ee21137ab263c /meta/recipes-core/initscripts | |
| parent | 9120e52ba15535da8ec34502a441aaeaadfb4e9d (diff) | |
| download | poky-ad8052440445a6cf0a1bf7df6fdaee27480591e4.tar.gz | |
initscripts: Add support for /etc/default/timestamp
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.
(From OE-Core rev: b4de37b7176630d9585b12c50d537cd561c7aeb9)
Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initscripts')
| -rwxr-xr-x | meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | 7 | ||||
| -rw-r--r-- | meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh index df553bc079..591591f87f 100755 --- a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh +++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | |||
| @@ -8,7 +8,10 @@ | |||
| 8 | # Short-Description: Misc and other. | 8 | # Short-Description: Misc and other. |
| 9 | ### END INIT INFO | 9 | ### END INIT INFO |
| 10 | 10 | ||
| 11 | TIMESTAMP_FILE=/etc/timestamp | ||
| 12 | |||
| 11 | . /etc/default/rcS | 13 | . /etc/default/rcS |
| 14 | [ -f /etc/default/timestamp ] && . /etc/default/timestamp | ||
| 12 | # | 15 | # |
| 13 | # Put a nologin file in /etc to prevent people from logging in before | 16 | # Put a nologin file in /etc to prevent people from logging in before |
| 14 | # system startup is complete. | 17 | # system startup is complete. |
| @@ -64,10 +67,10 @@ fi | |||
| 64 | # If the timestamp is more recent than the current time, | 67 | # If the timestamp is more recent than the current time, |
| 65 | # use the timestamp instead. | 68 | # use the timestamp instead. |
| 66 | test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start | 69 | test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start |
| 67 | if test -e /etc/timestamp | 70 | if test -e "$TIMESTAMP_FILE" |
| 68 | then | 71 | then |
| 69 | SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S` | 72 | SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S` |
| 70 | read TIMESTAMP < /etc/timestamp | 73 | read TIMESTAMP < "$TIMESTAMP_FILE" |
| 71 | if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then | 74 | if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then |
| 72 | # format the timestamp as date expects it (2m2d2H2M4Y.2S) | 75 | # format the timestamp as date expects it (2m2d2H2M4Y.2S) |
| 73 | TS_YR=${TIMESTAMP%??????????} | 76 | TS_YR=${TIMESTAMP%??????????} |
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh index 1632a5f649..ffa1eee43d 100644 --- a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh +++ b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh | |||
| @@ -9,5 +9,9 @@ | |||
| 9 | # Description: | 9 | # Description: |
| 10 | ### END INIT INFO | 10 | ### END INIT INFO |
| 11 | 11 | ||
| 12 | TIMESTAMP_FILE=/etc/timestamp | ||
| 13 | |||
| 14 | [ -f /etc/default/timestamp ] && . /etc/default/timestamp | ||
| 15 | |||
| 12 | # Update the timestamp | 16 | # Update the timestamp |
| 13 | date -u +%4Y%2m%2d%2H%2M%2S 2>/dev/null > /etc/timestamp | 17 | date -u +%4Y%2m%2d%2H%2M%2S 2>/dev/null > "$TIMESTAMP_FILE" |
