Skip to content

Commit

Permalink
Merge pull request #8 from siemens/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
thediveo authored Oct 16, 2023
2 parents fd5fd35 + 5212281 commit 2112b55
Show file tree
Hide file tree
Showing 19 changed files with 222 additions and 8 deletions.
14 changes: 14 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ nfpms:
postremove: packaging/linux/post-remove.sh
dependencies:
- desktop-file-utils
overrides:
apk:
dependencies:
- wireshark-common
- desktop-file-utils
deb:
dependencies:
- wireshark-common
- desktop-file-utils
recommends:
- tshark | wireshark
rpm:
dependencies:
- wireshark-cli

archives:
- id: default
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ help: ## list available targets
@# Derived from Gomega's Makefile (github.com/onsi/gomega) under MIT License
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-16s\033[0m %s\n", $$1, $$2}'

dist: ## build snapshot cshargextcap binary packages+archives in dist/
dist: ## build snapshot cshargextcap binary packages+archives in dist/ and test them
# gorelease will run go generate anyway
@scripts/goreleaser.sh --snapshot --clean
for distro in alpine debian fedora ubuntu; do \
( \
echo "== test package installation on $${distro} ==" \
&& cd packaging/linux/test/$${distro} \
&& ./test.sh \
) || exit 1; \
done
@ls -lh dist/cshargextcap_*
@echo "🏁 done"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Then install this plugin: on Windows download and install the cshargextcap
installer artifact. On Linux, download and install the cshargextcap package for
your distribution (apk, deb, or rpm). In case you want to create the
installation files yourself, then simply run `make dist` in the base directory
of this repository. Afterwards, installation files will be found in the `dist/`
of this repository. Please note that this will also test install the packages in distro-specific test containers to ensure the distro packages are fine. Afterwards, installation files can be found in the `dist/`
directory.

Now fire up Wireshark. If the installation went through correctly, Wireshark now
Expand Down
4 changes: 2 additions & 2 deletions packaging/aur/makepackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ NOCOLOR="\033[0m"

docker build --pull -f Dockerfile -t archpkgbuilder .
docker run --rm --name archpkgbuilder -v .:/pkg archpkgbuilder \
&& echo "${GREEN}SUCCESS${NOCOLOR}" \
|| (echo "${RED}FAIL${NOCOLOR}"; exit 1)
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)
2 changes: 1 addition & 1 deletion packaging/linux/post-install.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
#!/bin/sh
update-desktop-database
2 changes: 1 addition & 1 deletion packaging/linux/post-remove.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
#!/bin/sh
update-desktop-database
4 changes: 4 additions & 0 deletions packaging/linux/test/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Do a test installation of the cshargextcap*.apk package on Alpine.
FROM alpine:latest
COPY install.sh /
CMD ["/bin/sh", "install.sh"]
33 changes: 33 additions & 0 deletions packaging/linux/test/alpine/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
set -e

RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"

arch=$(uname -m)
case ${arch} in
x86_64) arch="amd64";;
aarch64) arch="arm64";;
*) echo -e "${RED}FAIL:${NOCOLOR} unsupported architecture ${arch}"; exit 1;;
esac

# test harness
apk update
apk add xdg-utils

# the real deal...
apk add --allow-untrusted /dist/cshargextcap_*_${arch}.apk

apk add tshark

# 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)
12 changes: 12 additions & 0 deletions packaging/linux/test/alpine/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e


RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"

docker build --pull -f Dockerfile -t cshargextcap-alpine-test-install .
docker run --rm --name cshargextcap-alpine-test-install -v ./../../../../dist:/dist cshargextcap-alpine-test-install \
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)
4 changes: 4 additions & 0 deletions packaging/linux/test/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Do a test installation of the cshargextcap*.deb package on Debian.
FROM debian:12-slim
COPY install.sh /
CMD ["/bin/bash", "install.sh"]
33 changes: 33 additions & 0 deletions packaging/linux/test/debian/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e

RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"

arch=$(uname -m)
case ${arch} in
x86_64) arch="amd64";;
aarch64) arch="arm64";;
*) echo -e "${RED}FAIL:${NOCOLOR} unsupported architecture ${arch}"; exit 1;;
esac

# test harness
apt-get update
apt-get install --no-install-recommends --no-install-suggests -y xdg-utils

# the real deal...
apt-get install --no-install-suggests -y /dist/cshargextcap_*_${arch}.deb

apt-get install --no-install-recommends --no-install-suggests -y tshark

# 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)
12 changes: 12 additions & 0 deletions packaging/linux/test/debian/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e


RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"

docker build --pull -f Dockerfile -t cshargextcap-debian-test-install .
docker run --rm --name cshargextcap-debian-test-install -v ./../../../../dist:/dist cshargextcap-debian-test-install \
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)
4 changes: 4 additions & 0 deletions packaging/linux/test/fedora/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Do a test installation of the cshargextcap*.rpm package on Fedora.
FROM fedora:latest
COPY install.sh /
CMD ["/bin/bash", "install.sh"]
30 changes: 30 additions & 0 deletions packaging/linux/test/fedora/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e

RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"

arch=$(uname -m)
case ${arch} in
x86_64) arch="amd64";;
aarch64) arch="arm64";;
*) echo -e "${RED}FAIL:${NOCOLOR} unsupported architecture ${arch}"; exit 1;;
esac

# test harness
dnf install -y xdg-utils

# the real deal...
dnf install -y /dist/cshargextcap_*_${arch}.rpm

# 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)
12 changes: 12 additions & 0 deletions packaging/linux/test/fedora/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e


RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"

docker build --pull -f Dockerfile -t cshargextcap-fedora-test-install .
docker run --rm --name cshargextcap-fedora-test-install -v ./../../../../dist:/dist cshargextcap-fedora-test-install \
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)
4 changes: 4 additions & 0 deletions packaging/linux/test/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Do a test installation of the cshargextcap*.deb package on Ubuntu.
FROM ubuntu:rolling
COPY install.sh /
CMD ["/bin/bash", "install.sh"]
33 changes: 33 additions & 0 deletions packaging/linux/test/ubuntu/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e

RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"

arch=$(uname -m)
case ${arch} in
x86_64) arch="amd64";;
aarch64) arch="arm64";;
*) echo -e "${RED}FAIL:${NOCOLOR} unsupported architecture ${arch}"; exit 1;;
esac

# test harness
apt-get update
apt-get install --no-install-recommends --no-install-suggests -y xdg-utils

# the real deal...
apt-get install --no-install-suggests -y /dist/cshargextcap_*_${arch}.deb

apt-get install --no-install-recommends --no-install-suggests -y tshark

# 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)
12 changes: 12 additions & 0 deletions packaging/linux/test/ubuntu/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e


RED="\033[1;31m"
GREEN="\033[1;32m"
NOCOLOR="\033[0m"

docker build --pull -f Dockerfile -t cshargextcap-ubuntu-test-install .
docker run --rm --name cshargextcap-ubuntu-test-install -v ./../../../../dist:/dist cshargextcap-ubuntu-test-install \
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)
4 changes: 2 additions & 2 deletions packaging/windows/pluginversion.nsh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!define VERSION "0.9.1-4-g9413ea6"
!define FILEVERSION "0.9.1.0"
!define VERSION "0.9.7-7-g83a50af"
!define FILEVERSION "0.9.7.0"
!define COPYRIGHT "Copyright © Siemens 2023"
!define BINARYPATH "/cshargextcap/dist/windows_windows_amd64_v1"
!define BINARYNAME "cshargextcap-amd64.exe"
Expand Down

0 comments on commit 2112b55

Please sign in to comment.