| 1 |
#!/bin/sh |
| 2 |
set -eu |
| 3 |
|
| 4 |
# Check that the dbus-daemon package provides its intended command-line |
| 5 |
# interface. |
| 6 |
# |
| 7 |
# dbus-daemon implies installation of dbus-bin, so we can rely on having |
| 8 |
# dbus-send and dbus-uuidgen. |
| 9 |
# |
| 10 |
# We indirectly test that dbus-daemon --session works, by running |
| 11 |
# dbus-run-session. |
| 12 |
|
| 13 |
export LC_ALL=C.UTF-8 |
| 14 |
fail= |
| 15 |
|
| 16 |
# dbus-daemon.deb provides a machine ID |
| 17 |
uuid="$(dbus-uuidgen --get)" |
| 18 |
echo "uuid: $uuid" |
| 19 |
set -x |
| 20 |
test -n "$uuid" || fail=yes |
| 21 |
# The machine ID consists of 32 lower-case hex digits (and the file |
| 22 |
# also has a newline) |
| 23 |
test "$uuid" = "$(perl -pe 'print "wrong: " unless /\A[a-z0-9]{32}\n\z/' /var/lib/dbus/machine-id)" || fail=yes |
| 24 |
set +x |
| 25 |
|
| 26 |
# dbus-daemon.deb provides a working dbus-run-session in the PATH |
| 27 |
dbus-run-session -- \ |
| 28 |
dbus-send \ |
| 29 |
--session \ |
| 30 |
--dest=org.freedesktop.DBus \ |
| 31 |
--type=method_call \ |
| 32 |
--print-reply \ |
| 33 |
/org/freedesktop/DBus \ |
| 34 |
org.freedesktop.DBus.Properties.GetAll \ |
| 35 |
string:org.freedesktop.DBus |
| 36 |
|
| 37 |
# dbus-daemon.deb provides a working dbus-daemon in the PATH |
| 38 |
output="$(dbus-daemon --help 2>&1 || :)" |
| 39 |
echo "$output" |
| 40 |
|
| 41 |
case "$output" in |
| 42 |
(dbus-daemon\ *--session*--system*) |
| 43 |
;; |
| 44 |
(*) |
| 45 |
echo "Unexpected output from dbus-daemon" >&2 |
| 46 |
fail=yes |
| 47 |
;; |
| 48 |
esac |
| 49 |
|
| 50 |
test -z "$fail" |
| 51 |
|
| 52 |
# vim:set sw=4 sts=4 et: |