You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 line
631B

  1. from modules import cbpi
  2. import os
  3. def chown_unroot(path):
  4. """
  5. Changes owner of the path recursively from root:root to the user:group who installed craftbeerpi
  6. can be used to unroot plugins and craftbeerpi updates
  7. """
  8. dir_stat = os.stat('.')
  9. uid = dir_stat.st_uid
  10. gid = dir_stat.st_gid
  11. cbpi.app.logger.info("Executing chown -R for: " + path)
  12. for root, dirs, files in os.walk(path):
  13. os.chown(root, uid, gid)
  14. for name in dirs:
  15. os.chown(os.path.join(root, name), uid, gid)
  16. for name in files:
  17. os.chown(os.path.join(root, name), uid, gid)