Skip to content
Snippets Groups Projects
Commit b4d0a39b authored by Adam Wujek's avatar Adam Wujek :speech_balloon:
Browse files

userspace/rootfs_override: save date of last update


Note: Be aware that date of last update may be not accurate.
One reason is that it uses date stored before last restart, so time needed to restart is not taken into account.
Additionally date stored before restart may be not accurate for many reasons like:
--hard restart (last know date was not saved)
--date was never received from ntp nor set manually

Signed-off-by: default avatarAdam Wujek <adam.wujek@cern.ch>
parent feb4f8f2
Branches
Tags
No related merge requests found
...@@ -123,6 +123,9 @@ mount -t ubifs ubi0:boot /boot ...@@ -123,6 +123,9 @@ mount -t ubifs ubi0:boot /boot
# Some steps later set reboot=true; prepare a sane default. # Some steps later set reboot=true; prepare a sane default.
reboot=false reboot=false
#whether to change date of last update
change_update_date=false
# First: update usr: we may have the whole thing, or just wrs-usr.tar.gz # First: update usr: we may have the whole thing, or just wrs-usr.tar.gz
if [ -f /update/$WRS_FW -o -f /update/$WRS_USR ]; then if [ -f /update/$WRS_FW -o -f /update/$WRS_USR ]; then
# FIXME: save configuration somewhere, and recover it later # FIXME: save configuration somewhere, and recover it later
...@@ -171,7 +174,7 @@ if [ -f /update/$WRS_FW -o -f /update/$WRS_USR ]; then ...@@ -171,7 +174,7 @@ if [ -f /update/$WRS_FW -o -f /update/$WRS_USR ]; then
fi fi
# And, to be sure, remove a file that may exist from a 4.0 install # And, to be sure, remove a file that may exist from a 4.0 install
rm -f /update/$OLD_FW_OLDNAME rm -f /update/$OLD_FW_OLDNAME
change_update_date=true
fi fi
# Allow replacing the kernel or initramfs alone (new in v4.1 of wr-switch-sw) # Allow replacing the kernel or initramfs alone (new in v4.1 of wr-switch-sw)
...@@ -190,8 +193,12 @@ if [ -f /update/$WRS_BB ]; then ...@@ -190,8 +193,12 @@ if [ -f /update/$WRS_BB ]; then
mv /update/current-$WRS_BB /update/previous-$WRS_BB mv /update/current-$WRS_BB /update/previous-$WRS_BB
mv /update/$WRS_BB /update/current-$WRS_BB mv /update/$WRS_BB /update/current-$WRS_BB
reboot=true reboot=true
change_update_date=true
fi fi
if $change_update_date; then
cp /update/saved_date /update/last_update > /dev/null 2>&1
fi
# If we changed bloader or kernel or initramfs, we reboot. Otherwise proceed. # If we changed bloader or kernel or initramfs, we reboot. Otherwise proceed.
if $reboot; then if $reboot; then
umount /update umount /update
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment