Merge pull request #1996 from MilhouseVH/le82_upgrade_single_shot

init: recover from a failed upgrade [Backport]
This commit is contained in:
Christian Hewitt 2017-09-20 19:31:54 +04:00 committed by GitHub
commit 1ada221e6b

View File

@ -772,8 +772,16 @@
return 0
fi
# remove temporary folder if exist from previous run
rm -fr "$UPDATE_DIR/.tmp" &>/dev/null
if [ -d $UPDATE_DIR/.tmp ]; then
echo "Failed update detected - performing recovery."
echo ""
do_cleanup
StartProgress countdown "Normal startup in 10s... " 10 "NOW"
return 0
fi
mkdir -p $UPDATE_DIR/.tmp &>/dev/null
sync
echo "UPGRADE IN PROGRESS"
echo ""
@ -786,7 +794,6 @@
echo "Found new .tar archive"
UPDATE_FILENAME="$UPDATE_TAR"
StartProgress spinner "Extracting contents of archive... "
mkdir -p $UPDATE_DIR/.tmp &>/dev/null
tar -xf "$UPDATE_TAR" -C $UPDATE_DIR/.tmp 1>/dev/null 2>/tmp/tarresult.txt || TARRESULT="1"
if [ "${TARRESULT}" -eq "0" ]; then