minor dmenuumount improvements

This commit is contained in:
Luke Smith 2018-10-18 20:42:44 -04:00
parent 39a0c9c5fa
commit 496aea4504

View file

@ -4,7 +4,6 @@
# Drives mounted at /, /boot and /home will not be options to unmount. # Drives mounted at /, /boot and /home will not be options to unmount.
unmountusb() { unmountusb() {
drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
[ -z "$drives" ] && exit [ -z "$drives" ] && exit
chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')
[ -z "$chosen" ] && exit [ -z "$chosen" ] && exit
@ -24,8 +23,14 @@ asktype() { \
esac esac
} }
if grep simple-mtpfs /etc/mtab; then drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
asktype
else if ! grep simple-mtpfs /etc/mtab; then
[ -z "$drives" ] && echo "No drives to unmount." && exit
echo "Unmountable USB drive detected."
unmountusb unmountusb
else
[ -z "$drives" ] && echo "Unmountable Android device detected." && unmountandroid
echo "Unmountable USB drive(s) and Android device(s) detected."
asktype
fi fi