Merge pull request #771 from MilhouseVH/proppa_english

backup: fix up messages
This commit is contained in:
Lukas Rusak 2016-09-28 12:23:08 -07:00 committed by GitHub
commit 200f49a51d
2 changed files with 92 additions and 35 deletions

View File

@ -17,29 +17,59 @@
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################ ################################################################################
. /usr/lib/libreelec/functions
# Get NAME, which is DISTRONAME, ie. LibreELEC
. /etc/os-release
hidecursor
BACKUP_FILE=`ls -1 /storage/.restore/??????????????.tar 2>/dev/null | tail -1` BACKUP_FILE=`ls -1 /storage/.restore/??????????????.tar 2>/dev/null | tail -1`
if [ -f "$BACKUP_FILE" ] ; then if [ -f "$BACKUP_FILE" ] ; then
echo -en "please wait.. checking backup file: " echo "RESTORE IN PROGRESS"
tar tf $BACKUP_FILE &>/dev/null echo ""
ret=$? echo "Please do not reboot or turn off your ${NAME} device!"
echo ""
StartProgress spinner "Checking backup file... "
tar tf $BACKUP_FILE &>/dev/null
ret=$?
if [ $ret -eq 0 ] ; then if [ $ret -eq 0 ] ; then
echo OK StopProgress "OK"
echo -en "restoring.. this may take long time to complete, please wait.. "
rm -rf /storage/.kodi &>/dev/null echo
rm -rf /storage/.cache &>/dev/null echo "This may take some time to complete, please be patient."
rm -rf /storage/.config &>/dev/null echo
tar xf $BACKUP_FILE -C / &>/dev/null
rm -f $BACKUP_FILE &>/dev/null StartProgress spinner "Restoring... "
echo done rm -rf /storage/.kodi &>/dev/null
echo "rebooting in 5s..." rm -rf /storage/.cache &>/dev/null
sleep 5 rm -rf /storage/.config &>/dev/null
tar xf $BACKUP_FILE -C / &>/dev/null
rm -f $BACKUP_FILE &>/dev/null
sync
StopProgress "done!"
echo
StartProgress countdown "Rebooting in 5s... " 5 "NOW"
else else
echo FAILED StopProgress "FAILED"
rm -f $BACKUP_FILE &>/dev/null
echo "rebooting in 30s..." echo
sleep 30 echo "Backup file is not valid, or corrupt."
echo
StartProgress spinner "Removing file to allow normal restart... "
rm -f $BACKUP_FILE &>/dev/null
sync
StopProgress "done"
echo
StartProgress countdown "Rebooting in 30s... " 30 "NOW"
fi fi
fi fi
sync sync
reboot -f reboot -f

View File

@ -17,6 +17,17 @@
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>. # along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################ ################################################################################
. /usr/lib/libreelec/functions
# Get NAME, which is DISTRONAME, ie. LibreELEC
. /etc/os-release
hidecursor
label=
target=
uuid=
get_target() { get_target() {
for arg in $(cat /proc/cmdline); do for arg in $(cat /proc/cmdline); do
case $arg in case $arg in
@ -25,14 +36,14 @@ get_target() {
case $disk in case $disk in
LABEL=*) LABEL=*)
label="${disk#*=}" label="${disk#*=}"
target=`blkid -L $label` target="$(blkid -L $label)"
;; ;;
UUID=*) UUID=*)
uuid="${disk#*=}" uuid="${disk#*=}"
target=`blkid -U $uuid` target="$(blkid -U $uuid)"
;; ;;
/*) /*)
target=$disk target="$disk"
;; ;;
esac esac
;; ;;
@ -40,33 +51,49 @@ get_target() {
done done
} }
show_reset_msg() {
echo "RESET IN PROGRESS"
echo ""
echo "Please do not reboot or turn off your ${NAME} device!"
echo ""
}
if [ -f /storage/.cache/reset_oe ] ; then if [ -f /storage/.cache/reset_oe ] ; then
# hard reset # hard reset
rm -f /storage/.cache/reset_oe rm -f /storage/.cache/reset_oe
get_target get_target
if [ ! -z $target ] ; then if [ ! -z $target ] ; then
echo "hard resetting..." show_reset_msg
umount /storage
mke2fs -t ext4 -m 0 $target 2>&1 >/dev/null StartProgress spinner "Performing hard reset... "
if [ ! -z $label ] ; then umount /storage
tune2fs -U random -L $label $target mke2fs -t ext4 -m 0 $target &>/dev/null
fi if [ ! -z $label ] ; then
if [ ! -z $uuid ] ; then tune2fs -U random -L $label $target &>/dev/null
tune2fs -U $uuid $target fi
fi if [ ! -z $uuid ] ; then
echo "done" tune2fs -U $uuid $target &>/dev/null
sleep 5 fi
StopProgress "done!"
echo
StartProgress countdown "Rebooting in 5s... " 5 "NOW"
fi fi
elif [ -f /storage/.cache/reset_xbmc ] ; then elif [ -f /storage/.cache/reset_xbmc ] ; then
# soft reset # soft reset
rm -f /storage/.cache/reset_xbmc rm -f /storage/.cache/reset_xbmc
get_target get_target
if [ ! -z $target ] ; then if [ ! -z $target ] ; then
echo "soft resetting..." show_reset_msg
rm -rf /storage/.??* 2>&1 >/dev/null
echo "done" StartProgress spinner "Performing soft reset... "
sleep 5 rm -rf /storage/.??* &>/dev/null
StopProgress "done!"
echo
StartProgress countdown "Rebooting in 5s... " 5 "NOW"
fi fi
fi fi
sync sync
reboot -f reboot -f