fwmp-race-sa.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. # standalone FWMP remove racer
  3. {
  4. until tpm_manager_client take_ownership; do
  5. echo "failed to take ownership"
  6. sleep 0.5
  7. done
  8. {
  9. launch_racer(){
  10. echo launching racer at "$(date)"
  11. {
  12. while true; do
  13. cryptohome --action=remove_firmware_management_parameters >/dev/null 2>&1
  14. done
  15. } &
  16. RACERPID=$!
  17. }
  18. launch_racer
  19. while true; do
  20. echo "checking cryptohome status"
  21. if [ "$(cryptohome --action=is_mounted)" == "true" ]; then
  22. if ! [ -z $RACERPID ]; then
  23. echo "logged in, waiting to kill racer"
  24. sleep 60
  25. kill -9 $RACERPID
  26. echo "racer terminated at $(date)"
  27. RACERPID=
  28. fi
  29. else
  30. if [ -z $RACERPID ]; then
  31. launch_racer
  32. fi
  33. fi
  34. sleep 10
  35. done
  36. } &
  37. {
  38. while true; do
  39. vpd -i RW_VPD -s check_enrollment=0 >/dev/null 2>&1
  40. vpd -i RW_VPD -s block_devmode=0 >/dev/null 2>&1
  41. crossystem block_devmode=0 >/dev/null 2>&1
  42. sleep 60
  43. done
  44. } &
  45. } &