Skip to content

Commit 5212281

Browse files
authored
Merge pull request #7 from siemens/feature/distro-install-tests
Feature/distro install tests
2 parents fd5fd35 + b37f9d1 commit 5212281

19 files changed

+222
-8
lines changed

.goreleaser.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ nfpms:
7575
postremove: packaging/linux/post-remove.sh
7676
dependencies:
7777
- desktop-file-utils
78+
overrides:
79+
apk:
80+
dependencies:
81+
- wireshark-common
82+
- desktop-file-utils
83+
deb:
84+
dependencies:
85+
- wireshark-common
86+
- desktop-file-utils
87+
recommends:
88+
- tshark | wireshark
89+
rpm:
90+
dependencies:
91+
- wireshark-cli
7892

7993
archives:
8094
- id: default

Makefile

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

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

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Then install this plugin: on Windows download and install the cshargextcap
101101
installer artifact. On Linux, download and install the cshargextcap package for
102102
your distribution (apk, deb, or rpm). In case you want to create the
103103
installation files yourself, then simply run `make dist` in the base directory
104-
of this repository. Afterwards, installation files will be found in the `dist/`
104+
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/`
105105
directory.
106106

107107
Now fire up Wireshark. If the installation went through correctly, Wireshark now

packaging/aur/makepackage.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ NOCOLOR="\033[0m"
77

88
docker build --pull -f Dockerfile -t archpkgbuilder .
99
docker run --rm --name archpkgbuilder -v .:/pkg archpkgbuilder \
10-
&& echo "${GREEN}SUCCESS${NOCOLOR}" \
11-
|| (echo "${RED}FAIL${NOCOLOR}"; exit 1)
10+
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
11+
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)

packaging/linux/post-install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#!/bin/bash
1+
#!/bin/sh
22
update-desktop-database

packaging/linux/post-remove.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#!/bin/bash
1+
#!/bin/sh
22
update-desktop-database
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Do a test installation of the cshargextcap*.apk package on Alpine.
2+
FROM alpine:latest
3+
COPY install.sh /
4+
CMD ["/bin/sh", "install.sh"]
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
set -e
3+
4+
RED="\033[1;31m"
5+
GREEN="\033[1;32m"
6+
NOCOLOR="\033[0m"
7+
8+
arch=$(uname -m)
9+
case ${arch} in
10+
x86_64) arch="amd64";;
11+
aarch64) arch="arm64";;
12+
*) echo -e "${RED}FAIL:${NOCOLOR} unsupported architecture ${arch}"; exit 1;;
13+
esac
14+
15+
# test harness
16+
apk update
17+
apk add xdg-utils
18+
19+
# the real deal...
20+
apk add --allow-untrusted /dist/cshargextcap_*_${arch}.apk
21+
22+
apk add tshark
23+
24+
# Ask tshark to tell us the extcap interfaces it knows of: this must list the
25+
# packetflix extcap so we know we've installed the plugin properly.
26+
tshark -D | grep packetflix \
27+
&& echo -e "${GREEN}OK:${NOCOLOR} tshark detects extcap plugin" \
28+
|| (echo -e "${RED}FAIL:${NOCOLOR} tshark doesn't detect the packetflix extcap"; exit 1)
29+
30+
# Check that the default URL scheme handler registration is in place.
31+
xdg-mime query default x-scheme-handler/packetflix | grep "packetflix.desktop" \
32+
&& echo -e "${GREEN}OK:${NOCOLOR} packetflix URL scheme handler registered" \
33+
|| (echo -e "${RED}FAIL:${NOCOLOR} packetflix URL scheme handler not detected"; exit 1)

packaging/linux/test/alpine/test.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
5+
RED="\033[1;31m"
6+
GREEN="\033[1;32m"
7+
NOCOLOR="\033[0m"
8+
9+
docker build --pull -f Dockerfile -t cshargextcap-alpine-test-install .
10+
docker run --rm --name cshargextcap-alpine-test-install -v ./../../../../dist:/dist cshargextcap-alpine-test-install \
11+
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
12+
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Do a test installation of the cshargextcap*.deb package on Debian.
2+
FROM debian:12-slim
3+
COPY install.sh /
4+
CMD ["/bin/bash", "install.sh"]
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -e
3+
4+
RED="\033[1;31m"
5+
GREEN="\033[1;32m"
6+
NOCOLOR="\033[0m"
7+
8+
arch=$(uname -m)
9+
case ${arch} in
10+
x86_64) arch="amd64";;
11+
aarch64) arch="arm64";;
12+
*) echo -e "${RED}FAIL:${NOCOLOR} unsupported architecture ${arch}"; exit 1;;
13+
esac
14+
15+
# test harness
16+
apt-get update
17+
apt-get install --no-install-recommends --no-install-suggests -y xdg-utils
18+
19+
# the real deal...
20+
apt-get install --no-install-suggests -y /dist/cshargextcap_*_${arch}.deb
21+
22+
apt-get install --no-install-recommends --no-install-suggests -y tshark
23+
24+
# Ask tshark to tell us the extcap interfaces it knows of: this must list the
25+
# packetflix extcap so we know we've installed the plugin properly.
26+
tshark -D | grep packetflix \
27+
&& echo -e "${GREEN}OK:${NOCOLOR} tshark detects extcap plugin" \
28+
|| (echo -e "${RED}FAIL:${NOCOLOR} tshark doesn't detect the packetflix extcap"; exit 1)
29+
30+
# Check that the default URL scheme handler registration is in place.
31+
xdg-mime query default x-scheme-handler/packetflix | grep "packetflix.desktop" \
32+
&& echo -e "${GREEN}OK:${NOCOLOR} packetflix URL scheme handler registered" \
33+
|| (echo -e "${RED}FAIL:${NOCOLOR} packetflix URL scheme handler not detected"; exit 1)

packaging/linux/test/debian/test.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
5+
RED="\033[1;31m"
6+
GREEN="\033[1;32m"
7+
NOCOLOR="\033[0m"
8+
9+
docker build --pull -f Dockerfile -t cshargextcap-debian-test-install .
10+
docker run --rm --name cshargextcap-debian-test-install -v ./../../../../dist:/dist cshargextcap-debian-test-install \
11+
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
12+
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Do a test installation of the cshargextcap*.rpm package on Fedora.
2+
FROM fedora:latest
3+
COPY install.sh /
4+
CMD ["/bin/bash", "install.sh"]
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -e
3+
4+
RED="\033[1;31m"
5+
GREEN="\033[1;32m"
6+
NOCOLOR="\033[0m"
7+
8+
arch=$(uname -m)
9+
case ${arch} in
10+
x86_64) arch="amd64";;
11+
aarch64) arch="arm64";;
12+
*) echo -e "${RED}FAIL:${NOCOLOR} unsupported architecture ${arch}"; exit 1;;
13+
esac
14+
15+
# test harness
16+
dnf install -y xdg-utils
17+
18+
# the real deal...
19+
dnf install -y /dist/cshargextcap_*_${arch}.rpm
20+
21+
# Ask tshark to tell us the extcap interfaces it knows of: this must list the
22+
# packetflix extcap so we know we've installed the plugin properly.
23+
tshark -D | grep packetflix \
24+
&& echo -e "${GREEN}OK:${NOCOLOR} tshark detects extcap plugin" \
25+
|| (echo -e "${RED}FAIL:${NOCOLOR} tshark doesn't detect the packetflix extcap"; exit 1)
26+
27+
# Check that the default URL scheme handler registration is in place.
28+
xdg-mime query default x-scheme-handler/packetflix | grep "packetflix.desktop" \
29+
&& echo -e "${GREEN}OK:${NOCOLOR} packetflix URL scheme handler registered" \
30+
|| (echo -e "${RED}FAIL:${NOCOLOR} packetflix URL scheme handler not detected"; exit 1)

packaging/linux/test/fedora/test.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
5+
RED="\033[1;31m"
6+
GREEN="\033[1;32m"
7+
NOCOLOR="\033[0m"
8+
9+
docker build --pull -f Dockerfile -t cshargextcap-fedora-test-install .
10+
docker run --rm --name cshargextcap-fedora-test-install -v ./../../../../dist:/dist cshargextcap-fedora-test-install \
11+
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
12+
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Do a test installation of the cshargextcap*.deb package on Ubuntu.
2+
FROM ubuntu:rolling
3+
COPY install.sh /
4+
CMD ["/bin/bash", "install.sh"]
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -e
3+
4+
RED="\033[1;31m"
5+
GREEN="\033[1;32m"
6+
NOCOLOR="\033[0m"
7+
8+
arch=$(uname -m)
9+
case ${arch} in
10+
x86_64) arch="amd64";;
11+
aarch64) arch="arm64";;
12+
*) echo -e "${RED}FAIL:${NOCOLOR} unsupported architecture ${arch}"; exit 1;;
13+
esac
14+
15+
# test harness
16+
apt-get update
17+
apt-get install --no-install-recommends --no-install-suggests -y xdg-utils
18+
19+
# the real deal...
20+
apt-get install --no-install-suggests -y /dist/cshargextcap_*_${arch}.deb
21+
22+
apt-get install --no-install-recommends --no-install-suggests -y tshark
23+
24+
# Ask tshark to tell us the extcap interfaces it knows of: this must list the
25+
# packetflix extcap so we know we've installed the plugin properly.
26+
tshark -D | grep packetflix \
27+
&& echo -e "${GREEN}OK:${NOCOLOR} tshark detects extcap plugin" \
28+
|| (echo -e "${RED}FAIL:${NOCOLOR} tshark doesn't detect the packetflix extcap"; exit 1)
29+
30+
# Check that the default URL scheme handler registration is in place.
31+
xdg-mime query default x-scheme-handler/packetflix | grep "packetflix.desktop" \
32+
&& echo -e "${GREEN}OK:${NOCOLOR} packetflix URL scheme handler registered" \
33+
|| (echo -e "${RED}FAIL:${NOCOLOR} packetflix URL scheme handler not detected"; exit 1)

packaging/linux/test/ubuntu/test.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
5+
RED="\033[1;31m"
6+
GREEN="\033[1;32m"
7+
NOCOLOR="\033[0m"
8+
9+
docker build --pull -f Dockerfile -t cshargextcap-ubuntu-test-install .
10+
docker run --rm --name cshargextcap-ubuntu-test-install -v ./../../../../dist:/dist cshargextcap-ubuntu-test-install \
11+
&& echo -e "${GREEN}SUCCESS${NOCOLOR}" \
12+
|| (echo -e "${RED}FAIL${NOCOLOR}"; exit 1)

packaging/windows/pluginversion.nsh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
!define VERSION "0.9.1-4-g9413ea6"
2-
!define FILEVERSION "0.9.1.0"
1+
!define VERSION "0.9.7-7-g83a50af"
2+
!define FILEVERSION "0.9.7.0"
33
!define COPYRIGHT "Copyright © Siemens 2023"
44
!define BINARYPATH "/cshargextcap/dist/windows_windows_amd64_v1"
55
!define BINARYNAME "cshargextcap-amd64.exe"

0 commit comments

Comments
 (0)