updater.py 877 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. from setux.logger import silent
  2. from setux.core.action import Action
  3. class Updater(Action):
  4. @property
  5. def label(self):
  6. return f'upd {self.path}'
  7. def check(self):
  8. cont = self.target.read(
  9. self.path,
  10. sudo = self.sudo,
  11. report = 'quiet',
  12. )
  13. return self.line in cont
  14. def deploy(self):
  15. self.target.deploy('upd_cfg',
  16. path = self.path,
  17. line = self.line,
  18. select = self.select,
  19. user = self.user,
  20. group = self.group,
  21. mode = self.mode,
  22. sudo = self.sudo,
  23. )
  24. self.target.file(
  25. self.path,
  26. user = self.user,
  27. group = self.group,
  28. mode = self.mode,
  29. sudo = self.sudo,
  30. verbose = False,
  31. )
  32. return True