From 655c9ffcf612b1fbba37c7e5fde46ac87cdcd3ae Mon Sep 17 00:00:00 2001 From: Inlife <60576127+Inlife-raphael@users.noreply.github.com> Date: Sat, 12 Nov 2022 18:09:21 +0100 Subject: [PATCH] fix: raise error when android not mounted --- .local/bin/dmenumount | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.local/bin/dmenumount b/.local/bin/dmenumount index abeb0ce5..65f00c0b 100755 --- a/.local/bin/dmenumount +++ b/.local/bin/dmenumount @@ -31,13 +31,19 @@ mountusb() { \ notify-send "💻 USB mounting" "$chosen mounted to $mp." } +androidcrash() { \ + notify-send "🚫 Error" "Failed to mount Android device to $mp." + namei -l "$mp" | sed '1d' | awk '{ print $2 }' | grep $(whoami) || notify-send "⚠️ Error complement" "You probably chose a directory for which you do not have the rights" + exit 1 + } + mountandroid() { \ chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 chosen="$(echo "$chosen" | cut -d : -f 1)" getmount "$HOME -maxdepth 3 -type d" simple-mtpfs --device "$chosen" "$mp" echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 - simple-mtpfs --device "$chosen" "$mp" + simple-mtpfs --device "$chosen" "$mp" || androidcrash notify-send "🤖 Android Mounting" "Android device mounted to $mp." }