package.py 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. #/usr/bin/python
  2. import os
  3. LOGFILE = "/var/log/stap-server/log"
  4. permissions = {
  5. "/usr/share/systemtap/runtime/uprobes" : ["0775", "root:stap-server"],
  6. LOGFILE : ["0664", "stap-server:stap-server"],
  7. }
  8. # TODO
  9. # If it does not already exist, as stap-server, generate the certificate
  10. # used for signing and for ssl.
  11. #if test ! -e ~stap-server/.systemtap/ssl/server/stap.cert; then
  12. # runuser -s /bin/sh - stap-server -c %{_libexecdir}/%{name}/stap-gen-cert >/dev/null
  13. # Authorize the certificate as a trusted ssl peer and as a trusted signer
  14. # on the local host.
  15. # %{_libexecdir}/%{name}/stap-authorize-cert ~stap-server/.systemtap/ssl/server/stap.cert %{_sysconfdir}/systemtap/ssl/client >/dev/null
  16. # %{_libexecdir}/%{name}/stap-authorize-cert ~stap-server/.systemtap/ssl/server/stap.cert %{_sysconfdir}/systemtap/staprun >/dev/null
  17. #fi
  18. def postInstall(fromVersion, fromRelease, toVersion, toRelease):
  19. if not os.path.exists(LOGFILE):
  20. open(LOGFILE, "w").write("")
  21. for _file, perms in permissions.items():
  22. # The list above is general, some paths may not exist depending on the configuration
  23. if os.path.exists(_file):
  24. os.system("/bin/chown -R %s %s" % (perms[1], _file))
  25. os.system("/bin/chmod %s %s" % (perms[0], _file))