echo "######################################"
echo "#   EternityProject's easyROOTICS    #"
echo "#         for Motorola RAZR          #"
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 "# pedrotorresf. - pedrofilho@msn.com #"
echo "#                                    #"
echo "#      or come on our Website!       #"
echo "#    http://www.eternityproject.eu   #"
echo "#                                    #"
echo "#          Happy Rooting!            #"
echo "######################################"
echo 
sleep 2
echo "Setting permissions..."
chmod 777 adb.osx

echo "----------------------------------------------"
echo "---   Please, connect your Motorola RAZR   ---"
echo "--- and make sure that ADB mode is enabled ---"
echo "---           prior continuing.            ---"
echo "----------------------------------------------"
echo

echo "[Step 1] Rooting..."

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

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

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

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

echo "Rebooting [2/3]..."
./adb.osx reboot
./adb.osx wait-for-device
./adb.osx shell sync

echo "[Step 3] Hello, system!"
echo 
echo 

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

echo "Rebooting [3/3]..."
./adb.osx reboot

sleep 5

echo "[Step 4] Finishing!"

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


echo "######################################"
echo "#   EternityProject's easyROOTICS    #"
echo "#         for Motorola RAZR          #"
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 "# pedrotorresf. - pedrofilho@msn.com #"
echo "#                                    #"
echo "#      or come on our Website!       #"
echo "#    http://www.eternityproject.eu   #"
echo "######################################"
echo 
echo 
sleep 7