summaryrefslogtreecommitdiff
path: root/keyboard/mnt
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2021-10-11 15:08:51 -0500
committerTimmy Keller <tjk@tjkeller.xyz>2021-10-11 15:08:51 -0500
commit2cf3ea2f828f6da07adff92a7dc5bce6069620ab (patch)
tree213dabd2d9301d3930f47f2a03c901dfbb100297 /keyboard/mnt
parent551e1c638a6a4ff2130b3c374774f6006b28467d (diff)
downloadscripts-2cf3ea2f828f6da07adff92a7dc5bce6069620ab.tar.xz
scripts-2cf3ea2f828f6da07adff92a7dc5bce6069620ab.zip
sinking
Diffstat (limited to 'keyboard/mnt')
-rwxr-xr-xkeyboard/mnt7
1 files changed, 4 insertions, 3 deletions
diff --git a/keyboard/mnt b/keyboard/mnt
index 5f82aa4..7547912 100755
--- a/keyboard/mnt
+++ b/keyboard/mnt
@@ -1,10 +1,11 @@
#!/bin/sh
-if partition=`lsblk --noheadings --paths --raw | awk '/part $/ { print $1, "(" $4 ")" }' | dmenu -p "Choose drive to mount: " | sed 's/ .*//'` \
+# '/part\s*$\|rom\s*$/!d; s/\s*[^[:space:]]*\s*$/\)/; s/\s/ \(/' # More correct in my opinion, but slower
+if partition=`lsblk -npro "name,size,type,mountpoint" | sed '/part $\|rom $/!d; s/ [a-z]* $/\)/; s/ / \(/' | dmenu -p "Choose drive to mount: " | cut -d' ' -f1` \
&& [ -n "$partition" ] \
-&& mountpoint=`ls --directory /media/mnt/*/ | dmenu -p "Choose mountpoint: "` \
+&& mountpoint=`ls -d /media/mnt/slot*/ | dmenu -p "Choose mountpoint: "` \
&& [ -n "$mountpoint" ]
then
- doas mount "$partition" "$mountpoint" \
+ doas mount "$partition" "$mountpoint"; user="$(whoami)"; ug="$(groups | cut -d' ' -f1)"; doas chown "$user":"$ug" "$mountpoint" \
&& notify-send --urgency low "Device Successfully Mounted" "Successfully Mounted partition \"$partition\" to mountpoint \"$mountpoint\"" \
|| notify-send --urgency low "Error Mounting Device" "Could not mount partition \"$partition\" to mountpoint \"$mountpoint\""
fi