Skip to content

Instantly share code, notes, and snippets.

@ivoruetsche
Forked from basxto/fp3root.sh
Last active December 11, 2022 13:53
Show Gist options
  • Save ivoruetsche/b8a8bf9a73faed1dd9f9ede3c0eac1a8 to your computer and use it in GitHub Desktop.
Save ivoruetsche/b8a8bf9a73faed1dd9f9ede3c0eac1a8 to your computer and use it in GitHub Desktop.
Root Fairphone 3
#!/bin/sh
# Latest
# https://magisk.me/zip/
FASTBOOT=fastboot
ADB=adb
MAGISK=v25-2
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment