|
Added
Link Here
|
| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Intended for use with /etc/auto_master containing |
| 4 |
# /mtp -simple-mtpfs -allow_other |
| 5 |
# |
| 6 |
|
| 7 |
out=$(%%PREFIX%%/bin/simple-mtpfs --list-devices 2>&1) |
| 8 |
[ $? -eq 0 ] || exit 1 |
| 9 |
|
| 10 |
# replace disallowed characters (see usr.sbin/autofs/token.l) |
| 11 |
out=$(echo "$out" | sed 's/: /:/; y/ #/_+/' | sort -u) |
| 12 |
|
| 13 |
if [ $# -eq 0 ]; then |
| 14 |
echo "$out" | sed 's/[^:]*://' | sort -u |
| 15 |
exit 0 |
| 16 |
fi |
| 17 |
|
| 18 |
devno=$(echo "$out" | (fgrep "$1" || echo 0) | sed 's/:.*//') |
| 19 |
[ $devno -gt 0 ] || exit 1 |
| 20 |
|
| 21 |
echo "/ -fstype=none,--device=$devno,mountprog=%%PREFIX%%/bin/simple-mtpfs :none" |