# $Id$
# Maintainer: Felix Yan <felixonmars@gmail.com>
# Contributor: alphazo <alphazo@gmail.com>

pkgname=sshuttle
pkgver=0.61
pkgrel=4
pkgdesc="Transparent proxy server that works as a poor man's VPN. Forwards all TCP packets over ssh (and even DNS requests when using --dns option). Doesn't require admin privileges on the server side"
arch=('any')
url="https://github.com/apenwarr/sshuttle"
license=('GPL2')
depends=('python2' 'iptables' 'openssh')
makedepends=('python2-markdown' 'python2-beautifulsoup3')
source=("https://github.com/apenwarr/$pkgname/archive/$pkgname-$pkgver.tar.gz"
        "arch-install.patch")

build() {
  cd "$srcdir/$pkgname-$pkgname-$pkgver"
  patch -p1 -i "$srcdir/arch-install.patch"

  sed -i 's#/usr/bin/env python#/usr/bin/env python2#' stresstest.py Documentation/md2man.py
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgname-$pkgver"
  install -Dm755 sshuttle "$pkgdir/usr/bin/sshuttle"

  install -d "$pkgdir/usr/share/sshuttle"
  cp -r *.py compat "$pkgdir/usr/share/sshuttle"/

  install -d "$pkgdir/usr/share/sshuttle/version"
  cp -r version/*.py "$pkgdir/usr/share/sshuttle/version"

  install -Dm644 Documentation/sshuttle.8 "$pkgdir/usr/share/man/man8/sshuttle.8"
}

md5sums=('99a3178524eb960189c89e63f85e5b43'
         '15ed72e2b68dd07ef97abfdcb828d188')
