# $Id: PKGBUILD 128385 2015-02-27 15:49:10Z fyan $
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: alphazo <alphazo@gmail.com>

pkgname=sshuttle
pkgver=0.61
pkgrel=6
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' 'net-tools')
makedepends=('python2-markdown' 'python2-beautifulsoup3' 'git')
source=("git+https://github.com/apenwarr/$pkgname.git#tag=$pkgname-$pkgver"
        "arch-install.patch")
md5sums=('SKIP'
         '15ed72e2b68dd07ef97abfdcb828d188')

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

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

build() {
  cd $pkgname
  make
}

package() {
  cd $pkgname
  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"
}
