reset.py 794 B

1234567891011121314151617181920212223
  1. localrep = "/home"
  2. from maix import camera, display, image
  3. image.load_freetype("/root/preset/fonts/simhei.ttf")
  4. hello_img = image.new(size=(320, 240), color=(0, 0, 0), mode="RGB")
  5. hello_img.draw_string(10, 115, 'Reset', scale=1.0, color=(255, 255, 255), thickness=1)
  6. display.show(hello_img)
  7. import os, git
  8. if os.path.exists(localrep + "/cclb_launch"):
  9. os.remove(localrep + "/cclb_launch")
  10. git.rw()
  11. git.reset(localrep)
  12. hello_img = image.new(size=(320, 240), color=(0, 0, 0), mode="RGB")
  13. hello_img.draw_string(10, 115, 'Reconstruct directory', scale=1.0, color=(255, 255, 255), thickness=1)
  14. display.show(hello_img)
  15. os.system('chmod -R 777 /home')
  16. os.system('rsync -r --checksum /home/backup/ /root')
  17. os.system("ps | grep main.py | grep -v grep | awk '{print $1}' | xargs kill")
  18. git.ro()