pull.py 646 B

12345678910111213141516171819202122232425262728293031323334
  1. import git
  2. import os
  3. from io import RawIOBase
  4. localrep = "/home"
  5. class NewStream(RawIOBase):
  6. """Fallback if stdout or stderr are unavailable, does nothing."""
  7. def read(self, size=-1):
  8. return None
  9. def readall(self):
  10. return None
  11. def readinto(self, b):
  12. return None
  13. def write(self, b):
  14. print(b)
  15. return None
  16. git.rw()
  17. steam = NewStream()
  18. if os.path.exists(localrep + "/cclb_launch"):
  19. os.remove(localrep + "/cclb_launch")
  20. git.pull(localrep, steam)
  21. if os.path.exists("/root/CocoPi.py"):
  22. os.remove("/root/CocoPi.py")
  23. os.system('chmod -R 777 /home')
  24. os.system('reboot')
  25. git.ro()