-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmntdroid
More file actions
executable file
·28 lines (24 loc) · 763 Bytes
/
Copy pathmntdroid
File metadata and controls
executable file
·28 lines (24 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
MTPT="/mnt/droid"
f_umnt=0
while getopts "u" arg; do
case "${arg}" in
u) f_umnt=1 ;;
*) echo "usage: ${0##*/} [-u]" 1>&2 && exit 1 ;;
esac
done
if [ ${f_umnt} -ne 1 ]; then
avail="$(jmtpfs -l | sed 1,2d)"
test -z "${avail}" && echo "No devices found" | nfy && exit 1
dev="$(jmtpfs -l | sed '1,2d' | dmenu -i -p "Available devices" |
sed 's/,//g' | awk '{print $1","$2}')"
mp="${MTPT}/$(echo ${dev} | cut -f1 -d',')"
mkdir -p "${mp}"
jmtpfs -device="${dev}" -o allow_other "${mp}" |
dmenu -p "Tap allow on your phone" || exit 1
jmtpfs -device="${dev}" -o allow_other "${mp}" && echo "Mounted: ${mp}" | nfy
else
mp="${MTPT}/$(ls ${MTPT} | dmenu -i -p "Unmount device")"
umount "${mp}" && echo "Unmounted: ${mp}" | nfy
rm -rf "${mp}"
fi