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
|
#!/bin/sh
set -e
FLAGS="0x9"
ACTION=
while [ -n "$1" ]; do
case "$1" in
-p|--password)
ACTION=password
;;
-q|--question)
ACTION=question
;;
-P|--processes)
ACTION=processes
;;
-f|--flags)
shift
FLAGS="$1"
;;
esac
shift
done
NAME="org.gtk.MountOperationHandler"
OBJECT_PATH="/org/gtk/MountOperationHandler"
CLOSE="org.Gtk.MountOperationHandler.Close"
echo "Action: '${ACTION}'"
if [ "${ACTION}" = "question" ]; then
gdbus call --session --dest "${NAME}" \
--object-path "${OBJECT_PATH}" \
--method org.Gtk.MountOperationHandler.AskQuestion \
"OpId0q" "What do you want to do?\nThere's so many questions." \
"drive-harddisk" "['abc', 'def', '☃']"
elif [ "${ACTION}" = "processes" ]; then
gdbus call --session --dest "${NAME}" \
--object-path "${OBJECT_PATH}" \
--method org.Gtk.MountOperationHandler.ShowProcesses \
"OpId0P" "Volume is busy\nOne or more applications are keeping the volume busy." \
"drive-harddisk" "[123, 4, 10]" "['abc', 'def', '☃']"
else
gdbus call --session --dest "${NAME}" \
--object-path "${OBJECT_PATH}" \
--method org.Gtk.MountOperationHandler.AskPassword \
"OpId0p" "Enter a passphrase to unlock the volume
The passphrase is needed to access encrypted data on your usbstick (8.1 GB Drive)." \
"drive-harddisk" "" "" "${FLAGS}"
fi
gdbus call --session --dest "${NAME}" \
--object-path "${OBJECT_PATH}" \
--method "${CLOSE}"
|