openconnect-9999.ebuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python2_7 )
  5. PYTHON_REQ_USE="xml"
  6. inherit eutils java-pkg-opt-2 linux-info python-any-r1 readme.gentoo-r1
  7. if [[ ${PV} == 9999 ]]; then
  8. EGIT_REPO_URI="git://git.infradead.org/users/dwmw2/${PN}.git"
  9. inherit git-r3 autotools
  10. else
  11. ARCHIVE_URI="ftp://ftp.infradead.org/pub/${PN}/${P}.tar.gz"
  12. KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
  13. fi
  14. VPNC_VER=20160829
  15. SRC_URI="${ARCHIVE_URI}
  16. ftp://ftp.infradead.org/pub/vpnc-scripts/vpnc-scripts-${VPNC_VER}.tar.gz"
  17. DESCRIPTION="Free client for Cisco AnyConnect SSL VPN software"
  18. HOMEPAGE="http://www.infradead.org/openconnect.html"
  19. LICENSE="LGPL-2.1 GPL-2"
  20. SLOT="0/5"
  21. IUSE="doc +gnutls gssapi java libproxy libressl lz4 nls smartcard static-libs stoken"
  22. DEPEND="
  23. dev-libs/libxml2
  24. sys-libs/zlib
  25. !gnutls? (
  26. !libressl? ( >=dev-libs/openssl-1.0.1h:0=[static-libs?] )
  27. libressl? ( dev-libs/libressl:0=[static-libs?] )
  28. )
  29. gnutls? (
  30. app-misc/ca-certificates
  31. dev-libs/nettle
  32. >=net-libs/gnutls-3:0=[static-libs?]
  33. )
  34. gssapi? ( virtual/krb5 )
  35. libproxy? ( net-libs/libproxy )
  36. lz4? ( app-arch/lz4:= )
  37. nls? ( virtual/libintl )
  38. smartcard? ( sys-apps/pcsc-lite:0= )
  39. stoken? ( app-crypt/stoken )"
  40. RDEPEND="${DEPEND}
  41. sys-apps/iproute2
  42. !<sys-apps/openrc-0.13"
  43. DEPEND="${DEPEND}
  44. virtual/pkgconfig
  45. doc? ( ${PYTHON_DEPS} sys-apps/groff )
  46. java? ( >=virtual/jdk-1.6 )
  47. nls? ( sys-devel/gettext )"
  48. CONFIG_CHECK="~TUN"
  49. pkg_pretend() {
  50. check_extra_config
  51. }
  52. pkg_setup() {
  53. java-pkg-opt-2_pkg_setup
  54. }
  55. src_unpack() {
  56. if [[ ${PV} == 9999 ]]; then
  57. git-r3_src_unpack
  58. fi
  59. default
  60. }
  61. src_prepare() {
  62. default
  63. if [[ ${PV} == 9999 ]]; then
  64. eautoreconf
  65. fi
  66. }
  67. src_configure() {
  68. if [[ ${LINGUAS+set} == set ]]; then
  69. strip-linguas -u po
  70. echo "${LINGUAS}" > po/LINGUAS || die
  71. fi
  72. if use doc; then
  73. python_setup
  74. else
  75. export PYTHON=/bin/false
  76. fi
  77. local myconf=(
  78. --with-vpnc-script="${EPREFIX}/etc/openconnect/openconnect.sh"
  79. --without-openssl-version-check
  80. $(use_enable static-libs static)
  81. $(use_enable nls)
  82. $(use_with !gnutls openssl)
  83. $(use_with gnutls)
  84. $(use_with libproxy)
  85. $(use_with lz4)
  86. $(use_with gssapi)
  87. $(use_with smartcard libpcsclite)
  88. $(use_with stoken)
  89. $(use_with java)
  90. )
  91. econf "${myconf[@]}"
  92. }
  93. DOC_CONTENTS="The init script for openconnect supports multiple vpn tunnels.
  94. You need to create a symbolic link to /etc/init.d/openconnect in /etc/init.d
  95. instead of calling it directly:
  96. ln -s /etc/init.d/openconnect /etc/init.d/openconnect.vpn0
  97. You can then start the vpn tunnel like this:
  98. /etc/init.d/openconnect.vpn0 start
  99. If you would like to run preup, postup, predown, and/or postdown scripts,
  100. You need to create a directory in /etc/openconnect with the name of the vpn:
  101. mkdir /etc/openconnect/vpn0
  102. Then add executable shell files:
  103. mkdir /etc/openconnect/vpn0
  104. cd /etc/openconnect/vpn0
  105. echo '#!/bin/sh' > preup.sh
  106. cp preup.sh predown.sh
  107. cp preup.sh postup.sh
  108. cp preup.sh postdown.sh
  109. chmod 755 /etc/openconnect/vpn0/*
  110. "
  111. src_install() {
  112. default
  113. newinitd "${FILESDIR}"/openconnect.init.in-r4 openconnect
  114. dodir /etc/openconnect
  115. insinto /etc/openconnect
  116. newconfd "${FILESDIR}"/openconnect.conf.in openconnect
  117. exeinto /etc/openconnect
  118. newexe "${WORKDIR}"/vpnc-scripts-${VPNC_VER}/vpnc-script openconnect.sh
  119. insinto /etc/logrotate.d
  120. newins "${FILESDIR}"/openconnect.logrotate openconnect
  121. keepdir /var/log/openconnect
  122. prune_libtool_files
  123. readme.gentoo_create_doc
  124. }
  125. pkg_postinst() {
  126. readme.gentoo_print_elog
  127. if [[ -z ${REPLACING_VERSIONS} ]]; then
  128. elog
  129. elog "You may want to consider installing the following optional packages."
  130. optfeature "resolvconf support" net-dns/openresolv
  131. fi
  132. }