Skip to content

Instantly share code, notes, and snippets.

@basxto
Last active December 11, 2022 13:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save basxto/8b2476479eee05c3d68d67e6a7750bde to your computer and use it in GitHub Desktop.
Save basxto/8b2476479eee05c3d68d67e6a7750bde to your computer and use it in GitHub Desktop.
Root Fairphone 3
#!/bin/sh
FASTBOOT=fastboot
ADB=adb
MAGISK=v20.3
TWRP_RELEASE=20200202-02
TWRP=3.3.1-0_k4y0z-${TWRP_RELEASE}-fp3
mkdir -p /tmp/flash_fp3_${TWRP_RELEASE}
cd /tmp/flash_fp3_${TWRP_RELEASE}/
wget -nc https://github.com/chaosmaster/android_device_fairphone_fp3/releases/download/${TWRP_RELEASE}/twrp-${TWRP}.img
wget -nc https://github.com/chaosmaster/android_device_fairphone_fp3/releases/download/${TWRP_RELEASE}/twrp-installer-${TWRP}.zip
wget -nc https://github.com/topjohnwu/Magisk/releases/download/${MAGISK}/Magisk-${MAGISK}.zip
${ADB} reboot bootloader
product=$(${FASTBOOT} getvar product 2>&1 | grep -oE 'product:\s+FP3')
if [ $? -ne 0 ]; then
echo "This device is not a Fairphone 3!"
${FASTBOOT} continue
exit 1
fi
${FASTBOOT} boot ./twrp-${TWRP}.img
${ADB} wait-for-recovery && ${ADB} shell twrp sideload && ${ADB} wait-for-sideload && ${ADB} sideload twrp-installer-${TWRP}.zip
${ADB} wait-for-recovery && ${ADB} shell twrp sideload && ${ADB} wait-for-sideload && ${ADB} sideload Magisk-${MAGISK}.zip
echo "Flashed TWRP and Magisk"
echo "Rebooting to device..."
${ADB} wait-for-recovery && ${ADB} reboot
@ivoruetsche
Copy link

Great Script !!!
I just changed to line
MAGISK=v20.3
to
MAGISK=v21.2

Works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment