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" && \
14 function mount_device
(path
, cmd
, line
, lines
, line_count
, status
, i
,
16 cmd=
"udisksctl mount --block-device " path
" --no-user-interaction; echo $?"
17 while(cmd
| getline line
) {
18 lines
[++line_count
] = line
21 status = lines
[line_count
]
24 for (i=
1; i
<=line_count
; i
++) {
26 if (line ~
/^Mounted
/) {
27 split(line
, parts
, " +")
30 sub("^Mounted " path_dev
" at ", "", path_mnt
)
31 sub("\.$", "", path_mnt
)
32 msg_out_alert_low
("successfully-mounted", path_dev
" to " path_mnt
)
33 if (Execute_On_Mount
) {
34 system(Execute_On_Mount
" '" path_mnt
"'")
37 msg_out_alert_hi
("unexpected-success-line", line
)
41 msg_out_alert_hi
("failed-to-mount-device", path
)