actions.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/copyleft/gpl.txt.
  6. #
  7. # Note that we fiddle with permissions of everything to make sure not to make a security hole
  8. #
  9. from pisi.actionsapi import autotools
  10. from pisi.actionsapi import pisitools
  11. from pisi.actionsapi import shelltools
  12. from pisi.actionsapi import libtools
  13. from pisi.actionsapi import get
  14. def setup():
  15. shelltools.export("SENDMAIL", "/usr/sbin/sendmail")
  16. shelltools.export("CFLAGS", "%s -DSKEY_HASH_DEFAULT=1" % get.CFLAGS())
  17. autotools.configure("--sysconfdir=/etc/skey")
  18. def build():
  19. autotools.make()
  20. def install():
  21. ### Runtime
  22. for i in ["skey", "skeyinit", "skeyinfo"]:
  23. pisitools.dobin(i)
  24. for i in ["otp-md4", "otp-sha1", "otp-md5"]:
  25. pisitools.dosym("skey", "/usr/bin/%s" % i)
  26. pisitools.insinto("/usr/sbin", "skeyprune.pl", "skeyprune")
  27. pisitools.insinto("/usr/bin", "skeyaudit.sh", "skeyaudit")
  28. # these must be suid root so users can generate their passwords, fperms u+s,og-r
  29. for i in ["skeyinit", "skeyinfo", "skeyaudit"]:
  30. shelltools.chmod("%s/usr/bin/%s" % (get.installDIR(), i), 4755)
  31. shelltools.chmod("%s/usr/bin/skey" % get.installDIR(), 0755)
  32. shelltools.chmod("%s/usr/sbin/skeyprune" % get.installDIR(), 0755)
  33. ### Developement
  34. pisitools.insinto("/usr/include", "skey.h")
  35. for i in ["libskey.so.1.1.5", "libskey.so.1", "libskey.so"]:
  36. # dolib borks with symlinks
  37. # pisitools.dolib(i, destinationDirectory="/lib")
  38. pisitools.insinto("/lib", i)
  39. shelltools.chmod("%s/lib/%s" % (get.installDIR(), i), 0755)
  40. #libtools.gen_usr_ldscript("libskey.so")
  41. pisitools.dosym("../../lib/libskey.so", "/usr/lib/libskey.so")
  42. ### Config
  43. # only root needs to have access to these files. fperms g-rx,o-rx /etc/skey
  44. pisitools.dodir("/etc/skey")
  45. shelltools.chmod("%s/etc/skey" % get.installDIR(), 0700)
  46. # skeyinit will not function if this file is not present. these permissions are applied by the skey system if missing.
  47. shelltools.touch("%s/etc/skey/skeykeys" % get.installDIR())
  48. shelltools.chmod("%s/etc/skey/skeykeys" % get.installDIR(), 0600)
  49. ### Docs
  50. for i in ["skey.1", "skeyaudit.1", "skeyinfo.1", "skeyinit.1", "skey.3", "skeyprune.8"]:
  51. pisitools.doman(i)
  52. pisitools.dodoc("CHANGES", "README")