about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xcacophony.sh36
-rw-r--r--lighttpd.conf12
-rw-r--r--makefile2
-rw-r--r--readme7
-rwxr-xr-xsource/index8
5 files changed, 65 insertions, 0 deletions
diff --git a/cacophony.sh b/cacophony.sh new file mode 100755 index 0000000..7cf4dc3 --- /dev/null +++ b/cacophony.sh
@@ -0,0 +1,36 @@
1#!/bin/sh
2
3SCRIPTDIR=source
4
5crlf() { # crlf < INPUT
6 ## Convert LF to CRLF
7 sed 's/$/ /g'
8}
9
10header() { # header [STATUS]
11 cat <<HEADER | crlf
12HTTP/1.1 ${1:-200}
13Content-Type: text/html;charset=utf-8
14
15HEADER
16}
17
18hexec() { # hexec PROGRAM [header args]
19 prog="$1"; shift
20 header "$@"
21 exec "$prog"
22}
23
24run() {
25 if test / = "$PATH_INFO"
26 then PATH_INFO=/index run
27 else
28 path="$PWD/$SCRIPTDIR$PATH_INFO"
29 if ! test -d "$path" && test -x "$path"
30 then hexec "$path" 200
31 else header 404
32 fi
33 fi
34}
35
36run
diff --git a/lighttpd.conf b/lighttpd.conf new file mode 100644 index 0000000..cfd14f2 --- /dev/null +++ b/lighttpd.conf
@@ -0,0 +1,12 @@
1server.document-root = "/home/acdw/src/cacophony"
2server.port = 3030
3server.username = "acdw"
4server.groupname = "acdw"
5
6index-file.names = ( "index.html", "cacophony.sh" )
7
8server.modules += ( "mod_cgi", "mod_rewrite" )
9cgi.assign = ( ".sh" => "" )
10url.rewrite-if-not-file = ( "" => "/cacophony.sh${url.path}${qsa}" )
11
12mimetype.assign += ( "" => "text/plain;charset=utf-8" ) \ No newline at end of file
diff --git a/makefile b/makefile new file mode 100644 index 0000000..b783d07 --- /dev/null +++ b/makefile
@@ -0,0 +1,2 @@
1serve: cacophony.sh lighttpd.conf
2 lighttpd -D -f lighttpd.conf
diff --git a/readme b/readme new file mode 100644 index 0000000..45b6535 --- /dev/null +++ b/readme
@@ -0,0 +1,7 @@
1CACOPHONY
2"Every page a program"
3
4This repo contains *cacophony.sh*, a CGI script that will run every script in
5the source/ directory as a CGI script to display a page.
6
7This is probably a bad idea. It originated mostly on tilde.town. \ No newline at end of file
diff --git a/source/index b/source/index new file mode 100755 index 0000000..1b870b4 --- /dev/null +++ b/source/index
@@ -0,0 +1,8 @@
1#!/bin/sh
2# -*- markdown -*-
3echo "<!DOCTYPE html>";pandoc <<EOF;echo "</body></html>"
4
5# Every page a program
6## an exciting new experiment in web development
7
8Er, not really, lol. This is a plain CGI script with shit tacked on. Anyway ...