-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunmount
More file actions
executable file
·32 lines (29 loc) · 1018 Bytes
/
unmount
File metadata and controls
executable file
·32 lines (29 loc) · 1018 Bytes
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
#!/bin/bash
unmounter()
{
while read -r var; do
if [[ "$var" == */android/* ]]; then
if fusermount -u "$var"; then
notify-send "Unmounted $var"
rm -rf "$var"
else
notify-send "Failed to unmount $var"
fi
else
block_dev=$(lsblk -lp | grep "$var" | cut -d ' ' -f1)
if udisksctl unmount -b "$block_dev"; then
notify-send "Unmounted $var"
else
notify-send "Failed to unmount $var"
fi
fi
done
}
df="df --output=target"
mtpfs_mpoint='/android'
usb_mpoint='/media'
if $df | grep -e "$mtpfs_mpoint" -e "$usb_mpoint";then
$df | grep -e "$mtpfs_mpoint" -e "$usb_mpoint" | dmenu -i | unmounter
else
notify-send 'Nothing to unmount'
fi