diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2023-02-17 11:01:07 -0500 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2023-02-17 11:01:07 -0500 |
| commit | b04d4c9ac83ecf8a5f26ec85e368ed234ca52eec (patch) | |
| tree | ce49c6f04142f8c974a2438ac7a21f7a464886da /.local/bin/mounter | |
| parent | a2e767e4f4224cb74b2159833bec598e2e9b72e2 (diff) | |
| download | eibhear-b04d4c9ac83ecf8a5f26ec85e368ed234ca52eec.tar.gz eibhear-b04d4c9ac83ecf8a5f26ec85e368ed234ca52eec.tar.zst eibhear-b04d4c9ac83ecf8a5f26ec85e368ed234ca52eec.zip | |
mounter improvements, old scripts removed
now checks fstab for info, also one less android prompt
Diffstat (limited to '.local/bin/mounter')
| -rwxr-xr-x | .local/bin/mounter | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/.local/bin/mounter b/.local/bin/mounter index 059043b..3b2a314 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -4,7 +4,7 @@ # replace the older `dmenumount` which had extra steps and couldn't handle # encrypted drives. # TODO: Remove already mounted Android phones from prompt. -# TODO: Try mount first for drives if in fstab to avoid directory prompt? +# TODO: Try decrypt for drives in crtypttab # TODO: Add some support for connecting iPhones (although they are annoying). set -e @@ -54,11 +54,18 @@ getmount(){ fi } +attemptmount(){ + # Attempt to mount without a mountpoint, to see if drive is in fstab. + sudo -A mount "$chosen" || return 1 + notify-send "💾Drive Mounted." "$chosen mounted." + exit +} + case "$chosen" in 💾*) chosen="${chosen%% *}" chosen="${chosen:1}" # This is a bashism. - getmount + attemptmount || getmount sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" notify-send "💾Drive Mounted." "$chosen mounted to $mp." ;; @@ -77,14 +84,14 @@ case "$chosen" in # Check if now decrypted. test -b "/dev/mapper/usb$num" - getmount + attemptmount || getmount sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)" notify-send "🔓Decrypted drive Mounted." "$chosen decrypted and mounted to $mp." ;; 📱*) + notify-send "❗Note" "Remember to allow file access on your phone now." getmount - echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" chosen="${chosen%%:*}" chosen="${chosen:1}" # This is a bashism. sudo -A simple-mtpfs -o allow_other --device "$chosen" "$mp" |
