dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

commit 9cede52ff0ca95a2d49af3f53a49de7a0b459954
parent d350f1d4a4e349e837283d8d8acb23c9ab875d71
Author: Chris Noxz <chris@noxz.tech>
Date:   Mon, 18 May 2020 21:21:17 +0200

[bin] make dmenu_(u)mount scripts more generic

Diffstat:
Mbin/.local/bin/dmenu_mount | 38+++++++++++++++++++-------------------
Mbin/.local/bin/dmenu_umount | 6+++---
2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/bin/.local/bin/dmenu_mount b/bin/.local/bin/dmenu_mount @@ -2,18 +2,18 @@ # get mountable partitions parts="$( - lsblk -lp \ - | grep "[0-9] part $" \ - | awk '{print $1, "(" $4 ")"}' \ + lsblk -sdn -o PATH,SIZE,TYPE,MOUNTPOINT \ + | grep 'part[ ]*$' \ + | awk '{print $1, "[" $2 "]"}' \ )" [ "$parts" = "" ] && exit 1 # choose a partition to mount args=" -i -p partition:" part="$( - echo "$parts" \ - | dmenu_vtc${args} \ - | awk '{print $1}' \ + echo "$parts" \ + | dmenu_vtc${args} \ + | awk '{print $1}' \ )" [ "$part" = "" ] && exit 1 @@ -22,24 +22,24 @@ sudo mount "$part" 2>/dev/null && exit 0 # get available mount points dirs="$( - find \ - /mnt \ - /media \ - /mount \ - ~/mnt \ - ~/media \ - ~/mount \ - -maxdepth 2 \ - -type d \ - -empty \ - 2>/dev/null \ + find \ + /mnt \ + /media \ + /mount \ + ~/mnt \ + ~/media \ + ~/mount \ + -maxdepth 2 \ + -type d \ + -empty \ + 2>/dev/null \ )" # choose a mount point args=" -i -p directory:" mntpnt="$( - echo "$dirs" \ - | dmenu_vtc${args} \ + echo "$dirs" \ + | dmenu_vtc${args} \ )" [ "$mntpnt" = "" ] || [ ! -d "$mntpnt" ] && exit 1 diff --git a/bin/.local/bin/dmenu_umount b/bin/.local/bin/dmenu_umount @@ -18,10 +18,10 @@ exclude="$( # get mounted partitions parts="$( \ - lsblk -lp \ - | grep "part /" \ + lsblk -sdn -o PATH,SIZE,TYPE,MOUNTPOINT \ + | grep 'part[ ]*/' \ | grep -v "$exclude" \ - | awk '{print $1, "(" $4 ")", "on", $7}' \ + | awk '{print $1, "[" $2 "]", "on", $4}' \ )" [ "$parts" = "" ] && exit