2 # Typically some file manager (thunar, pcmanfm, etc.), but can be whatever.
3 Execute_On_Mount = Execute_On_Mount ? Execute_On_Mount
: ""
7 $
2 ==
"khatus_sensor_devices" && \
13 function mount_device
(path
, cmd
, line
, lines
, line_count
, status
, i
,
15 cmd=
"udisksctl mount --block-device " path
" --no-user-interaction; echo $?"
16 while(cmd
| getline line
) {
17 lines
[++line_count
] = line
20 status = lines
[line_count
]
23 for (i=
1; i
<=line_count
; i
++) {
25 if (line ~
/^Mounted
/) {
26 split(line
, parts
, " +")
29 sub("^Mounted " path_dev
" at ", "", path_mnt
)
30 sub("\.$", "", path_mnt
)
31 alert
("low", "successfully-mounted", path_dev
" to " path_mnt
)
32 if (Execute_On_Mount
) {
33 system(Execute_On_Mount
" '" path_mnt
"'")
36 alert
("hi", "unexpected-success-line", line
)
40 alert
("hi", "failed-to-mount-device", path
)