checkout.py 754 B

12345678910111213141516171819202122232425262728293031323334353637
  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. if git.activeBranch(localrep) != b'master':
  21. git.checkout(localrep, 'master', steam)
  22. else:
  23. git.checkout(localrep, 'en', steam)
  24. if os.path.exists("/root/CocoPi.py"):
  25. os.remove("/root/CocoPi.py")
  26. os.system('chmod -R 777 /home')
  27. os.system('reboot')
  28. git.ro()