forked from canonical/snapd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.sh
More file actions
executable file
·68 lines (62 loc) · 1.45 KB
/
Copy pathclient.sh
File metadata and controls
executable file
·68 lines (62 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
set -eu
command="${1:-all}"
bus_name="${DBUS_BUS_NAME}"
object_path="${DBUS_OBJECT_PATH}"
iface_name="${DBUS_IFACE_NAME}"
cmd_ping() {
# Use --print-reply so dbus-send performs a method call and waits for the
# reply. We discard the reply body because for Ping we only care about the
# success or failure of the round trip.
dbus-send --session --print-reply \
--dest="$bus_name" \
"$object_path" \
org.freedesktop.DBus.Peer.Ping >/dev/null
echo ok
}
cmd_introspect() {
dbus-send --session --print-reply \
--dest="$bus_name" \
"$object_path" \
org.freedesktop.DBus.Introspectable.Introspect | grep -q "$iface_name"
echo ok
}
cmd_get_all() {
dbus-send --session --print-reply \
--dest="$bus_name" \
"$object_path" \
org.freedesktop.DBus.Properties.GetAll \
string:"$iface_name" | grep -q 'uint32 1'
echo ok
}
cmd_test() {
dbus-send --session --print-reply \
--dest="$bus_name" \
"$object_path" \
"$iface_name".Test | grep -q 'string "ok"'
echo ok
}
case "$command" in
ping)
cmd_ping
;;
introspect)
cmd_introspect
;;
get-all)
cmd_get_all
;;
test)
cmd_test
;;
all)
cmd_ping
cmd_introspect
cmd_get_all
cmd_test
;;
*)
echo "unknown command: $command" >&2
exit 1
;;
esac