dmenumount: cleanup
This commit is contained in:
parent
b1edd86b46
commit
54daad2bd1
1 changed files with 37 additions and 31 deletions
|
@ -76,39 +76,45 @@ attemptmount() {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$chosen" in
|
case "$chosen" in
|
||||||
*)
|
*)
|
||||||
chosen="${chosen%% *}"
|
chosen="${chosen%% *}"
|
||||||
chosen="${chosen:1}" # This is a bashism.
|
chosen="${chosen:1}" # This is a bashism.
|
||||||
attemptmount || getmount
|
parttype="$(echo "$lsblkoutput" | grep "$chosen"a)"
|
||||||
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
|
attemptmount || getmount
|
||||||
notify-send " Drive Mounted." "$chosen mounted to $mp."
|
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%% *}"
|
||||||
chosen="${chosen:1}" # This is a bashism.
|
chosen="${chosen:1}" # This is a bashism.
|
||||||
# Number the drive.
|
# Number the drive.
|
||||||
while true; do
|
while true; do
|
||||||
[ -f "/dev/mapper/usb$num" ] || break
|
[ -f "/dev/mapper/usb$num" ] || break
|
||||||
num="$(printf "%02d" "$((num + 1))")"
|
num="$(printf "%02d" "$((num + 1))")"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Decrypt in a terminal window
|
# Decrypt in a terminal window
|
||||||
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
|
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
|
||||||
# Check if now decrypted.
|
# Check if now decrypted.
|
||||||
test -b "/dev/mapper/usb$num"
|
test -b "/dev/mapper/usb$num"
|
||||||
|
|
||||||
attemptmount || getmount
|
attemptmount || getmount
|
||||||
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
|
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 " Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
notify-send "❗Note" "Remember to allow file access on your phone now."
|
notify-send " Note" "Remember to allow file access on your phone now."
|
||||||
getmount
|
getmount
|
||||||
number="${chosen%%:*}"
|
number="${chosen%%:*}"
|
||||||
number="${chosen:1}" # This is a bashism.
|
number="${chosen:1}" # This is a bashism.
|
||||||
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
|
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 " Android Mounted." "Android device mounted to $mp."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue