daily pastebin goal
53%
SHARE
TWEET

mjh-lglaf-4

a guest Aug 19th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # another n00b script that roots the phone...
  3.  
  4. REPO=/home/mhooten/lglaf/h872
  5. cd $REPO
  6. PROMPT="Press x, X, or Ctrl-c to exit. Any other key to continue."
  7.  
  8. echo "Make sure your phone has full booted into TWRP."
  9. echo "Rooting your phone. It will reboot back into TWRP."
  10. echo "Don't do anything until your phone has booted back to the OS."
  11. echo
  12. echo "Unmounting /data and /sdcard"
  13. adb shell umount /data
  14. adb shell umount /sdcard
  15. echo
  16. echo "Did unmounting /data and /sdcard succeed?"
  17. read -s -n1 -r -p $PROMPT KEY
  18. echo
  19. if [[ $KEY =~ ^x|X$ ]]; then
  20.    echo "Exiting"
  21.    exit
  22. fi
  23.  
  24. echo "Formatting data"
  25. adb shell mkfs.ext2 /dev/block/bootdevice/by-name/userdata
  26. echo
  27. echo "Did formatting of /data succeed?"
  28. read -s -n1 -r -p $PROMPT KEY
  29. echo
  30. if [[ $KEY =~ ^x|X$ ]]; then
  31.    echo "Exiting"
  32.    exit
  33. fi
  34.  
  35. echo "Mounting data"
  36. adb shell mount /data
  37. echo
  38. echo "Was /data mounted successfully?"
  39. read -s -n1 -r -p $PROMPT KEY
  40. echo
  41. if [[ $KEY =~ ^x|X$ ]]; then
  42.    echo "Exiting"
  43.    exit
  44. fi
  45.  
  46. echo "Mounting system r/w"
  47. adb shell mount -o rw /system
  48. echo
  49. echo "Was /system successfully mounted read/write?"
  50. read -s -n1 -r -p $PROMPT KEY
  51. echo
  52. if [[ $KEY =~ ^x|X$ ]]; then
  53.    echo "Exiting"
  54.    exit
  55. fi
  56.  
  57. echo "Installing TWRP onto recovery"
  58. # adb push laf.img /sdcard/
  59. # adb shell dd if=/sdcard/laf.img of=/dev/block/bootdevice/by-name/laf
  60. # adb push misc.img /sdcard/
  61. # adb shell dd if=/sdcard/misc.img of=/dev/block/bootdevice/by-name/misc
  62. adb push h872-twrp.img /sdcard/
  63. adb shell dd if=/sdcard/h872-twrp.img of=/dev/block/bootdevice/by-name/recovery
  64. echo
  65. echo "Was TWRP successfully installed?"
  66. read -s -n1 -r -p $PROMPT KEY
  67. echo
  68. if [[ $KEY =~ ^x|X$ ]]; then
  69.    echo "Exiting"
  70.    exit
  71. fi
  72.  
  73. echo "Making sure recovery sticks"
  74. adb shell rm /system/recovery-from-boot.p
  75. adb shell rm /system/recovery-from-boot.bak
  76. echo
  77. echo "Was at least one recovery file deleted? Do NOT exit here."
  78. # read -s -n1 -r -p $PROMPT KEY
  79. echo
  80. # if [[ $KEY =~ ^x|X$ ]]; then
  81. #    echo "Exiting"
  82. #    exit
  83. # fi
  84.  
  85. echo "Rooting your phone! Copying Magisk-v16.0.zip to your phone."
  86. adb push Magisk-v16.0.zip /cache/recovery/
  87. adb pull /cache/recovery/command recovery.command
  88. adb shell echo ""--update_package=/cache/recovery/Magisk-v16.0.zip" > /cache/recovery/command"
  89. echo
  90. echo "Was Magisk v16.0 successfully installed?"
  91. read -s -n1 -r -p $PROMPT KEY
  92. echo
  93. if [[ $KEY =~ ^x|X$ ]]; then
  94.    echo "Exiting"
  95.    exit
  96. fi
  97.  
  98. echo "Rebooting. Do NOT shut off your phone until it is back in the OS."
  99. echo "Enjoy your rooted phone!"
  100. echo "You should really install Magisk Manager now."
  101. adb reboot recovery
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top