summaryrefslogtreecommitdiffstats
path: root/.scripts/i3cmds/dmenumount
diff options
context:
space:
mode:
authorTomJansen <tomjansen@airmail.cc>2019-03-30 12:14:16 +0100
committerTomJansen <tomjansen@airmail.cc>2019-03-30 12:19:43 +0100
commite9fc2e0290b23f3b3a22372368540891c2a6945f (patch)
treecc4073e10ebee46b9bebf63462b14c27aedc00f7 /.scripts/i3cmds/dmenumount
parentbbfd5717ac8f827edb3a8e90f1c991352278d7d4 (diff)
downloadeibhear-e9fc2e0290b23f3b3a22372368540891c2a6945f.tar.gz
eibhear-e9fc2e0290b23f3b3a22372368540891c2a6945f.tar.zst
eibhear-e9fc2e0290b23f3b3a22372368540891c2a6945f.zip
Prune existing mountpoints from find in dmenumount
This speeds up the mounting process if you already have drives mounted containing a large number of folders. Since 2 drives cannot be mounted in the same folder anyway, these are now excluded from the the find command, speeding up the mounting process.
Diffstat (limited to '.scripts/i3cmds/dmenumount')
-rwxr-xr-x.scripts/i3cmds/dmenumount3
1 files changed, 2 insertions, 1 deletions
diff --git a/.scripts/i3cmds/dmenumount b/.scripts/i3cmds/dmenumount
index 4de7438..615e94a 100755
--- a/.scripts/i3cmds/dmenumount
+++ b/.scripts/i3cmds/dmenumount
@@ -18,7 +18,8 @@ getmount() { \
mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
sudo -A mount "$chosen" && notify-send "$chosen mounted." && exit 0
- getmount "/mnt /media /mount /home -maxdepth 5 -type d"
+ alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}')
+ getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;