Add partition label to dmenuumount script (#999)

If a partition doesn't have a label, it results in a double space that awk ignores. Which is why the changes include a pipe into sed.
This commit is contained in:
Richard Halford 2021-09-23 16:48:58 +01:00 committed by GitHub
parent c172efd515
commit 93a9e978da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,7 +26,7 @@ asktype() { \
esac
}
drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | sed 's/ /:/g' | awk -F':' '$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}')
if ! grep simple-mtpfs /etc/mtab; then
[ -z "$drives" ] && echo "No drives to unmount." && exit