diff --git a/packages/mediacenter/service.openelec.settings/init.d/00_restore b/packages/mediacenter/service.openelec.settings/init.d/00_restore new file mode 100644 index 0000000000..a80f1b1603 --- /dev/null +++ b/packages/mediacenter/service.openelec.settings/init.d/00_restore @@ -0,0 +1,48 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ +# restore +# +# runlevels: openelec + +BACKUP_FILE=`ls -1 /storage/.restore/??????????????.tar 2>/dev/null | tail -1` + +if [ -e "$BACKUP_FILE" ] ; then + echo -en "please wait.. 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/.xbmc &>/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 "all good. normal startup in 5s..." + sleep 5 + else + echo FAILED + echo "normal startup in 30s..." + rm -f $BACKUP_FILE &>/dev/null + sleep 30 + fi +fi +