Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,804,353 Members 40,535 Now Online
XDA Developers Android and Mobile Development Forum

Problem restore script

Tip us?
 
TrueFriend-cz
Old
(Last edited by TrueFriend-cz; 7th May 2014 at 07:12 AM.)
#1  
Member - OP
Thanks Meter 28
Posts: 62
Join Date: Nov 2008
Default Problem restore script

Hi, have problem with restore script. This script is for init.d. First boot with restore app and app data. Have problem with restore app data. If run script for restore app data then restore only from one tar.gz file, no from all. Where problem? Thanks

App restore:
#!/system/bin/sh
su
mount -o remount,rw /system
mount -o remount,rw /data

for filename in /system/app2/*.apk;
do
busybox install $filename /data/app;
done

busybox rm -rf /system/app2
busybox rm -rf /system/etc/init.d/90app
App data restore:
#!/sbin/busybox sh
sleep 45

su
mount -o remount,rw /system
mount -o remount,rw /data

for filenamezip in /system/appdata/*.zip;
do
busybox chown -R root /data/data/${filenamezip%.zip}/*
busybox chmod -R 777 /data/data/${filenamezip%.zip}/*
busybox rm -rf /data/data/${filenamezip%.zip}
done

for izip in /system/appdata/*.zip;
do
busybox unzip -o $izip -d /;
done

for filenametar in /system/appdata/*.tar.gz;
do
busybox chown -R root /data/data/${filenametar%.tar.gz}/*
busybox chmod -R 777 /data/data/${filenametar%.tar.gz}/*
sleep 1
busybox rm -rf /data/data/${filenametar%.tar.gz}
done

for itar in /system/appdata/*.tar.gz;
do
busybox tar -xzf $itar -C /;
done

sleep 5

busybox rm -rf /system/appdata
busybox rm -rf /system/etc/init.d/95appdata

reboot

For manual backup:
su
mount -o remount,rw /system
mount -o remount,rw /data

BACKUPDIR=/system/appdata
DATADIR=/data/data

echo

# create BACKUPDIR if necessary and modify ownership/permissions

if [ -d $BACKUPDIR ]; then
rm -rf $BACKUPDIR
mkdir $BACKUPDIR
else
mkdir $BACKUPDIR
fi

chown root $BACKUPDIR
chmod 777 $BACKUPDIR

# make

for name in $DATADIR/*; do
tar -cpvzf $BACKUPDIR/${name#/data/data/}.tar.gz $name
done;

# modify ownership/permissions of all archives

chown root $BACKUPDIR/*
chmod 777 $BACKUPDIR/*

echo
Sorry my bad english
 
TrueFriend-cz
Old
#2  
Member - OP
Thanks Meter 28
Posts: 62
Join Date: Nov 2008
Any solution please?
 
TrueFriend-cz
Old
#3  
Member - OP
Thanks Meter 28
Posts: 62
Join Date: Nov 2008
Hi. Please help my with this problem.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes