File: check-mount-operation

package info (click to toggle)
phosh 0.53.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 9,868 kB
  • sloc: ansic: 83,377; xml: 3,981; python: 717; sh: 449; makefile: 34; lisp: 22; javascript: 6
file content (57 lines) | stat: -rwxr-xr-x 1,517 bytes parent folder | download | duplicates (3)
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}"