actions.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/licenses/gpl.txt
  6. from pisi.actionsapi import autotools
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import get
  10. #WorkDir = "openssh-%s" % get.srcVERSION().replace("_","")
  11. def setup():
  12. shelltools.export("CFLAGS","%s -fpie" % get.CFLAGS())
  13. shelltools.export("LDFLAGS","%s -pie" % get.LDFLAGS())
  14. #pisitools.dosed("pathnames.h", "/usr/X11R6/bin/xauth", r"/usr/bin/xauth")
  15. pisitools.dosed("sshd_config", "(?m)^(^#UsePAM ).*", r"UsePAM yes")
  16. pisitools.dosed("sshd_config", "(?m)^(^#PasswordAuthentication ).*", r"PasswordAuthentication no")
  17. pisitools.dosed("sshd_config", "(?m)^(^#X11Forwarding ).*", r"X11Forwarding yes")
  18. pisitools.dosed("sshd_config", "(?m)^(^#UseDNS ).*", r"UseDNS no")
  19. pisitools.dosed("sshd_config", "(?m)^(^#PermitRootLogin ).*", r"PermitRootLogin no")
  20. autotools.autoreconf("-fi")
  21. # Kerberos support is a must, libedit is optional
  22. # Update configure parameters when both are ready
  23. autotools.configure("--prefix=/usr \
  24. --sysconfdir=/etc/ssh \
  25. --datadir=/usr/share/sshd \
  26. --with-pam \
  27. --with-libedit \
  28. --with-kerberos5 \
  29. --with-md5-passwords \
  30. --with-ipaddr-display \
  31. --with-privsep-user=sshd \
  32. --with-privsep-path=/var/empty \
  33. --with-default-path=/usr/bin \
  34. --without-zlib-version-check \
  35. --with-superuser-path=/sbin:/bin:/usr/sbin:/usr/bin \
  36. --with-pid-dir=/run")
  37. def build():
  38. autotools.make()
  39. def install():
  40. autotools.rawInstall("DESTDIR=%s" % get.installDIR())
  41. # PAM configuration
  42. pisitools.dodir("/etc/pam.d")
  43. shelltools.system("sed 's@d/login@d/sshd@g' /etc/pam.d/login > " + get.installDIR() + "/etc/pam.d/sshd")
  44. shelltools.system("chmod 644 " + get.installDIR() + "/etc/pam.d/sshd")
  45. # fixes #10992
  46. pisitools.dobin("contrib/ssh-copy-id")
  47. pisitools.doman("contrib/ssh-copy-id.1")
  48. # an script in contrib
  49. pisitools.dobin("contrib/findssl.sh")
  50. shelltools.chmod("%s/etc/ssh/sshd_config" % get.installDIR(), 0600)
  51. # special request by merensan
  52. shelltools.echo("%s/etc/ssh/ssh_config" % get.installDIR(), "ServerAliveInterval 5")
  53. pisitools.dodoc("ChangeLog", "CREDITS", "OVERVIEW", "README*", "TODO", "sshd_config")