UPDATE-MIME(8)

πŸ“¦
version 3.77ubuntu1 Β· 3 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– update-mime(8) β€” the bestie guide πŸ’–

okay so you found your way to update-mime, part of the Update MIME Programs crew, and honestly? she's a little icon. let's get into it πŸŽ€


✨ NAME ✨

update-mime β€” create or update MIME information. that's it, that's the whole vibe πŸ¦‹


✨ SYNOPSIS ✨

update-mime [no parameters]

yes bestie, she takes literally no parameters. she simply is πŸ’…


✨ DESCRIPTION ✨

so here's the tea: update-mime updates the /etc/mailcap file so it reflects whatever mime info got changed by a Debian package during installation or removal. package moves, mailcap follows. periodt. 🌸

OPTIONS

  • --local β€” generate files in the current user's home directory instead of the /etc directory. this is the "main character in my own home dir" mode ✨ it lets users create a custom ordering configuration and get a complete ~/.mailcap file out of it. and in this local mode? the order overriding file (peep below πŸ‘‡) gets looked for in the ~/.mailcap.order file instead. no cap.

✨ OVERRIDING ORDER ✨

you can alter the order of entries in /etc/mailcap by editing the /etc/mailcap.order file. want the full lore? go read the mailcap.order(5) man page. iykyk πŸ’œ


✨ CREATING ENTRIES ✨

to create entries in the mailcap file, packages need to create a file in the /usr/lib/mime/packages directory. in that file goes the verbatim desired mailcap entries. and in addition to the standard mailcap options (described below, don't worry 🫢) there's a brand new priority option. specifying it gives you simple ranking of programs within a given mime type. like, imagine an animation viewer β€” she may be able to display a static picture, but honestly she probably wouldn't be the best choice for that, so you'd give her something like "priority=2". priorities range from 0 to 9, with 0 being the lowest and 9 being the highest. if you omit the priority option entirely, a value of 5 is used. default queen πŸ‘‘

the following are standard options that can be specified in the mailcap entry. options are separated by semicolons (;) but they must all be on the same line. each line should look like:

mime/type; viewer; option; another=val; etc; priority=5

mime types of the form "class/*" and even "*/*" are now acceptable (they were previously disallowed, wild right?). when using "class/*", it's probably a good idea to add a "priority=[1-4]" option so specific rules using the default priority get chosen first. if you're using "*/*" though, you probably want to add a "priority=0" option to make that rule a total "last resort". πŸ’€

Commands

  • <program-string> β€” specifies the program to run to view a file of the given content-type. this one cannot be omitted, bestie, it's required. you can consider an implicit "view=" before it. and when you're writing an entry that has no viewer? use a value of false in this space. simple as that 🌈
  • compose=<program-string> β€” the "compose" command may be used to specify a program that can be used to compose a new body or body part in the given format. its intended use is to support mail composing agents that support the composition of multiple types of mail using external composing agents. heads up though: the result of the composing program may be data that is not yet suitable for mail transport β€” meaning a Content-Transfer-Encoding may need to be applied to the data. plot twist 😭
  • composetyped=<program-string> β€” the "composetyped" command is similar to "compose", but it's for when the composing program needs to specify the Content-type header field to be applied to the composed data. the "compose" option is simpler and is preferred for use with existing (non-mail-oriented) programs for composing data in a given format. the "composetyped" option is necessary when the Content-type information must include auxiliary parameters, and the composition program must then know enough about mail formats to produce output that includes the mail type information. she's the more complicated sister, but sometimes you need her πŸ’…
  • edit=<program-string> β€” the "edit" command may be used to specify a program that can be used to edit a body or body part in the given format. in many cases, it may be identical in content to the "compose" command. twins fr fr πŸ‘―
  • print=<program-string> β€” the "print" command may be used to specify a program that can be used to print a message or body part in the given format. πŸ–¨οΈ

Modifiers

these options are modifiers to all the commands specified on the command line. they're the accessories that go with every outfit ✨

  • test=<conditional> β€” the "test" option may be used to test some external condition (e.g., the machine architecture, or the window system in use) to determine whether or not the mailcap line applies. it specifies a program to be run to test some condition. if the test fails, a subsequent mailcap entry will be sought. multiple test options are not permitted β€” since a test can call a program, it can already be arbitrarily complex. no stacking tests, babe 🚫
Note: when testing for X by looking at the DISPLAY environment variable, please use one of: test=test -z "$DISPLAY" (no X) or test=test -n "$DISPLAY" (have X) many programs recognize these strings and optimize for them. so like, use the format bestie, they'll love you for it πŸ’–
  • needsterminal β€” the "needsterminal" option, if given, indicates that the commands must be run on an interactive terminal. this is needed to inform window-oriented user agents that an interactive terminal is needed. (the decision is not left exclusively to the command because in some circumstances it may not be possible for such programs to tell whether or not they are on interactive terminals.) the needsterminal command applies to the view, compose and edit commands, if they exist. note that this is NOT a test β€” it is a requirement for the environment in which the program will be executed, and will typically cause the creation of a terminal window when not executed on either a real terminal or a terminal window. she's a demand, not a suggestion πŸ‘‘
  • copiousoutput β€” the "copiousoutput" option, if given, indicates that the output from the view-command will be an extended stream of output and is to be interpreted as advice to the UA (User Agent mail-reading program) that the output should be either paged or made scrollable. note that it is probably a mistake if needsterminal and copiousoutput are both specified. pick a lane, bestie 😭

Content-Type Info

these options provide additional information about the given content-type. little fun facts, if you will 🌸

  • description=<string> β€” the "description" option simply provides a textual description that describes the type of data, to be used optionally by mail readers that wish to describe the data before offering to display it. it's the lil caption on the post πŸ’œ
  • textualnewlines β€” the "textualnewlines" option, if given, indicates that this type of data is line-oriented and that, if encoded in a binary format, all newlines should be converted to canonical form (CRLF) before encoding, and will be in that form after decoding. in general, this is needed only if there is line-oriented data of some type other than text/* or non-line-oriented data that is a subtype of text. niche but iconic πŸ¦‹
  • x11-bitmap=<pathname> β€” the "x11-bitmap" option names a file, in X11 bitmap (xbm) format, which points to an appropriate icon to be used to visually denote the presence of this kind of data. it's giving aesthetic πŸŽ€
  • nametemplate=<string> β€” the "nametemplate" option gives a file name format, in which %s will be replaced by a short unique string to give the name of the temporary file to be passed to the viewing command. this is only expected to be relevant in environments where filename extensions are meaningful, e.g., one could specify that a GIF file being passed to a gif viewer should have a name ending in ".gif" by using "nametemplate=%s.gif". cute, right? ✨

✨ DEPENDENCIES ✨

packages that wish to provide MIME access to themselves should not depend on, recommend, or suggest mime-support, as the the file they create in /usr/lib/mime/packages will cause update-mime to be automatically run via a Dpkg trigger. she shows up on her own, you don't gotta invite her πŸ’… (yes the original says "the the", we're keeping the lore intact, no editing the queen's typos πŸ™ˆ)


✨ DESKTOP ENTRIES ✨

in addition to the abovementioned mechanism, update-mime also parses desktop entries in /usr/share/applications/ to generate mailcap entries. these entries are given a priority of 5, unless they appear in one of the desktop environment /usr/share/applications/*-mimeapps.list files, in which case they get a priority of 6. this helps ensure that applications recommended as defaults for users get a higher priority than other applications that might handle the same types. main character apps get main character treatment, as they should 🌟


✨ SEE ALSO ✨

go read them, bestie, they're all part of the extended universe πŸ“š


✨ AUTHOR ✨

update-mime was written by Brian White <bcwhite@pobox.com>. king behavior πŸ‘‘


update-mime is in the public domain (the only true "free"). she belongs to the people 🫢✨


and that's the whole page, bestie!! πŸ’– this was Debian Project's UPDATE-MIME(8), dated 12th Feb 2012 β€” yeah she's an old queen but she still slays. go update some mime info, you got this πŸŒˆπŸ’…πŸŽ€

πŸ“¦ where this page comes from