-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathxumount
executable file
·31 lines (29 loc) · 1.01 KB
/
xumount
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
#!/bin/sh
#
# Umounts every mountpoint in /media mounted
# and asks interactively (in X session) for other umounts
#
{
echo "----- Active mountpoints -----"
mount | column -t
echo "------ Removable mountpoints in /media ------"
ls /media
echo "Unmounting every removable storage device found in /media"
gksudo umount /media/* && echo "Success!" || echo "Operation failed or no mountpoint active."
} 2>&1 | xmessage -file - -buttons "okay:0,umount other mountpoint:101,remount a removable device:102"
case "$?" in
101)
point=$( mount | cut -d" " -f 3 | dmenu -p "mountpoint to unmount: ")
[ $point ] && {
echo "Unmounting $point..."
gksudo umount $point && echo "Success!" || echo "Operation failed."
} 2>&1 | xmessage -file -
;;
102)
point=$( ls /media | cut -d" " -f 3 | dmenu -p "mountpoint to unmount: ")
[ $point ] && {
echo "Mounting $point..."
gksudo mount $point && echo "Success!" || echo "Operation failed."
} 2>&1 | xmessage -file -
;;
esac