Skip to content

Commit

Permalink
fix: use split package, add installation tests for tshark detection a…
Browse files Browse the repository at this point in the history
…nd mime handler registration
  • Loading branch information
thediveo committed Sep 19, 2023
1 parent 1952147 commit 43ec6c0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packaging/aur/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FROM archlinux:base-devel

RUN useradd -m build && \
pacman -Syu --noconfirm && \
pacman -Sy --noconfirm git && \
pacman -Sy --noconfirm git xdg-utils && \
echo "build ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/build
USER build
WORKDIR /pkg
COPY packagebuild.sh /
COPY packagebuildandtest.sh /
CMD ["/bin/bash", "packagebuildandtest.sh"]
19 changes: 14 additions & 5 deletions packaging/aur/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
# Wireshark:
# - https://gitlab.archlinux.org/archlinux/packaging/packages/wireshark/-/blob/main/PKGBUILD?ref_type=heads

pkgname='cshargextcap'
pkgbase='cshargextcap'
pkgname=('cshargextcap-cli' 'cshargextcap-desktop')
pkgver='0.9.2'
pkgrel=1
pkgdesc='Wireshark extcap plugin for container traffic capture live streaming'
url='https://github.com/siemens/cshargextcap'
arch=('x86_64')
license=('MIT')
depends=('wireshark-cli')
makedepends=('go')
source=("https://github.com/siemens/cshargextcap/archive/refs/tags/v${pkgver}.tar.gz")

Expand All @@ -36,8 +36,17 @@ build() {
./cmd/cshargextcap
}

package() {
package_cshargextcap-cli() {
depends=('wireshark-cli')

cd "${pkgbase}-${pkgver}"
install -Dm 755 build/cshargextcap "${pkgdir}"/usr/lib/wireshark/extcap/cshargextcap
install -Dm 644 packaging/linux/com.github.siemens.packetflix.desktop "${pkgdir}"/usr/sahre/applications
install -Dm 755 build/cshargextcap -t "${pkgdir}"/usr/lib/wireshark/extcap
}

package_cshargextcap-desktop() {
pkgdesk+=" - desktop integration"
depends=('cshargextcap-cli' 'wireshark-qt')

cd "${pkgbase}-${pkgver}"
install -Dm 644 packaging/linux/com.github.siemens.packetflix.desktop -t "${pkgdir}"/usr/share/applications
}
15 changes: 11 additions & 4 deletions packaging/aur/packagebuildandtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ cp -r /pkg /tmp/pkg
cd /tmp/pkg

makepkg -g >> PKGBUILD
makepkg --noconfirm --syncdeps --rmdeps --install --clean
makepkg --noconfirm --syncdeps --rmdeps --clean --install

# Pass back the PKGBUILD with checksum(s) included so someone might publish it
# as a release artefact.
# Pass back the PKGBUILD with checksum(s) included so that we can publish it as
# a release artefact from the release pipeline.
mkdir -p /pkg/dist
cp PKGBUILD /pkg/dist/

# Ask tshark to tell us the extcap interfaces it knows of: this must list the
# packetflix extcap so we know we've installed the plugin properly.
tshark -D | grep packetflix
tshark -D | grep packetflix \
&& echo "OK: tshark detects extcap plugin" \
|| (echo "FAIL: tshark doesn't detect the packetflix extcap"; exit 1)

# Check that the default URL scheme handler registration is in place.
xdg-mime query default x-scheme-handler/packetflix | grep "packetflix.desktop" \
&& echo "OK: packetflix URL scheme handler registered" \
|| (echo "packetflix URL scheme handler not detected"; exit 1)

0 comments on commit 43ec6c0

Please sign in to comment.