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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#! /bin/sh
###############################################################################
#
# This file is an executable that demonstrates some methods for creating
# new entries in the /etc/mailcap file. More information is available from
# the 'install-mime' man page.
#
# This was written by Brian White <bcwhite@pobox.com> and has been placed
# in the public domain.
#
###############################################################################
# It's probably a good idea to put an "if" around this so it will work
# even if the mime-support package is not installed
if [ -x /usr/sbin/install-mime ]
then
# A really basic way to access text files
install-mime --install --package=mime-support --content=text/plain \
--description="Plain ASCII Text" --textualnewlines=t \
--view=more --compose="ae %s" --edit="ae %s" --needsterminal=t \
--comment="Make sure this entry is last in the priority list!"
# Viewing debian packages (under XWindows) will list their files in a window
install-mime --install --package=mime-support --content=application/x-debian-package \
--description="A Debian Package" --nametemplate="%s.deb" \
--test='test -n "$DISPLAY"' \
--view='/usr/bin/X11/xterm -T "Debian Package" -e /bin/sh -c "/usr/lib/mime/debian-view %s"'
# Viewing debian packages will list their files to stdout (put _after_ above)
install-mime --install --package=mime-support --content=application/x-debian-package \
--view="/usr/lib/mime/debian-view %s" --needsterminal=t \
--comment="This entry should appear after any entries with test conditions. \
Otherwise, none of the others will ever get a chance to run."
# Some basic "xv" commands
install-mime --install --package=xv --content=image/gif \
--description="GIF Image" --nametemplate="%s.gif" \
--test='test -n "$DISPLAY"' \
--view="/usr/bin/X11/xv %s"
install-mime --install --package=xv --content=image/jpeg \
--description="JPEG Image" --nametemplate="%s.jpg" \
--test='test -n "$DISPLAY"' \
--view="/usr/bin/X11/xv %s"
fi
|