Skip to content

Instantly share code, notes, and snippets.

@rock3r
Created June 4, 2015 13:42
Show Gist options
  • Save rock3r/1e1f3d7e6ab1de22f0fc to your computer and use it in GitHub Desktop.
Save rock3r/1e1f3d7e6ab1de22f0fc to your computer and use it in GitHub Desktop.
Root script for Asus Zenfone 2 for *NIX
#! /bin/bash
# How to use: save this in the folder where you extract the contents of this zip:
# http://click.xda-developers.com/api/click?format=go&jsonp=vglnk_14334252799608&key=f0a7f91912ae2b52e0700f73990eb321&libId=iai8ebh401000n4o000DAb9a6aa9o&loc=http%3A%2F%2Fforum.xda-developers.com%2Fzenfone2%2Fgeneral%2Fasus-zenfone-2-flashing-recovery-mode-t3096596&v=1&out=http%3A%2F%2Fwww.mediafire.com%2Fdownload%2Fv6m7n9j0gqins9b%2FCWM_Zenfone_2_Intel.zip&ref=http%3A%2F%2Fforum.xda-developers.com%2Fzenfone2%2Fgeneral&title=Asus%20Zenfone%202%20%7C%20Resources%20all%20in%20one%20thread%20%7C%20Asus%20ZenFone%202%20%7C%20XDA%20Forums&txt=%3Cb%3EDownload%20the%20Asus%20Zenfone%20temporary%20CWM%20package%3C%2Fb%3E
# Then chmod a+x it, and run it. Have your phone attached to the USB port with USB debugging enabled before starting.
# Setup
WORKINGDIR=$(pwd)
LAUNCHER="$WORKINGDIR/FB_RecoveryLauncher/recovery.launcher"
RECOVERY="$WORKINGDIR/FB_RecoveryLauncher/recovery.zip"
OEMTRIGGER="/system/bin/logcat"
OEMCMD="stop_partitioning"
TRIGGER="$WORKINGDIR/FB_RecoveryLauncher/recovery.trigger.new"
SUPERSU="$WORKINGDIR/SuperSU246.zip"
#echo "Working directory: $WORKINGDIR"
#echo "Launcher: $LAUNCHER"
#echo "Recovery: $RECOVERY"
#echo "Trigger: $TRIGGER"
# Push the SuperSU package on the device
adb wait-for-device
adb push "$SUPERSU" /sdcard/SuperSU.zip
# Reboot into fastboot
adb reboot-bootloader
# Getvars (wait for device to get online in fastboot mode)
fastboot getvar all
# Copy files to the device
fastboot flash /tmp/recovery.zip "$RECOVERY"
fastboot flash /tmp/recovery.launcher "$LAUNCHER"
# Stop logcat before replacing it
fastboot oem start_partitioning
# Replace logcat binary
fastboot flash $OEMTRIGGER "$TRIGGER"
# Issue command to start CWM recovery
fastboot oem $OEMCMD
echo "Almost there! Disconnect and reconnect the device to start up CWM."
echo "Note that you will see some random stuff on screen for some time,"
echo "don't panic, it's normal. Also don't disconnect the device after"
echo "CWM has started, or you'll have to repeat the procedure from scratch."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment