timebomb.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. # startup_plugin
  3. PLUGIN_NAME="Auto-Revert Timebomb"
  4. PLUGIN_FUNCTION="None"
  5. PLUGIN_DESCRIPTION="Automatically reverts your Chromebook if the date is past a set time. Make sure to change the hardcoded date in the code after installing the plugin!"
  6. PLUGIN_AUTHOR="rainestorme"
  7. PLUGIN_VERSION=1
  8. doas() {
  9. ssh -t -p 1337 -i /rootkey -oStrictHostKeyChecking=no root@127.0.0.1 "$@"
  10. }
  11. echo "Checking timebomb status..."
  12. if [ ! -f /mnt/stateful_partition/murkmod/timebomb ]; then
  13. echo "Setting timebomb for one year..."
  14. doas "touch /mnt/stateful_partition/murkmod/timebomb"
  15. doas "date +%Y-%m-%d --date='next year' > /mnt/stateful_partition/murkmod/timebomb" # >>> Change this date after installing the plugin!
  16. fi
  17. today=$(date +%Y-%m-%d)
  18. enddate=$(cat /mnt/stateful_partition/murkmod/timebomb)
  19. if [[ "$today" > "$enddate" ]]; then
  20. if [ ! -f /no-timebomb ]; then
  21. echo "!!! TIMEBOMB ACTIVE !!!"
  22. echo "Setting kernel priority..."
  23. DST=/dev/$(get_largest_nvme_namespace)
  24. if doas "((\$(cgpt show -n \"$DST\" -i 2 -P) > \$(cgpt show -n \"$DST\" -i 4 -P)))"; then
  25. cgpt add "$DST" -i 2 -P 0
  26. cgpt add "$DST" -i 4 -P 1
  27. else
  28. cgpt add "$DST" -i 4 -P 0
  29. cgpt add "$DST" -i 2 -P 1
  30. fi
  31. echo "Setting vpd..."
  32. vpd -i RW_VPD -s check_enrollment=1
  33. vpd -i RW_VPD -s block_devmode=1
  34. crossystem.old block_devmode=1
  35. echo "Setting stateful unfuck flag..."
  36. rm -f /stateful_unfucked
  37. echo "Bye!"
  38. reboot
  39. fi
  40. fi