package.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #/usr/bin/python
  2. import os
  3. permissions = {
  4. "/etc/libvirt" : ["0700", "root:root"],
  5. "/etc/libvirt/qemu" : ["0700", "root:root"],
  6. "/etc/libvirt/nwfilter" : ["0700", "root:root"],
  7. "/etc/libvirt/qemu/networks" : ["0700", "root:root"],
  8. "/etc/libvirt/qemu/networks/autostart" : ["0700", "root:root"],
  9. "/var/log/libvirt" : ["0700", "root:root"],
  10. "/var/log/libvirt/qemu" : ["0700", "root:root"],
  11. "/var/log/libvirt/lxc" : ["0700", "root:root"],
  12. "/var/log/libvirt/uml" : ["0700", "root:root"],
  13. "/var/lib/libvirt" : ["0755", "root:root"],
  14. "/var/lib/libvirt/images" : ["0711", "root:root"],
  15. "/var/lib/libvirt/boot" : ["0711", "root:root"],
  16. "/var/lib/libvirt/qemu" : ["0750", "qemu:qemu"],
  17. "/var/lib/libvirt/lxc" : ["0700", "root:root"],
  18. "/var/lib/libvirt/uml" : ["0700", "root:root"],
  19. "/var/lib/libvirt/network" : ["0700", "root:root"],
  20. "/var/lib/libvirt/dnsmasq" : ["0755", "root:root"],
  21. "/var/cache/libvirt/qemu" : ["0750", "qemu:qemu"],
  22. "/var/cache/libvirt" : ["0700", "root:root"],
  23. "/run/libvirt" : ["0755", "root:root"],
  24. "/run/libvirt/qemu" : ["0700", "qemu:qemu"],
  25. "/run/libvirt/uml" : ["0700", "root:root"],
  26. "/usr/libexec/libvirt_proxy" : ["4755", "root:root"],
  27. }
  28. def postInstall(fromVersion, fromRelease, toVersion, toRelease):
  29. for _file, perms in permissions.items():
  30. # The list above is general, some paths may not exist depending on the configuration
  31. if os.path.exists(_file):
  32. os.system("/bin/chown -R %s %s" % (perms[1], _file))
  33. os.system("/bin/chmod %s %s" % (perms[0], _file))
  34. os.system("groupadd libvirt")
  35. os.system("usermod -G libvirt %s" % os.getusername())