#!/system/bin/sh
echo .
echo .
echo Remounting System partition to disable automatic recovery flashing 
su -c /system/bin/mount -o rw,remount -t ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP
su -c /system/bin/mv /system/recovery-from-boot.p /system/recovery-from-boot.bak
echo .
echo .
echo Backing up stock recovery
su -c /system/bin/dd if=/dev/block/platform/sdhci-tegra.3/by-name/SOS of=/data/media/OuyaPreviousRecovery.img
su -c /system/bin/sync
echo .
echo .
echo Writing new CWM recovery
su -c /system/bin/dd if=/data/media/recovery.img of=/dev/block/platform/sdhci-tegra.3/by-name/SOS
su -c /system/bin/sync
