From 83cd09a1f8bf60d79b0b28852c3e666fea97f87d Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 20 Nov 2010 18:38:59 +0100 Subject: [PATCH] more infrastructure --- misc/infrastructure/mirror/crontab.part | 1 + .../mirror/etc::svc::git-daemon::run | 5 ++ .../mirror/git-mirror-update.sh | 28 +++++++++ misc/infrastructure/mirror/gitweb.cgi.patch | 20 +++++++ misc/infrastructure/mirror/gitweb.conf | 60 +++++++++++++++++++ misc/infrastructure/mirror/htttpd.conf.vhost | 19 ++++++ 6 files changed, 133 insertions(+) create mode 100644 misc/infrastructure/mirror/crontab.part create mode 100755 misc/infrastructure/mirror/etc::svc::git-daemon::run create mode 100755 misc/infrastructure/mirror/git-mirror-update.sh create mode 100644 misc/infrastructure/mirror/gitweb.cgi.patch create mode 100644 misc/infrastructure/mirror/gitweb.conf create mode 100644 misc/infrastructure/mirror/htttpd.conf.vhost diff --git a/misc/infrastructure/mirror/crontab.part b/misc/infrastructure/mirror/crontab.part new file mode 100644 index 00000000..99420027 --- /dev/null +++ b/misc/infrastructure/mirror/crontab.part @@ -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 index 00000000..eb45073d --- /dev/null +++ b/misc/infrastructure/mirror/etc::svc::git-daemon::run @@ -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 index 00000000..87f7ea34 --- /dev/null +++ b/misc/infrastructure/mirror/git-mirror-update.sh @@ -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 index 00000000..8bf03f9f --- /dev/null +++ b/misc/infrastructure/mirror/gitweb.cgi.patch @@ -0,0 +1,20 @@ +# TODO: turn this into a REAL diff +# what we did: we added the line with @ 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/@/@/g; + if ($opts{'-nbsp'}) { + $str =~ s/ / /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 index 00000000..570bb0d5 --- /dev/null +++ b/misc/infrastructure/mirror/gitweb.conf @@ -0,0 +1,60 @@ +# path to git projects (.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 index 00000000..e08814af --- /dev/null +++ b/misc/infrastructure/mirror/htttpd.conf.vhost @@ -0,0 +1,19 @@ + + +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/ + + -- 2.39.2