Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/sbin/sh -x
- #
- # This program is free software; you can redistribute it and/or modify it
- # under the terms of the GNU Library 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.
- #
- # License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
- #
- BB=/sbin/busybox;
- UN=/sbin/unyaffs;
- SYS=/system;
- CHE=/cache;
- DATA=/data;
- ANDSEC=/sdcard/.android_secure;
- DATE=`date +.%m.%d.%Y.%I:%M`;
- BU=/sdcard/clockworkmod/backup/$DATE;
- OUTFD=$(ps | grep -v "grep" | grep -o -E "update_binary(.*)" | cut -d " " -f 3);
- ui_print() {
- if [ $OUTFD != "" ]; then
- echo "ui_print ${1} " 1>&$OUTFD;
- echo "ui_print " 1>&$OUTFD;
- else
- echo "${1}";
- fi;
- }
- $BB mount /dev/block/stl10 /data;
- $BB mount /dev/block/mmcblk0p1 /sdcard;
- #exec > /sdcard/restore.log 2>&1
- ui_print "Checking MD5";
- cd $BU && $BB md5sum -c nandroid.md5 || ui_print "md5 Error" || exit;
- if [ -r $BU/boot.img ]; then
- ui_print "Flashing Boot Image";
- /sbin/flash_image boot $BU/boot.img;
- fi;
- if [ -r $BU/recovery.img ]; then
- ui_print "Flashing Recovery Image";
- /sbin/flash_image recovery $BU/recovery.img;
- fi;
- if [ -r $BU/system.img ]; then
- ui_print "Restoring System";
- $BB rm -Rf $SYS/*;
- cd $SYS;
- $UN $BU/system.img;
- fi;
- if [ -r $BU/data.img ]; then
- ui_print "Restoring User Data";
- $BB rm -Rf $DATA/*;
- cd $DATA;
- $UN $BU/data.img;
- fi;
- if [ -r $BU/cache.img ]; then
- ui_print "Restoring Cache";
- $BB rm -Rf $CHE/*;
- cd $CHE;
- $UN $BU/cache.img;
- fi;
- if [ -r $BU/.android_secure.img ]; then
- ui_print "Restoring .android_secure";
- $BB rm -Rf $ANDSEC/*;
- cd $ANDSEC;
- $UN $BU/.android_secure.img;
- fi;
- $BB test -d /data/dalvik-cache && ui_print "Clearing Dalvik-Cache" && $BB rm -rf /data/dalvik-cache;
- $BB test -d /cache/dalvik-cache && ui_print "Clearing Dalvik-Cache" && $BB rm -rf /cache/dalvik-cache;
- $BB test -d /data/tombstones/ && ui_print "Clearing Tombstones" && $BB rm -rf /data/tombstones/*;
- $BB test -d /data/lost+found && ui_print "Clearing Lost+Found" && $BB rm -rf /data/lost+found/*;
- ui_print "Fixing Permissions";
- /sbin/fix_permissions;
Advertisement
Add Comment
Please, Sign In to add comment