From 994f36babe776ebbd5bd60e90328ca3da771ec1d Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Sun, 10 Mar 2019 16:48:16 +0100 Subject: Fixed mount scripts. --- dmenuUmount.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'dmenuUmount.sh') diff --git a/dmenuUmount.sh b/dmenuUmount.sh index 1669706..61af1c1 100755 --- a/dmenuUmount.sh +++ b/dmenuUmount.sh @@ -13,16 +13,18 @@ # Gives a dmenu prompt to umount mounted drives. # Shows mounted partitions; select one to unmount. -exclusionregex="\(/boot\|/home\|/\)$" +exclusionregex="\(/boot/efi\|/home\|/\)$" +list="$(lsblk -lp | grep "part /" | grep -v "$exclusionregex")" +[ "$list" == "" ] && notify-send -t 2000 "No devices found to unmount." && exit 0 drives="" i=0 while read -r line do i=$((i+1)) drives="$drives$i. $( echo "$line" | awk '{print $1, "(" $4 ")", "on", $7}' )"$'\n' -done <<< "$(lsblk -lp | grep "part /" | grep -v "$exclusionregex")" +done <<< "$list" [ "$drives" == "" ] && exit lines=$(echo "$drives" | wc -l) chosen=$(echo "$drives" | dmenu -i -l $lines -p "Unmount which drive?" | awk '{print $2}') [ "$chosen" == "" ] && exit -umount $chosen && pgrep -x dunst && notify-send "$chosen unmounted." +sudo umount $chosen && pgrep -x dunst && notify-send "$chosen unmounted." -- cgit v1.2.1