lots of updates, server support in progress
[distro-setup] / homepage-setup
1 #!/bin/bash -l
2 # Copyright (C) 2016 Ian Kelling
3 # This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
4
5 # lj is test server
6 case $HOSTNAME in
7 lj)
8 domain=iankelling.org
9 ;;
10 lk)
11 domain=iank.bid
12 ;;
13 esac
14
15
16 # debian has the package gitweb, which seems to mainly
17 # have some example apache config, and a minimal gitweb config.
18 # I'll just use the config as example and not use the package.
19 # It's example apache config seems to say we can use cgi or cgid,
20 # and googling cgid it seems a newer faster alternative.
21 s a2enmod cgid
22
23 s dd of=/etc/gitweb.conf <<EOF
24 \$projectroot = "$gitroot";
25 # not documented at https://git-scm.com/docs/gitweb.conf,
26 # but it's in the debian conf, so use it.
27 # directory to use for temp files.
28 \$git_temp = "/tmp";
29 EOF
30
31
32 git_root=/a/bin/githtml
33
34
35 apache-site - $domain <<EOF
36 # to run python script on my site:
37 <Directory /var/www/$domain/html>
38 # to run python scripts with cgi
39 Options +ExecCGI
40 AddHandler cgi-script .py
41 </Directory>
42
43
44 # All below is for gitweb + git-http-web.
45 # A simple builtin way to have a read only git website.
46 # I didn't find any significantly better alternatives out there.
47 SetEnv GIT_PROJECT_ROOT $gitroot
48 SetEnv GIT_HTTP_EXPORT_ALL
49
50 # note: cgi scripts can go anywhere into the filesystem,
51 # so there is no need to do a directory block for $gitroot
52
53 # fot git-http-web
54 <Directory /usr/lib/git-core>
55 AllowOverride None
56 Require all granted
57 </Directory>
58
59 <Directory /usr/share/gitweb>
60 Options +FollowSymLinks +ExecCGI
61 AddHandler cgi-script .cgi
62 </Directory>
63
64 # from man-git-http-backend, so git-http-web ang gitweb can both be used.
65 # it is instead of this:
66 # #ScriptAlias / /usr/lib/git-core/git-http-backend/
67 ScriptAliasMatch \\
68 "(?x)^/git/(.*/(HEAD | \\
69 info/refs | \\
70 objects/(info/[^/]+ | \\
71 [0-9a-f]{2}/[0-9a-f]{38} | \\
72 pack/pack-[0-9a-f]{40}\\.(pack|idx)) | \\
73 git-(upload|receive)-pack))\$" \\
74 /usr/lib/git-core/git-http-backend/\$1
75
76
77
78 # man-git-http-backend claims we should do this, but
79 # it causes no css/images to be displayed. Instead,
80 # just stick with the standard gitweb example directive
81 # from debian.
82 #ScriptAlias /git /usr/share/gitweb/gitweb.cgi/
83 Alias /git /usr/share/gitweb
84 EOF