update-pub...contenttype(1)
πΈ update-pub...contenttype(1) πΈ
okay bestie, you typed man update-pub...contenttype and the terminal gave you this, so let's get into it π This is the General Commands Manual page for a lil script that makes publicfile smarter about MIME types, and yes it's niche, and yes it still slays.
β¨ NAME β¨
update-publicfile-contenttype β generate a CT-style envdir from mime.types formatted input π
π SYNOPSIS π
update-publicfile-contenttype directory
π¦ DESCRIPTION π¦
so like, update-publicfile-contentype (that's literally how it's spelled in the original, I am not fixing it, we do not edit the source in this house π
) generates a CT-style envdir under directory, built from /etc/mime.types formatted input that it reads on stdin.
the file /etc/mime.types is described by Brian White and others, and development on it started way back in the late 1990s. iconic longevity fr fr π
so say /etc/mime.types has a line like image/jpeg jpeg jpg β then this script would create the files CT_jpeg, CT_jpg, CT_JPEG and CT_JPG in directory, and all of them contain image/jpeg as the first line. four files, one vibe π«Ά
now the plot twist β¨ β if publicfile with Uwe Ohse's filetype patch (e.g. as shipped with the publicfile package for Debian) runs into an unknown file extension .ext, envdir goes looking for a file called CT_ext. and if that file exists? publicfile uses its first line as the MIME type. that's the whole trick, no cap π
π USAGE π
call this script like e.g.
update-publicfile-contenttype /etc/publicfile/mime \
</etc/mime.type
to make publicfile actually use the generated envdir under /etc/publicfile/mime, you go adjust /etc/publicfile/httpd/run: replace the last two words (which are likely "httpd /etc/publicfile/file") with "envdir /etc/publicfile/mime httpd /etc/publicfile/file". swap those words, that's it, glow up complete β¨
so the complete file /etc/publicfile/httpd/run could e.g. look like
#!/bin/sh
exec 2>&1
exec envuidgid www-data softlimit -o20 -d100000 \
tcpserver -vDRHl0 -b50 -c100 0 80 \
envdir /etc/publicfile/mime httpd /etc/publicfile/file
look at that. main character energy honestly π
π BUGS π
ngl bestie, this is the part where we hold hands π«Ά
the script does not do any error checking. none. zero.
if the needed permissions are lacking, the behaviour is undefined β that's not me being dramatic, that's the manpage being dramatic, and it's right π
also: the script ignores and possibly overwrites any CT_ext files that are already sitting there. so if you had some, uh, they may simply cease to exist. be aware π
π AUTHOR π
Written by Joost van Baal-IliΔ. π
No copyright is claimed. the update-publicfile-contenttype code and this manpage are in the public domain; do with it what you wish. genuinely so generous, we love to see it π«Ά
π«Ά SEE ALSO π«Ά
- A description of Uwe Ohse's filetype patch by Cliff L. Biffle:
https://cliffle.com/blog/publicfile-patches/πΈ - The authors publicfile website:
http://mdcc.cx/publicfile/π¦
and that's the whole page, bestie!! β¨ this one ships as part of publicfile 0.52-10, and the page itself is dated 2017-10-11 π go forth and generate those CT-style envdirs, you've absolutely got this ππ
π¦ where this page comes from
- ubuntu resolute: publicfile 0.52-14 Β· LicenseRef-public-domain
- ubuntu stonking: publicfile 0.52-15 Β· LicenseRef-public-domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms