diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2018-10-18 20:42:44 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2018-10-18 20:42:44 -0400 |
| commit | 496aea4504c70fe165faf90db0bf1d95efa00caf (patch) | |
| tree | 7240242fac01c7445f20bc5b39c05baa83a95d10 | |
| parent | 39a0c9c5fa7b744c6cfea4f8dd1073dc6dfc63d7 (diff) | |
| download | eibhear-496aea4504c70fe165faf90db0bf1d95efa00caf.tar.gz eibhear-496aea4504c70fe165faf90db0bf1d95efa00caf.tar.zst eibhear-496aea4504c70fe165faf90db0bf1d95efa00caf.zip | |
minor dmenuumount improvements
| -rwxr-xr-x | .scripts/dmenuumount | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/.scripts/dmenuumount b/.scripts/dmenuumount index 95393db..c169326 100755 --- a/.scripts/dmenuumount +++ b/.scripts/dmenuumount @@ -4,7 +4,6 @@ # Drives mounted at /, /boot and /home will not be options to unmount. 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 chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') [ -z "$chosen" ] && exit @@ -24,8 +23,14 @@ asktype() { \ esac } -if grep simple-mtpfs /etc/mtab; then - asktype -else +drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') + +if ! grep simple-mtpfs /etc/mtab; then + [ -z "$drives" ] && echo "No drives to unmount." && exit + echo "Unmountable USB drive detected." unmountusb +else + [ -z "$drives" ] && echo "Unmountable Android device detected." && unmountandroid + echo "Unmountable USB drive(s) and Android device(s) detected." + asktype fi |
