package.py 663 B

1234567891011121314151617181920212223
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import re
  5. ownerships = {
  6. "/run/cups" : "root:lp",
  7. "/var/log/cups" : "root:lp",
  8. }
  9. CUPSD_CONFIG_FILE = "/etc/cups/cupsd.conf"
  10. def postInstall(fromVersion, fromRelease, toVersion, toRelease):
  11. for directory,owners in ownerships.items():
  12. if os.path.exists(directory):
  13. os.system("chown %s %s" % (owners, directory))
  14. # Replace possible pnpadmin leftover from cupsd.conf
  15. if os.path.exists(CUPSD_CONFIG_FILE):
  16. cupsd = open(CUPSD_CONFIG_FILE, "r").read()
  17. open(CUPSD_CONFIG_FILE, "w").write(re.sub("pnpadmin", "lpadmin", cupsd))