fakemurk-daemon.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. {
  3. until tpm_manager_client take_ownership; do
  4. echo "failed to take ownership"
  5. sleep 0.5
  6. done
  7. {
  8. launch_racer(){
  9. echo launching racer at "$(date)"
  10. {
  11. while true; do
  12. cryptohome --action=remove_firmware_management_parameters >/dev/null 2>&1
  13. done
  14. } &
  15. RACERPID=$!
  16. }
  17. launch_racer
  18. while true; do
  19. echo "checking cryptohome status"
  20. if [ "$(cryptohome --action=is_mounted)" == "true" ]; then
  21. if ! [ -z $RACERPID ]; then
  22. echo "logged in, waiting to kill racer"
  23. sleep 60
  24. kill -9 $RACERPID
  25. echo "racer terminated at $(date)"
  26. RACERPID=
  27. fi
  28. else
  29. if [ -z $RACERPID ]; then
  30. launch_racer
  31. fi
  32. fi
  33. sleep 10
  34. done
  35. } &
  36. {
  37. while true; do
  38. vpd -i RW_VPD -s check_enrollment=0 >/dev/null 2>&1
  39. vpd -i RW_VPD -s block_devmode=0 >/dev/null 2>&1
  40. crossystem.old block_devmode=0 >/dev/null 2>&1
  41. sleep 60
  42. done
  43. } &
  44. } &
  45. {
  46. while true; do
  47. if test -d "/home/chronos/user/Downloads/disable-extensions"; then
  48. kill -9 $(pgrep -f "\-\-extension\-process") 2>/dev/null
  49. sleep 0.5
  50. else
  51. sleep 5
  52. fi
  53. done
  54. } &
  55. {
  56. while true; do
  57. if ! [ -f /mnt/stateful_partition/fakemurk_version ]; then
  58. echo -n "CURRENT_VERSION=14" >/mnt/stateful_partition/fakemurk_version
  59. fi
  60. . /mnt/stateful_partition/fakemurk_version
  61. . <(curl https://raw.githubusercontent.com/MercuryWorkshop/fakemurk/main/autoupdate.sh)
  62. if ((UPDATE_VERSION > CURRENT_VERSION)); then
  63. echo -n "CURRENT_VERSION=$UPDATE_VERSION" >/mnt/stateful_partition/fakemurk_version
  64. autoupdate
  65. fi
  66. sleep 20m
  67. done
  68. } &