3 # Send multiples files and/or directories as a tar/compressed
4 # image, in a MIME message.
10 # compression method (none, gzip or compress)
14 # uncompression filter
16 # compression description to append to content-type
19 # default compression method based on installed software
20 # prefer compress over gzip for backward compatibility
21 if command -v compress >/dev/null 2>&1 ; then
23 elif command -v gzip >/dev/null 2>&1 ; then
27 # handle command-line options to override compression method and delay
28 while [ $# -gt 3 ]; do
33 -compress) METHOD=compress
39 -*) DELAY="`echo $1 | sed -e 's%-%%'`"
47 # set variables based on chosen compression method
48 if [ $METHOD = compress ]; then
51 CONVERSION="; x-conversions=compress"
52 elif [ $METHOD = gzip ]; then
55 CONVERSION="; x-conversions=gzip"
58 if [ ! -z "$PERSON" ]; then
63 echo 'usage: sendfiles: "mailpath" "subject-string" directory-or-file ...' 1>&2
68 echo "mailpath = $mailpath" 1>&2
72 echo "subject-string = $subject" 1>&2
75 echo "files = $*" 1>&2
77 tar cvf - "$@" | $COMPRESS | \
78 %libdir%/viamail -to "$mailpath" -subject "$subject" \
79 -parameters "type=tar$CONVERSION" \
80 -comment "extract with $UNCOMPRESS | tar xvpf -" \