reset.py 800 B

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