diff --git a/packages/mediacenter/LibreELEC-settings/scripts/backup-restore b/packages/mediacenter/LibreELEC-settings/scripts/backup-restore
index 788b6082e6..da3c07f182 100755
--- a/packages/mediacenter/LibreELEC-settings/scripts/backup-restore
+++ b/packages/mediacenter/LibreELEC-settings/scripts/backup-restore
@@ -17,29 +17,59 @@
# along with OpenELEC. If not, see .
################################################################################
+. /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`
if [ -f "$BACKUP_FILE" ] ; then
- echo -en "please wait.. checking backup file: "
- tar tf $BACKUP_FILE &>/dev/null
- ret=$?
+ echo "RESTORE IN PROGRESS"
+ echo ""
+ 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
- echo OK
- echo -en "restoring.. this may take long time to complete, please wait.. "
- rm -rf /storage/.kodi &>/dev/null
- rm -rf /storage/.cache &>/dev/null
- rm -rf /storage/.config &>/dev/null
- tar xf $BACKUP_FILE -C / &>/dev/null
- rm -f $BACKUP_FILE &>/dev/null
- echo done
- echo "rebooting in 5s..."
- sleep 5
+ StopProgress "OK"
+
+ echo
+ echo "This may take some time to complete, please be patient."
+ echo
+
+ StartProgress spinner "Restoring... "
+ rm -rf /storage/.kodi &>/dev/null
+ rm -rf /storage/.cache &>/dev/null
+ 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
- echo FAILED
- rm -f $BACKUP_FILE &>/dev/null
- echo "rebooting in 30s..."
- sleep 30
+ StopProgress "FAILED"
+
+ echo
+ 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
+
sync
reboot -f
diff --git a/packages/mediacenter/LibreELEC-settings/scripts/factory-reset b/packages/mediacenter/LibreELEC-settings/scripts/factory-reset
index b966790220..3a8e27bd1c 100755
--- a/packages/mediacenter/LibreELEC-settings/scripts/factory-reset
+++ b/packages/mediacenter/LibreELEC-settings/scripts/factory-reset
@@ -17,6 +17,17 @@
# along with OpenELEC. If not, see .
################################################################################
+. /usr/lib/libreelec/functions
+
+# Get NAME, which is DISTRONAME, ie. LibreELEC
+. /etc/os-release
+
+hidecursor
+
+label=
+target=
+uuid=
+
get_target() {
for arg in $(cat /proc/cmdline); do
case $arg in
@@ -25,14 +36,14 @@ get_target() {
case $disk in
LABEL=*)
label="${disk#*=}"
- target=`blkid -L $label`
+ target="$(blkid -L $label)"
;;
UUID=*)
uuid="${disk#*=}"
- target=`blkid -U $uuid`
+ target="$(blkid -U $uuid)"
;;
/*)
- target=$disk
+ target="$disk"
;;
esac
;;
@@ -40,33 +51,49 @@ get_target() {
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
# hard reset
rm -f /storage/.cache/reset_oe
get_target
if [ ! -z $target ] ; then
- echo "hard resetting..."
- umount /storage
- mke2fs -t ext4 -m 0 $target 2>&1 >/dev/null
- if [ ! -z $label ] ; then
- tune2fs -U random -L $label $target
- fi
- if [ ! -z $uuid ] ; then
- tune2fs -U $uuid $target
- fi
- echo "done"
- sleep 5
+ show_reset_msg
+
+ StartProgress spinner "Performing hard reset... "
+ umount /storage
+ mke2fs -t ext4 -m 0 $target &>/dev/null
+ if [ ! -z $label ] ; then
+ tune2fs -U random -L $label $target &>/dev/null
+ fi
+ if [ ! -z $uuid ] ; then
+ tune2fs -U $uuid $target &>/dev/null
+ fi
+ StopProgress "done!"
+
+ echo
+ StartProgress countdown "Rebooting in 5s... " 5 "NOW"
fi
elif [ -f /storage/.cache/reset_xbmc ] ; then
# soft reset
rm -f /storage/.cache/reset_xbmc
get_target
if [ ! -z $target ] ; then
- echo "soft resetting..."
- rm -rf /storage/.??* 2>&1 >/dev/null
- echo "done"
- sleep 5
+ show_reset_msg
+
+ StartProgress spinner "Performing soft reset... "
+ rm -rf /storage/.??* &>/dev/null
+ StopProgress "done!"
+
+ echo
+ StartProgress countdown "Rebooting in 5s... " 5 "NOW"
fi
fi
+
sync
reboot -f