3 # -*- sh -*- vim: ft=sh sw=4 sts=4
5 # /usr/local/sbin/obexd
6 # Designed to repeatedly call obexserver to receive new files, and send them
7 # off in an email to root.
10 killall obexserver >/dev/null 2>&1 || true
18 trap "sdptool del OPUSH >/dev/null || true" EXIT
20 sdptool add --channel=10 OPUSH >/dev/null
23 filename=`obexserver|grep '^Filename = '|sed -e 's/^Filename = //'`
27 *.txt) ctype=text/plain ;;
28 *.htm|*.html) ctype=text/html ;;
29 *.vcf) ctype=text/x-vcard ;;
30 *.wav) ctype=audio/x-wav ;;
31 *.mid|*.midi) ctype=audio/midi ;;
32 *.jpg|*.jpeg) ctype=image/jpeg ;;
33 *.gif) ctype=image/gif ;;
34 "WAP bookmark") ctype=text/x-url ;;
35 *.3gp) ctype=video/x-realmedia ;; # ???
36 *) ctype=application/octet-stream ;;
39 # metasend can't handle file names with spaces
40 tempfile=`mktemp -t obexd.XXXXXX`
42 text/*) tr -d '\r' < "/tmp/$filename" >> $tempfile ;;
43 *) cat "/tmp/$filename" >> $tempfile ;;
45 rm -f "/tmp/$filename"
47 metasend -b -F bluetooth -t root -s "Object received via Bluetooth" -c '' \
48 -D "$filename" -S 4000000 -m "$ctype; name=\"`echo $filename|tr ' ' '_'`\""\