Commit b4d0a39b authored by Adam Wujek's avatar Adam Wujek 💬

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: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent feb4f8f2
......@@ -123,6 +123,9 @@ mount -t ubifs ubi0:boot /boot
# Some steps later set reboot=true; prepare a sane default.
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
if [ -f /update/$WRS_FW -o -f /update/$WRS_USR ]; then
# FIXME: save configuration somewhere, and recover it later
......@@ -171,7 +174,7 @@ if [ -f /update/$WRS_FW -o -f /update/$WRS_USR ]; then
fi
# And, to be sure, remove a file that may exist from a 4.0 install
rm -f /update/$OLD_FW_OLDNAME
change_update_date=true
fi
# 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
mv /update/current-$WRS_BB /update/previous-$WRS_BB
mv /update/$WRS_BB /update/current-$WRS_BB
reboot=true
change_update_date=true
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 $reboot; then
umount /update
......
Markdown is supported
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