Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Problem restore script

OP TrueFriend-cz

7th May 2014, 07:57 AM   |  #1  
OP Senior Member
Thanks Meter: 34
 
113 posts
Join Date:Joined: Nov 2008
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
Last edited by TrueFriend-cz; 7th May 2014 at 08:12 AM.
12th May 2014, 05:48 PM   |  #2  
OP Senior Member
Thanks Meter: 34
 
113 posts
Join Date:Joined: Nov 2008
Any solution please?
8th June 2014, 11:33 AM   |  #3  
OP Senior Member
Thanks Meter: 34
 
113 posts
Join Date:Joined: Nov 2008
Clock
Hi. Please help my with this problem.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes