summaryrefslogtreecommitdiffstats
path: root/.local/bin/mounter
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2023-02-13 08:12:40 -0500
committerLuke Smith <luke@lukesmith.xyz>2023-02-13 08:12:40 -0500
commit12167f3dda4a4fc58f7aa441ad93cfa3bb446dbb (patch)
treebfb0071b0d2f5f8525a527f452cb6c299d986dd4 /.local/bin/mounter
parent537464795b5b25ae3a5e45ae4acb1e8a9f3b3f28 (diff)
downloadeibhear-12167f3dda4a4fc58f7aa441ad93cfa3bb446dbb.tar.gz
eibhear-12167f3dda4a4fc58f7aa441ad93cfa3bb446dbb.tar.zst
eibhear-12167f3dda4a4fc58f7aa441ad93cfa3bb446dbb.zip
fix #1268, use sudo -A, var rename
Diffstat (limited to '.local/bin/mounter')
-rwxr-xr-x.local/bin/mounter12
1 files changed, 6 insertions, 6 deletions
diff --git a/.local/bin/mounter b/.local/bin/mounter
index 38da0df..edab8af 100755
--- a/.local/bin/mounter
+++ b/.local/bin/mounter
@@ -12,11 +12,11 @@ set -e
# Check for phones.
phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/📱/")"
# Check for drives.
-alldrives="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")"
+lsblkoutput="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")"
# Get all LUKS drives
-allluks="$(echo "$alldrives" | grep crypto_LUKS)" || true
+allluks="$(echo "$lsblkoutput" | grep crypto_LUKS)" || true
# Get a list of the LUKS drive UUIDs already decrypted.
-decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")"
+decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")" || true
# Functioning for formatting drives correctly for dmenu:
filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6}' ; }
@@ -33,7 +33,7 @@ unopenedluks="$(for drive in $allluks; do
done | filter)"
# Get all normal, non-encrypted or decrypted partitions that are not mounted.
-normalparts="$(echo "$alldrives"| grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter )"
+normalparts="$(echo "$lsblkoutput"| grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter )"
# Add all to one variable. If no mountable drives found, exit.
alldrives="$(echo "$phones
@@ -59,7 +59,7 @@ case "$chosen" in
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
getmount
- sudo mount "$chosen" "$mp"
+ sudo -A mount "$chosen" "$mp"
notify-send "💾Drive Mounted." "$chosen mounted to $mp."
;;
@@ -78,7 +78,7 @@ case "$chosen" in
test -b "/dev/mapper/usb$num"
getmount
- sudo mount "/dev/mapper/usb$num" "$mp"
+ sudo -A mount "/dev/mapper/usb$num" "$mp"
notify-send "🔓Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
;;