update-pub...contenttype(1)

πŸ“¦ version 0.52, in ubuntu resolute, ubuntu stonking

🌸 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 🫢


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