From 2dc5e822334a2d0fb6860f9b55f91b2e328a2ad6 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 10 Apr 2018 17:43:40 -0700 Subject: dmenu recording, mounting and umounted added --- .scripts/dmenuumount | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 .scripts/dmenuumount (limited to '.scripts/dmenuumount') diff --git a/.scripts/dmenuumount b/.scripts/dmenuumount new file mode 100755 index 0000000..5a26677 --- /dev/null +++ b/.scripts/dmenuumount @@ -0,0 +1,14 @@ +#!/bin/sh + +# A dmenu prompt to unmount drives. +# Provides you with mounted partitions, select one to unmount. + +# Drives mounted at /, /boot and /home will not be options to unmount. +# This can be changed by modifying $exclusionregex. + +exclusionregex="\(/boot\|/home\|/\)$" +drives=$(lsblk -lp | grep "t /" | grep -v "$exclusionregex" | awk '{print $1, "(" $4 ")", "on", $7}') +[[ "$drives" = "" ]] && exit +chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') +[[ "$chosen" = "" ]] && exit +sudo umount $chosen -- cgit v1.3.1