Browse Source

更新 'backup/preset/app/reset.py'

junhuanchen 1 year ago
parent
commit
dfdead54b3
1 changed files with 24 additions and 18 deletions
  1. 24 18
      backup/preset/app/reset.py

+ 24 - 18
backup/preset/app/reset.py

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