Files
spotifast/packaging/test-install.sh
T

62 lines
2.2 KiB
Bash

#!/usr/bin/env bash
# Usage: bash packaging/test-install.sh ubuntu:24.04 dist/packages/0.7.1
# Run on the matching architecture, with a C compiler and Docker available.
set -euo pipefail
image=${1:?Supply a Debian, Ubuntu or Fedora container image}
packages=$(realpath "${2:?Supply a native-packages output directory}")
case "$(uname -m)" in
x86_64) target=linux-amd64 ;;
aarch64) target=linux-arm64 ;;
*) echo 'Unsupported test architecture' >&2; exit 1 ;;
esac
case "$image" in
ubuntu:*|debian:*) format=deb ;;
fedora:*) format=rpm ;;
*) echo 'Unsupported test distribution' >&2; exit 1 ;;
esac
package_dir="$packages/packages/$target/$format"
test -d "$package_dir"
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
checks=$(mktemp -d)
trap 'rm -rf -- "$checks"' EXIT
cc -std=c99 -Wall -Wextra -Werror "$script_dir/check-runtime-libs.c" -ldl -o "$checks/check-runtime-libs"
docker run --rm \
--volume "$package_dir:/packages:ro" \
--volume "$checks:/checks:ro" \
--env "FORMAT=$format" \
"$image" sh -ec '
set -- /packages/*."$FORMAT"
test "$#" -eq 1
test -f "$1"
if [ "$FORMAT" = deb ]; then
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "$1"
dpkg-query -W fastpotify
else
dnf install -y --setopt=install_weak_deps=False "$1"
rpm -q fastpotify
fi
# --version exercises linked libraries; the probe checks dlopen libraries
# without installing a desktop, compiler, interpreter or test dependencies.
fastpotify --version
spotifast --version
/checks/check-runtime-libs
test -s /usr/share/applications/fastpotify.desktop
test -s /usr/share/icons/hicolor/scalable/apps/fastpotify.svg
test -s /usr/share/spotifast/omarchy/spotifast.json.tpl
test -x /usr/share/spotifast/omarchy/spotifast-theme
if [ "$FORMAT" = deb ]; then
apt-get remove -y fastpotify
else
dnf remove -y fastpotify
fi
test ! -e /usr/bin/fastpotify
test ! -e /usr/bin/spotifast
test ! -e /usr/share/applications/fastpotify.desktop
test ! -e /usr/share/icons/hicolor/scalable/apps/fastpotify.svg
test ! -e /usr/share/spotifast/omarchy/spotifast.json.tpl
test ! -e /usr/share/spotifast/omarchy/spotifast-theme
'