aboutsummaryrefslogtreecommitdiffstats
path: root/nocompile/bin
diff options
context:
space:
mode:
authorEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-11-23 14:35:17 -0600
committerEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-11-23 14:35:17 -0600
commit8b1c2f7e40f9c7ae77d3afb9f3eec21886c8f060 (patch)
treec42772e9274e26eb355e828eb4ccdb21d8d3bdea /nocompile/bin
parent30300843e0c66ca3eefa97f5787f95b07c256d2f (diff)
downloadmisc-8b1c2f7e40f9c7ae77d3afb9f3eec21886c8f060.tar.gz
misc-8b1c2f7e40f9c7ae77d3afb9f3eec21886c8f060.zip
noticed mime-type, which is used by httpd, wasn't included.
Diffstat (limited to 'nocompile/bin')
-rwxr-xr-xnocompile/bin/mime-type13
1 files changed, 13 insertions, 0 deletions
diff --git a/nocompile/bin/mime-type b/nocompile/bin/mime-type
new file mode 100755
index 0000000..71982d9
--- /dev/null
+++ b/nocompile/bin/mime-type
@@ -0,0 +1,13 @@
+#!/bin/sh
+TYPE="$(file -b --mime-type $1)"
+MAIN="$(echo "${TYPE}" | cut -d/ -f1)"
+SUB="$(echo "${TYPE}" | cut -d/ -f2)"
+if [ "_${MAIN}" = "_inode" ];then
+ printf "text/plain\r\n"
+ printf "this is a directory or symlink! wtf?!?"
+ TYPE="text/plain"
+fi
+if [ "_${MAIN}" = "_text" -a "_${SUB}" != "_html"];then
+ TYPE="text/plain"
+fi
+printf "%s\r\n" "$TYPE"