| 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | set -x |
| 5 | |
| 6 | # Set hostname to match certificates |
| 7 | echo "Hostname = \"$(hostname -f)\"" >> /etc/molly-brown/localhost.conf |
| 8 | |
| 9 | # Create links for SSL certificate and key |
| 10 | mkdir --parents /etc/molly-brown/certs |
| 11 | ln --symbolic --force /etc/ssl/certs/ssl-cert-snakeoil.pem \ |
| 12 | /etc/molly-brown/certs/localhost.crt |
| 13 | ln --symbolic --force /etc/ssl/private/ssl-cert-snakeoil.key \ |
| 14 | /etc/molly-brown/certs/localhost.key |
| 15 | |
| 16 | # Create gemtext documents |
| 17 | mkdir --parents /var/lib/molly-brown |
| 18 | cat > /var/lib/molly-brown/test.gmi <<EOF |
| 19 | # Gemtext example |
| 20 | |
| 21 | This is an example of gemtext. |
| 22 | |
| 23 | ## List example |
| 24 | |
| 25 | * Item 1 |
| 26 | * Item 2 |
| 27 | |
| 28 | ## Quote example |
| 29 | |
| 30 | > Hello, world. |
| 31 | EOF |
| 32 | |
| 33 | mkdir --parents /var/lib/molly-brown/users/molly |
| 34 | cat > /var/lib/molly-brown/users/molly/test.gmi <<EOF |
| 35 | # Example using HomeDocBase |
| 36 | |
| 37 | This document is accessed through ~/molly/test.gmi path. |
| 38 | EOF |
| 39 | |
| 40 | # Start server |
| 41 | systemctl enable molly-brown@localhost |
| 42 | systemctl start molly-brown@localhost |
| 43 | sleep 10 |
| 44 | |
| 45 | # Get various documents and folder listings |
| 46 | for i in / /test.gmi /~/ /~/molly/ /~/molly/test.gmi |
| 47 | do |
| 48 | url="gemini://$(hostname -f)$i" |
| 49 | echo |
| 50 | echo "Get $url" |
| 51 | echo "$url" | ncat --ssl localhost 1965 || exit 1 |
| 52 | done |