summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmenumount
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/dmenumount')
-rwxr-xr-x.local/bin/dmenumount8
1 files changed, 2 insertions, 6 deletions
diff --git a/.local/bin/dmenumount b/.local/bin/dmenumount
index 825ff56..abeb0ce 100755
--- a/.local/bin/dmenumount
+++ b/.local/bin/dmenumount
@@ -9,7 +9,7 @@ getmount() { \
[ -z "$chosen" ] && exit 1
# shellcheck disable=SC2086
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
- [ "$mp" = "" ] && exit 1
+ test -z "$mp" && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
@@ -50,11 +50,7 @@ asktype() { \
}
anddrives=$(simple-mtpfs -l 2>/dev/null)
-# Get all block devices which are parents of other devices
-parentnames="$(lsblk -rpo "pkname" | awk 'NR!=1 && $0 != ""' | uniq | xargs printf '^%s$|' | sed 's/|$//')"
-# Get all `part` and `rom` devices, which aren't a parent to another device
-# This allows ommiting partitions which have i.e. crypt or lvm childs
-usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk -v parentnames="$parentnames" '$2 ~ "part|rom" && $4=="" && $1 !~ parentnames {printf "%s (%s)\n",$1,$3}')"
+usbdrives="$(lsblk -rpo "name,type,size,label,mountpoint,fstype" | grep -v crypto_LUKS | grep 'part\|rom' | sed 's/ /:/g' | awk -F':' '$5==""{printf "%s (%s) %s\n",$1,$3,$4}')"
if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit