1
0
Fork 0

dmenumount: cleanup

This commit is contained in:
Luca Bilke 2025-02-02 13:01:38 +01:00
parent b1edd86b46
commit 54daad2bd1
Signed by: luca
GPG key ID: C9E851809C1A5BDE

View file

@ -76,39 +76,45 @@ attemptmount() {
}
case "$chosen" in
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
attemptmount || getmount
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send " Drive Mounted." "$chosen mounted to $mp."
;;
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
parttype="$(echo "$lsblkoutput" | grep "$chosen"a)"
attemptmount || getmount
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
case "${parttype##* }" in
vfat) sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;;
btrfs) sudo -A mount "$chosen" "$mp" ;;
*) sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;;
esac
notify-send " Drive Mounted." "$chosen mounted to $mp."
;;
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num + 1))")"
done
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num + 1))")"
done
# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"
# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"
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."
;;
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
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send " Android Mounted." "Android device mounted to $mp."
;;
*)
notify-send "󱈸 Note" "Remember to allow file access on your phone now."
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send " Android Mounted." "Android device mounted to $mp."
;;
esac