From a4ec751801c14f0041d1bcec4287d057af115aac Mon Sep 17 00:00:00 2001 From: thediveo Date: Fri, 22 Sep 2023 21:51:06 +0200 Subject: [PATCH] test: apk package installation --- .goreleaser.yaml | 4 ++++ packaging/linux/post-install.sh | 2 +- packaging/linux/post-remove.sh | 2 +- packaging/linux/test/alpine/Dockerfile | 4 ++++ packaging/linux/test/alpine/install.sh | 26 ++++++++++++++++++++++++++ packaging/linux/test/alpine/test.sh | 12 ++++++++++++ 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 packaging/linux/test/alpine/Dockerfile create mode 100755 packaging/linux/test/alpine/install.sh create mode 100755 packaging/linux/test/alpine/test.sh diff --git a/.goreleaser.yaml b/.goreleaser.yaml index e75028c..a4aa208 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -76,6 +76,10 @@ nfpms: dependencies: - desktop-file-utils overrides: + apk: + dependencies: + - wireshark-common + - desktop-file-utils deb: dependencies: - wireshark-common diff --git a/packaging/linux/post-install.sh b/packaging/linux/post-install.sh index 2280b8c..786fa6c 100755 --- a/packaging/linux/post-install.sh +++ b/packaging/linux/post-install.sh @@ -1,2 +1,2 @@ -#!/bin/bash +#!/bin/sh update-desktop-database diff --git a/packaging/linux/post-remove.sh b/packaging/linux/post-remove.sh index 2280b8c..786fa6c 100755 --- a/packaging/linux/post-remove.sh +++ b/packaging/linux/post-remove.sh @@ -1,2 +1,2 @@ -#!/bin/bash +#!/bin/sh update-desktop-database diff --git a/packaging/linux/test/alpine/Dockerfile b/packaging/linux/test/alpine/Dockerfile new file mode 100644 index 0000000..c4e9584 --- /dev/null +++ b/packaging/linux/test/alpine/Dockerfile @@ -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"] diff --git a/packaging/linux/test/alpine/install.sh b/packaging/linux/test/alpine/install.sh new file mode 100755 index 0000000..987072a --- /dev/null +++ b/packaging/linux/test/alpine/install.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +RED="\033[1;31m" +GREEN="\033[1;32m" +NOCOLOR="\033[0m" + +# test harness +apk update +apk add xdg-utils + +# the real deal... +apk add --allow-untrusted /dist/cshargextcap_*_amd64.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) diff --git a/packaging/linux/test/alpine/test.sh b/packaging/linux/test/alpine/test.sh new file mode 100755 index 0000000..c637fff --- /dev/null +++ b/packaging/linux/test/alpine/test.sh @@ -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)