init: recover from a failed upgrade

This commit is contained in:
MilhouseVH 2017-09-17 16:16:55 +01:00
parent 4c15c2d666
commit 3dc7f409a4

View File

@ -772,8 +772,16 @@
return 0 return 0
fi fi
# remove temporary folder if exist from previous run if [ -d $UPDATE_DIR/.tmp ]; then
rm -fr "$UPDATE_DIR/.tmp" &>/dev/null 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 "UPGRADE IN PROGRESS"
echo "" echo ""
@ -786,7 +794,6 @@
echo "Found new .tar archive" echo "Found new .tar archive"
UPDATE_FILENAME="$UPDATE_TAR" UPDATE_FILENAME="$UPDATE_TAR"
StartProgress spinner "Extracting contents of archive... " 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" tar -xf "$UPDATE_TAR" -C $UPDATE_DIR/.tmp 1>/dev/null 2>/tmp/tarresult.txt || TARRESULT="1"
if [ "${TARRESULT}" -eq "0" ]; then if [ "${TARRESULT}" -eq "0" ]; then