more infrastructure
authorRudolf Polzer <divverent@alientrap.org>
Sat, 20 Nov 2010 17:38:59 +0000 (18:38 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 20 Nov 2010 17:38:59 +0000 (18:38 +0100)
misc/infrastructure/mirror/crontab.part [new file with mode: 0644]
misc/infrastructure/mirror/etc::svc::git-daemon::run [new file with mode: 0755]
misc/infrastructure/mirror/git-mirror-update.sh [new file with mode: 0755]
misc/infrastructure/mirror/gitweb.cgi.patch [new file with mode: 0644]
misc/infrastructure/mirror/gitweb.conf [new file with mode: 0644]
misc/infrastructure/mirror/htttpd.conf.vhost [new file with mode: 0644]

diff --git a/misc/infrastructure/mirror/crontab.part b/misc/infrastructure/mirror/crontab.part
new file mode 100644 (file)
index 0000000..9942002
--- /dev/null
@@ -0,0 +1 @@
+*/5 * * * * gitmirror sh /root/git-mirror-update.sh
diff --git a/misc/infrastructure/mirror/etc::svc::git-daemon::run b/misc/infrastructure/mirror/etc::svc::git-daemon::run
new file mode 100755 (executable)
index 0000000..eb45073
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+exec 2>&1
+echo 'git-daemon starting.'
+exec chpst -ugitdaemon \
+  "$(git --exec-path)"/git-daemon --verbose --base-path=/var/cache/git /var/cache/git
diff --git a/misc/infrastructure/mirror/git-mirror-update.sh b/misc/infrastructure/mirror/git-mirror-update.sh
new file mode 100755 (executable)
index 0000000..87f7ea3
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+exec >/dev/null 2>&1
+
+me=/var/tmp/git-mirror-lock
+if ! lockfile-create "$me"; then
+       exit 1
+fi
+lockfile-touch "$me" & lockpid=$!
+trap 'kill $lockpid || true; cd "$mepwd"; lockfile-remove "$me"' EXIT
+trap 'exit 1' INT TERM
+
+mkdir -p /var/cache/git/xonotic
+cd /var/cache/git/xonotic
+ssh xonotic@git.xonotic.org ./send-git-configs.sh | tar xvf -
+
+for X in /var/cache/git/*/*.git; do
+       cd "$X"
+       git config remote.origin.fetch "+refs/*:refs/*"
+       git config remote.origin.mirror "true"
+       git config remote.origin.url "git://git.xonotic.org/${X#/var/cache/git/}"
+       git fetch
+       git remote prune origin
+       git gc --auto
+       touch git-daemon-export-ok
+done
diff --git a/misc/infrastructure/mirror/gitweb.cgi.patch b/misc/infrastructure/mirror/gitweb.cgi.patch
new file mode 100644 (file)
index 0000000..8bf03f9
--- /dev/null
@@ -0,0 +1,20 @@
+# TODO: turn this into a REAL diff
+# what we did: we added the line with &#64; stuff
+
+# replace invalid utf8 character with SUBSTITUTION sequence
+sub esc_html {
+       my $str = shift;
+       my %opts = @_;
+
+       return undef unless defined $str;
+
+       $str = to_utf8($str);
+       $str = $cgi->escapeHTML($str);
+       $str =~ s/@/&#64;/g;
+       if ($opts{'-nbsp'}) {
+               $str =~ s/ /&nbsp;/g;
+       }
+       $str =~ s|([[:cntrl:]])|(($1 ne "\t") ? quot_cec($1) : $1)|eg;
+       return $str;
+}
+
diff --git a/misc/infrastructure/mirror/gitweb.conf b/misc/infrastructure/mirror/gitweb.conf
new file mode 100644 (file)
index 0000000..570bb0d
--- /dev/null
@@ -0,0 +1,60 @@
+# path to git projects (<project>.git)
+$projectroot = "/var/cache/git";
+
+# directory to use for temp files
+$git_temp = "/tmp";
+
+# target of the home link on top of all pages
+#$home_link = $my_uri || "/";
+
+# html text to include at home page
+$home_text = "indextext.html";
+
+# file with project list; by default, simply scan the projectroot dir.
+$projects_list = $projectroot;
+
+# stylesheet to use
+$stylesheet = "/gitweb/gitweb.css";
+
+# logo to use
+$logo = "/gitweb/git-logo.png";
+
+# the 'favicon'
+$favicon = "/gitweb/git-favicon.png";
+
+$feature{'blame'}{'override'} = 1;
+$feature{'blame'}{'default'} = [1];
+
+$feature{'snapshot'}{'override'} = 1;
+$feature{'snapshot'}{'default'} = [0];
+
+$feature{'search'}{'default'} = [0];
+
+$feature{'grep'}{'override'} = 1;
+$feature{'grep'}{'default'} = [0];
+
+$feature{'pickaxe'}{'override'} = 1;
+$feature{'pickaxe'}{'default'} = [0];
+
+$feature{'show-sizes'}{'override'} = 1;
+$feature{'show-sizes'}{'default'} = [1];
+
+$feature{'pathinfo'}{'default'} = [0];
+
+$feature{'forks'}{'default'} = [1];
+
+$feature{'actions'}{'default'} = [
+       ("merge-request", "http://nl.git.xonotic.org/merge-request/?n=%n&h=%h&hb=%b", "tree")
+];
+
+$feature{'ctags'}{'default'} = [0];
+
+$feature{'patches'}{'override'} = 0;
+$feature{'patches'}{'default'} = [64];
+
+$feature{'avatar'}{'override'} = 0;
+$feature{'avatar'}{'default'} = [''];
+
+$feature{'timed'}{'default'} = [0];
+
+$feature{'javascript-actions'}{'default'} = [1];
diff --git a/misc/infrastructure/mirror/htttpd.conf.vhost b/misc/infrastructure/mirror/htttpd.conf.vhost
new file mode 100644 (file)
index 0000000..e08814a
--- /dev/null
@@ -0,0 +1,19 @@
+<VirtualHost *:80>
+
+ServerName de.git.xonotic.org
+SetEnv GIT_PROJECT_ROOT /var/cache/git
+AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$          /var/cache/git/$1
+AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/cache/git/$1
+ScriptAliasMatch \
+       "(?x)^/(.*/(HEAD | \
+                      info/refs | \
+                      objects/info/[^/]+ | \
+                      git-(upload|receive)-pack))$" \
+       /usr/lib/git-core/git-http-backend/$1
+
+DocumentRoot /var/www-gitweb/
+Options FollowSymLinks +ExecCGI
+AddHandler cgi-script .cgi
+Alias /gitweb /var/www-gitweb/
+
+</VirtualHost>