generate fstab using mkfstab.sh. implement restore of system data and cache in nandroid
This commit is contained in:
parent
1a7ee5384d
commit
466e67a582
33
nandroid/mkfstab.sh
Executable file
33
nandroid/mkfstab.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/sbin/sh
|
||||
|
||||
cat /proc/mtd | while read mtdentry
|
||||
do
|
||||
mtd=$(echo $mtdentry | awk '{print $1}')
|
||||
mtd=$(echo $mtd | sed s/mtd//)
|
||||
mtd=$(echo $mtd | sed s/://)
|
||||
exist=$(ls -l /dev/block/mtdblock$mtd) 2> /dev/null
|
||||
if [ -z "$exist" ]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
partition=$(echo $mtdentry | awk '{print $4}')
|
||||
partition=$(echo $partition | sed s/\"//g)
|
||||
mount=$partition
|
||||
type=
|
||||
if [ "$partition" = "system" ]
|
||||
then
|
||||
type=yaffs2
|
||||
elif [ "$partition" = "userdata" ]
|
||||
then
|
||||
type=yaffs2
|
||||
mount=data
|
||||
elif [ "$partition" == "cache" ]
|
||||
then
|
||||
type=yaffs2
|
||||
else
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "/dev/block/mtdblock$mtd /$mount $type rw"
|
||||
done
|
||||
echo "/dev/block/mmcblk0p1" /sdcard vfat rw
|
@ -94,6 +94,11 @@ case $1 in
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
unyaffs=`which unyaffs`
|
||||
if [ "$unyaffs" == "" ]; then
|
||||
echo "error: unyaffs not found in path"
|
||||
exit 1
|
||||
fi
|
||||
break
|
||||
;;
|
||||
esac
|
||||
@ -133,17 +138,15 @@ case $1 in
|
||||
echo "error: $RESTOREPATH/nandroid.md5 not found, cannot verify backup data"
|
||||
exit 1
|
||||
fi
|
||||
umount /system 2>/dev/null
|
||||
umount /data 2>/dev/null
|
||||
if [ ! "`mount | grep data`" == "" ]; then
|
||||
echo "error: unable to umount /data, aborting"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! "`mount | grep system`" == "" ]; then
|
||||
echo "error: unable to umount /system, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
umount /system 2>/dev/null
|
||||
umount /data 2>/dev/null
|
||||
mount -o rw /system || FAIL=1
|
||||
mount -o rw /data || FAIL=2
|
||||
case $FAIL in
|
||||
1) echo "Error mounting system read-write"; umount /system /data /cache; exit 1;;
|
||||
2) echo "Error mounting data read-write"; umount /system /data /cache; exit 1;;
|
||||
esac
|
||||
|
||||
echo "Verifying backup images..."
|
||||
CWD=$PWD
|
||||
cd $RESTOREPATH
|
||||
@ -156,8 +159,18 @@ case $1 in
|
||||
echo "Flashing $image..."
|
||||
$flash_image $image $image.img
|
||||
done
|
||||
echo "Flashing system and data not currently supported"
|
||||
echo "Restore done"
|
||||
curdir=$(pwd)
|
||||
for image in system data cache; do
|
||||
echo "Unpacking $image..."
|
||||
cd /$image
|
||||
rm -rf *
|
||||
unyaffs $curdir/$image.img
|
||||
cd $curdir
|
||||
done
|
||||
sync
|
||||
umount /system
|
||||
umount /data
|
||||
echo "Restore done"
|
||||
exit 0
|
||||
;;
|
||||
backup)
|
||||
|
Loading…
Reference in New Issue
Block a user