diff options
-rw-r--r-- | .SRCINFO | 56 | ||||
-rw-r--r-- | PKGBUILD | 94 | ||||
-rw-r--r-- | nosudo.patch | 51 | ||||
-rw-r--r-- | pwuid.patch | 13 |
4 files changed, 173 insertions, 41 deletions
@@ -1,26 +1,42 @@ pkgbase = opensnitch-git - pkgdesc = OpenSnitch is a GNU/Linux port of the Little Snitch application firewall. - pkgver = r168.28e5395 + pkgver = 20180913.350_e9c10b9 pkgrel = 1 - url = https://github.com/evilsocket/opensnitch - arch = any - license = GPL3 + arch = i686 + arch = x86_64 + license = GPL makedepends = git + makedepends = go-pie + makedepends = dep + makedepends = libpcap + makedepends = protobuf + makedepends = libnetfilter_queue + makedepends = protobuf-go makedepends = python-setuptools - depends = python - depends = python-pyqt5 - depends = python-netfilterqueue-git - depends = python-dpkt - depends = scapy3k - depends = python-psutil - depends = python-pyinotify - depends = python-iptables-git - depends = python-prctl - depends = python-gobject - provides = opensnitch - conflicts = opensnitch - source = opensnitch-git::git+https://github.com/evilsocket/opensnitch.git - sha256sums = SKIP + makedepends = python-pip + makedepends = python-grpcio + makedepends = python-grpcio-tools + makedepends = python-pyinotify + makedepends = python-pyqt5 + makedepends = python-unicode-slugify + source = opensnitch::git://github.com/evilsocket/opensnitch#branch=master + source = nosudo.patch + source = pwuid.patch + md5sums = SKIP + md5sums = eb5a6c83c3816220799e678e32572705 + md5sums = 03a48a1be821e80a64b7d392cc12db4b + +pkgname = opensnitchd-git + pkgdesc = A GNU/Linux port of the Little Snitch application firewall. + depends = libnetfilter_queue + optdepends = opensnitch-ui -pkgname = opensnitch-git +pkgname = opensnitch-ui-git + pkgdesc = UI for opensnitch. + depends = python-grpcio + depends = python-grpcio-tools + depends = python-pyinotify + depends = python-pyqt5 + depends = python-unicode-slugify + depends = opensnitchd + depends = desktop-file-utils @@ -1,31 +1,83 @@ +# Maintainer: lsf # Maintainer: Adam Hose <adis@blad.is> - -pkgbase=opensnitch-git -pkgname=(opensnitch-git) -pkgver=r168.28e5395 +pkgver=20180913.350_e9c10b9 pkgrel=1 -pkgdesc="OpenSnitch is a GNU/Linux port of the Little Snitch application firewall." -arch=(any) -url=https://github.com/evilsocket/${pkgname%-git} -license=(GPL3) -depends=(python python-pyqt5 python-netfilterqueue-git python-dpkt scapy3k python-psutil python-pyinotify python-iptables-git python-prctl python-gobject) -makedepends=(git python-setuptools) -provides=(${pkgname%-git}) -conflicts=(${pkgname%-git}) -source=($pkgname::git+https://github.com/evilsocket/${pkgname%-git}.git) -sha256sums=('SKIP') +pkgbase=opensnitch-git +_pkgbase=opensnitch +pkgname=("${_pkgbase}d-git" "${_pkgbase}-ui-git") +arch=('i686' 'x86_64') +license=('GPL') +makedepends=('git' 'go-pie' 'dep' 'libpcap' 'protobuf' + 'libnetfilter_queue' 'protobuf-go' + 'python-setuptools' 'python-pip' + 'python-grpcio' 'python-grpcio-tools' + 'python-pyinotify' 'python-pyqt5' + 'python-unicode-slugify') + +source=("opensnitch::git://github.com/evilsocket/opensnitch#branch=${BRANCH:-master}" + 'nosudo.patch' + 'pwuid.patch') + +md5sums=('SKIP' + 'eb5a6c83c3816220799e678e32572705' + '03a48a1be821e80a64b7d392cc12db4b') pkgver() { - cd $pkgname - printf "r%s.%s" $(git rev-list --count HEAD) $(git rev-parse --short HEAD) + if [[ "$PKGVER" ]]; then + echo "$PKGVER" + return + fi + + cd "$srcdir/$_pkgbase" + 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 $pkgname - python setup.py build + cd "$srcdir/$_pkgbase" + + if [ -L "$srcdir/$_pkgbase" ]; then + rm "$srcdir/$_pkgbase" -rf + mv "$srcdir/.go/src/$_pkgbase/" "$srcdir/$_pkgbase" + fi + + rm -rf "$srcdir/.go/src" + mkdir -p "$srcdir/.go/src" + export GOPATH="$srcdir/.go" + mv "$srcdir/$_pkgbase" "$srcdir/.go/src/" + + cd "$srcdir/.go/src/$_pkgbase/" + ln -sf "$srcdir/.go/src/$_pkgbase/" "$srcdir/$_pkgbase" + + 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 $pkgname - python setup.py install --root="$pkgdir" --optimize=1 +package_opensnitchd-git() { + pkgdesc="A GNU/Linux port of the Little Snitch application firewall." + optdepends=('opensnitch-ui') + depends=('libnetfilter_queue') + + export GOPATH="$srcdir/.go" + cd "$GOPATH/src/opensnitch" + mkdir -p "${pkgdir}"/usr/lib/systemd/system + mkdir -p "${pkgdir}"/usr/bin + make DESTDIR="$pkgdir/" install +} + +package_opensnitch-ui-git() { + pkgdesc="UI for opensnitch." + depends=('python-grpcio' 'python-grpcio-tools' 'python-pyinotify' + 'python-pyqt5' 'python-unicode-slugify' 'opensnitchd' + 'desktop-file-utils') + + export GOPATH="$srcdir/.go" + cd "$GOPATH/src/opensnitch/ui" + pip install --isolated --root="$pkgdir" --ignore-installed --no-deps . } diff --git a/nosudo.patch b/nosudo.patch new file mode 100644 index 000000000000..14ccabd69dc7 --- /dev/null +++ b/nosudo.patch @@ -0,0 +1,51 @@ +diff --git a/daemon/Makefile b/daemon/Makefile +index ece2090..2d364f8 100644 +--- a/daemon/Makefile ++++ b/daemon/Makefile +@@ -1,10 +1,9 @@ + all: opensnitchd + + install: +- @mkdir -p /etc/opensnitchd/rules +- @cp opensnitchd /usr/local/bin/ +- @cp opensnitchd.service /etc/systemd/system/ +- @systemctl daemon-reload ++ @mkdir -p $(DESTDIR)/etc/opensnitchd/rules ++ @cp opensnitchd $(DESTDIR)/usr/bin/ ++ @cp opensnitchd.service $(DESTDIR)/usr/lib/systemd/system/ + + deps: + @dep ensure +diff --git a/daemon/opensnitchd.service b/daemon/opensnitchd.service +index e504417..4dfa8fd 100644 +--- a/daemon/opensnitchd.service ++++ b/daemon/opensnitchd.service +@@ -8,7 +8,7 @@ After=network.target + Type=simple + PermissionsStartOnly=true + ExecStartPre=/bin/mkdir -p /etc/opensnitchd/rules +-ExecStart=/usr/local/bin/opensnitchd -log-file /var/log/opensnitchd.log -rules-path /etc/opensnitchd/rules -ui-socket unix:///tmp/osui.sock ++ExecStart=/usr/bin/opensnitchd -log-file /var/log/opensnitchd.log -rules-path /etc/opensnitchd/rules -ui-socket unix:///tmp/osui.sock + Restart=always + RestartSec=30 + +diff --git a/ui/Makefile b/ui/Makefile +index 29c1d35..b7ef78b 100644 +--- a/ui/Makefile ++++ b/ui/Makefile +@@ -1,13 +1,13 @@ + all: opensnitch/resources_rc.py + + install: +- @pip3 install . ++ @echo 'nope' + + opensnitch/resources_rc.py: deps + @pyrcc5 -o opensnitch/resources_rc.py opensnitch/res/resources.qrc + + deps: +- @sudo pip3 install -r requirements.txt ++ @echo 'nope' + + clean: + @rm -rf *.pyc diff --git a/pwuid.patch b/pwuid.patch new file mode 100644 index 000000000000..18fe239de288 --- /dev/null +++ b/pwuid.patch @@ -0,0 +1,13 @@ +diff --git a/ui/opensnitch/dialogs/stats.py b/ui/opensnitch/dialogs/stats.py +index 738363b..40d2a99 100644 +--- a/ui/opensnitch/dialogs/stats.py ++++ b/ui/opensnitch/dialogs/stats.py +@@ -202,7 +202,7 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]): + if self._address is None: + for uid, hits in self._stats.by_uid.items(): + try: +- pw_name = pwd.getpwall(int(uid)).pw_name ++ pw_name = pwd.getpwuid(int(uid)).pw_name + except KeyError: + pw_name = "(UID error)" + finally: |