bypass.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. diff --git a/anykernel.sh b/anykernel.sh
  2. index 35b6e59..e2bcb62 100755
  3. --- a/anykernel.sh
  4. +++ b/anykernel.sh
  5. @@ -45,6 +45,52 @@ esac
  6. ui_print " " " -> Wild Kernels Supported: $ksu_supported"
  7. $ksu_supported || abort " -> Non-GKI device, abort."
  8. +handle_input() {
  9. + while true; do
  10. + case $(getevent -lqc "/dev/input/event2" 2>/dev/null | grep -m1 'DOWN') in
  11. + *KEY_VOLUMEUP*) echo "normal"; return ;;
  12. + *KEY_VOLUMEDOWN*) echo "bypass"; return ;;
  13. + *KEY_POWER*) echo "cancel"; return ;;
  14. + esac
  15. + done
  16. +}
  17. +
  18. +choose_flash_mode() {
  19. + ui_print " "
  20. + ui_print " -> Most users do not need this; try Normal first"
  21. + ui_print " -> This does not help bypass root detection; it only swaps the Image for compatibility workarounds"
  22. + ui_print " -> Use it only when Normal fails to boot due to kernel module incompatibilities"
  23. + ui_print " "
  24. + ui_print " -> Choose Kernel Image:"
  25. + ui_print " -> VOL+ = Normal"
  26. + ui_print " -> VOL- = Bypass"
  27. + ui_print " -> POWER = Cancel"
  28. + ui_print " "
  29. +
  30. + while true; do
  31. + case $(handle_input) in
  32. + normal)
  33. + ui_print " -> Selected: Normal"
  34. + return 0
  35. + ;;
  36. + bypass)
  37. + ui_print " -> Selected: Bypass"
  38. + if [ -f "$AKHOME/Bypass-Image" ]; then
  39. + cp -f "$AKHOME/Bypass-Image" "$AKHOME/Image"
  40. + ui_print " -> Using Bypass-Image for this flash"
  41. + return 0
  42. + fi
  43. + abort " -> ERROR: Bypass-Image not found. Abort."
  44. + ;;
  45. + cancel)
  46. + abort " -> Cancelled by POWER button. Abort."
  47. + ;;
  48. + esac
  49. + done
  50. +}
  51. +
  52. +choose_flash_mode
  53. +
  54. # boot install
  55. split_boot