1#!/usr/bin/env bash
2
3# Throw error any time a command fails
4set -euo pipefail
5
6BASE="$(dirname "$(dirname "$(readlink -f "$0")")")"
7DESTDIR="${BASE}/install"
8PREFIX="/testprefix"
9SYSCONFDIR="/sysconfdir"
10
11make -C "${BASE}" SYSTEMD=1 DESTDIR="${DESTDIR}" PREFIX="${PREFIX}" SYSCONFDIR="${SYSCONFDIR}" SERVICEDIR_SYSTEMD="/systemd" SERVICEDIR_DBUS="/dbus" install
12
13diff -u <(find "${DESTDIR}" -type f -printf "%P\n" | sort) - <<EOF
14dbus/org.knopwob.dunst.service
15sysconfdir/dunst/dunstrc
16systemd/dunst.service
17testprefix/bin/dunst
18testprefix/bin/dunstctl
19testprefix/bin/dunstify
20testprefix/share/man/man1/dunst.1
21testprefix/share/man/man1/dunstctl.1
22testprefix/share/man/man5/dunst.5
23EOF
24# make sure to manually sort the above values
25
26make -C "${BASE}" SYSTEMD=1 DESTDIR="${DESTDIR}" PREFIX="${PREFIX}" SYSCONFDIR="${SYSCONFDIR}" SERVICEDIR_SYSTEMD="/systemd" SERVICEDIR_DBUS="/dbus" uninstall
27
28if ! [ -z "$(find "${DESTDIR}" -type f)" ]; then
29        echo "Uninstall failed, following files weren't removed"
30        find "${DESTDIR}" -type f
31        exit 1
32fi
33