summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 82666c3429a26620c4163bf42baae5db9202a777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Maintainer: lsf
# Maintainer: Adam Hose <adis@blad.is>
pkgver=20180913.350_e9c10b9
pkgrel=3
_pkgname=opensnitch
pkgname=opensnitch-git
arch=('i686' 'x86_64')
license=('GPL')
pkgdesc="A GNU/Linux port of the Little Snitch application firewall."
makedepends=('git' 'go-pie' 'dep'
             'python-setuptools' 'python-pip')
depends=('python-grpcio' 'python-grpcio-tools' 'python-pyinotify'
         'python-pyqt5' 'python-unicode-slugify'
         'libpcap' 'libnetfilter_queue'
         'desktop-file-utils')
provides=('opensnitch' 'opensnitch-ui')

source=("git://github.com/evilsocket/opensnitch.git"
        'nosudo.patch'
        'pwuid.patch')

md5sums=('SKIP'
         'eb5a6c83c3816220799e678e32572705'
         '03a48a1be821e80a64b7d392cc12db4b')

pkgver() {
        cd "$srcdir/$_pkgname"
        local date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
        local count=$(git rev-list --count HEAD)
        local commit=$(git rev-parse --short HEAD)
        echo "$date.${count}_$commit"
}

build() {
        cd "$srcdir/$_pkgname"

        if [ -L "$srcdir/$_pkgname" ]; then
                rm "$srcdir/$_pkgname" -rf
                mv "$srcdir/.go/src/$_pkgname/" "$srcdir/$_pkgname"
        fi

        rm -rf "$srcdir/.go/src"
        mkdir -p "$srcdir/.go/src"
        export GOPATH="$srcdir/.go"
        mv "$srcdir/$_pkgname" "$srcdir/.go/src/"

        cd "$srcdir/.go/src/$_pkgname/"
        ln -sf "$srcdir/.go/src/$_pkgname/" "$srcdir/$_pkgname"

        cd "$GOPATH/src/opensnitch/daemon"
        dep ensure
        cd "$GOPATH/src/opensnitch"
        patch -Np1 -i "${srcdir}/nosudo.patch"
        patch -Np1 -i "${srcdir}/pwuid.patch"
        make
}

package(){
        cd "$srcdir/.go/src/$_pkgname/"
        mkdir -p "${pkgdir}"/usr/lib/systemd/system
        mkdir -p "${pkgdir}"/usr/bin
        make DESTDIR="$pkgdir/" install
        cd ui
        pip install --isolated --root="$pkgdir" --ignore-installed --no-deps .
}