-
Notifications
You must be signed in to change notification settings - Fork 0
/
ifp-utils.sh
executable file
·85 lines (69 loc) · 1.86 KB
/
ifp-utils.sh
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
export IFP="org.freedesktop.sssd.infopipe"
export IFP_IFACE=$IFP
export IFP_PATH="/org/freedesktop/sssd/infopipe"
ifp-send() {
if should-print-help $@
then
echo "Send an InfoPipe request"
echo "Usage:"
echo "$0 OBJECT-PATH METHOD ARGUMENTS"
echo ""
echo "InfoPipe prefix for object path and method may be skipped."
echo "Example: ifp-send Users Users.FindByName string:John"
return 0
fi
local OBJECT=$1
local METHOD=$2
local ARGS=${@:3}
if [[ $OBJECT != /* ]]
then
OBJECT=`echo "$IFP_PATH/$OBJECT" | sed 's/\/$//'`
fi
if [[ $METHOD != org.* ]]
then
METHOD="$IFP_IFACE.$METHOD"
fi
echo "Calling $METHOD on $OBJECT"
dbus-send --print-reply --system --dest=$IFP $OBJECT $METHOD $ARGS
}
ifp-get() {
if should-print-help $@
then
echo "Send an InfoPipe DBus.Property.Get request"
echo "Usage:"
echo "$0 OBJECT-PATH INTERFACE PROPERTY"
echo ""
return 0
fi
local OBJECT=$1
local IFACE=$2
local PROPERTY=$3
ifp-send $OBJECT org.freedesktop.DBus.Properties.Get string:$IFACE string:$PROPERTY
}
ifp-get-all() {
if should-print-help $@
then
echo "Send an InfoPipe DBus.Property.GetAll request"
echo "Usage:"
echo "$0 OBJECT-PATH INTERFACE"
echo ""
return 0
fi
local OBJECT=$1
local IFACE=$2
ifp-send $OBJECT org.freedesktop.DBus.Properties.GetAll string:$IFACE
}
ifp-introspect() {
if should-print-help $@
then
echo "Send an InfoPipe DBus.Introspectable.Introspect request"
echo "Usage:"
echo "$0 OBJECT-PATH"
echo ""
echo "Example: ifp-introspect /org/freedesktop/sssd/infopipe"
return 0
fi
local OBJECT=$1
ifp-send $OBJECT org.freedesktop.DBus.Introspectable.Introspect
}