bypass.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. diff --git a/anykernel.sh b/anykernel.sh
  2. index 719de4c..3f71202 100755
  3. --- a/anykernel.sh
  4. +++ b/anykernel.sh
  5. @@ -46,6 +46,64 @@ esac
  6. ui_print " -> Wild Kernels Supported: $ksu_supported"
  7. $ksu_supported || abort " -> Non-GKI device, abort."
  8. +
  9. +choose_flash_mode() {
  10. + ui_print " "
  11. + ui_print " -> Have a clean backup of your boot.img before proceeding!"
  12. + ui_print " -> Most users do not need Bypass; try Normal first!"
  13. + ui_print " -> Bypass only swaps the Image for compatibility workarounds!"
  14. + ui_print " -> Bypass does NOT help with hiding root."
  15. + ui_print " "
  16. + sleep 5
  17. + ui_print "-------------------------"
  18. + ui_print " "
  19. + ui_print " -> VOL + = Bypass"
  20. + ui_print " "
  21. + ui_print " -> VOL - = Normal"
  22. + ui_print " "
  23. + ui_print " -> Power = Cancel"
  24. + ui_print " "
  25. + ui_print "-------------------------"
  26. + raw_events="/tmp/ak3_raw_events"
  27. + events="/tmp/ak3_events"
  28. + : > "$raw_events"
  29. + : > "$events"
  30. + getevent -lc 1 2>&1 > "$raw_events" &
  31. + pid=$!
  32. + sleep 20
  33. + kill -0 $pid 2>/dev/null && kill $pid 2>/dev/null
  34. + grep VOLUME "$raw_events" | grep " DOWN" > "$events" 2>/dev/null || true
  35. +
  36. + if grep -q "VOLUMEUP" "$events" 2>/dev/null; then
  37. + ui_print " -> Selected: Bypass"
  38. + if [ -f "$AKHOME/Bypass-Image" ]; then
  39. + cp -f "$AKHOME/Bypass-Image" "$AKHOME/Image" || abort " -> ERROR: Failed to copy Bypass-Image. Abort."
  40. + ui_print " "
  41. + ui_print " -> Selected Bypass"
  42. + ui_print " "
  43. + return 0
  44. + else
  45. + abort " -> ERROR: Bypass-Image not found. Abort."
  46. + fi
  47. + elif grep -q "VOLUMEDOWN" "$events" 2>/dev/null; then
  48. + if [ -f "$AKHOME/Image" ]; then
  49. + ui_print " "
  50. + ui_print " -> Selected: Normal"
  51. + ui_print " "
  52. + return 0
  53. + else
  54. + abort " -> ERROR: Image not found. Abort."
  55. + fi
  56. + elif grep -q "POWER" "$raw_events" 2>/dev/null; then
  57. + abort " -> Cancelled by Power button. Abort."
  58. + else
  59. + abort " -> No input detected. Abort."
  60. + fi
  61. +}
  62. +
  63. +# Ask user which mode to use
  64. +choose_flash_mode
  65. +
  66. ui_print " -> Flashing Now... "
  67. # boot install
  68. @@ -77,3 +135,8 @@ ui_print "Samsung_KernelSU_SUSFS GitHub Repository:"
  69. ui_print "https://github.com/WildKernels/Samsung_KernelSU_SUSFS"
  70. ui_print "Samsung kernels with KernelSU and SUSFS."
  71. ui_print " "
  72. +ui_print " "
  73. +ui_print " "
  74. +ui_print "Thanks for using Wild Kernels!"
  75. +ui_print "Please consider donating if you want to support development!"
  76. +ui_print "Have a great day! - TheWildJames"