-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from siemens/feature/aur
feat: Arch PKGBUILD and self-test
- Loading branch information
Showing
6 changed files
with
136 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/dist | ||
/packaging/aur/dist | ||
*.syso | ||
coverage.* | ||
__debug_bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM archlinux:base-devel | ||
|
||
RUN useradd -m build && \ | ||
pacman -Syu --noconfirm && \ | ||
pacman -Sy --noconfirm git xdg-utils && \ | ||
echo "build ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/build | ||
USER build | ||
WORKDIR /pkg | ||
COPY packagebuildandtest.sh / | ||
CMD ["/bin/bash", "packagebuildandtest.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Maintainer: Harald Albrecht <harald.albrecht@siemens.com> | ||
|
||
# - https://wiki.archlinux.org/title/creating_packages | ||
# - https://wiki.archlinux.org/title/Go_package_guidelines | ||
# - https://wiki.archlinux.org/title/PKGBUILD | ||
# | ||
# Wireshark: | ||
# - https://gitlab.archlinux.org/archlinux/packaging/packages/wireshark/-/blob/main/PKGBUILD?ref_type=heads | ||
|
||
pkgbase='cshargextcap-git' | ||
pkgname=('cshargextcap-git-cli' 'cshargextcap-git-desktop') | ||
pkgver='0' # must be present, but will later be replaced by output of pkgver() | ||
pkgrel='1' | ||
pkgdesc='Wireshark extcap plugin for container traffic capture live streaming' | ||
url='https://github.com/siemens/cshargextcap' | ||
arch=('x86_64') | ||
license=('MIT') | ||
makedepends=('go' 'git') | ||
# https://wiki.archlinux.org/title/VCS_package_guidelines | ||
source=("git+https://github.com/siemens/cshargextcap") | ||
md5sums=('SKIP') | ||
|
||
pkgver() { | ||
cd "${srcdir}/cshargextcap" | ||
git describe --long --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' | ||
} | ||
|
||
prepare() { | ||
cd "${srcdir}/cshargextcap" | ||
mkdir -p build | ||
} | ||
|
||
build() { | ||
cd "${srcdir}/cshargextcap" | ||
go build \ | ||
-tags netgo,osusergo \ | ||
-trimpath \ | ||
-buildmode pie \ | ||
-mod=readonly \ | ||
-modcacherw \ | ||
-ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \ | ||
-o build/ \ | ||
./cmd/cshargextcap | ||
} | ||
|
||
package_cshargextcap-git-cli() { | ||
depends=('wireshark-cli') | ||
|
||
cd "${srcdir}/cshargextcap" | ||
install -Dm 755 build/cshargextcap -t "${pkgdir}"/usr/lib/wireshark/extcap | ||
} | ||
|
||
package_cshargextcap-git-desktop() { | ||
pkgdesk+=" - desktop integration" | ||
depends=('cshargextcap-git-cli' 'wireshark-qt') | ||
|
||
cd "${srcdir}/cshargextcap" | ||
install -Dm 644 packaging/linux/com.github.siemens.packetflix.desktop -t "${pkgdir}"/usr/share/applications | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
docker build --pull -f Dockerfile -t archpkgbuilder . | ||
docker run -it --rm --name archpkgbuilder -v .:/pkg archpkgbuilder && echo "SUCCESS" || echo "FAIL" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
RED="\033[1;31m" | ||
GREEN="\033[1;32m" | ||
NOCOLOR="\033[0m" | ||
|
||
cp -r /pkg /tmp/pkg | ||
cd /tmp/pkg | ||
|
||
makepkg --noconfirm --syncdeps --rmdeps --clean --install | ||
|
||
# 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 \ | ||
&& echo -e "${GREEN}OK:${NOCOLOR} tshark detects extcap plugin" \ | ||
|| (echo -e "${RED}FAIL:${NOCOLOR} 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 -e "${GREEN}OK:${NOCOLOR} packetflix URL scheme handler registered" \ | ||
|| (echo -e "${RED}FAIL:${NOCOLOR} packetflix URL scheme handler not detected"; exit 1) |