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