chiark / gitweb /
add source download feature
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 20 Feb 2012 14:46:25 +0000 (14:46 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 20 Feb 2012 14:46:25 +0000 (14:46 +0000)
cgi

diff --git a/cgi b/cgi
index 96282376aabff29acc3ff6421d20df427acd574c..c80e5f921b5621673cd8fa73db9bc0f0e05e08b4 100755 (executable)
--- a/cgi
+++ b/cgi
@@ -379,6 +379,26 @@ if (param('debug')) {
     print "Content-Type: text/plain\n\n";
 }
 
+sub source_tarball ($$) {
+    my ($spitoutfn) = @_;
+}
+
+if (path_info() =~ m/\.tar\.gz$/) {
+    print "Content-Type: application/octet-stream\n\n";
+
+    exec '/bin/sh','-c','
+               (
+                git-ls-files -z;
+                git-ls-files -z --others --exclude-from=.gitignore;
+                if test -d .git; then find .git -print0; fi
+               ) | (
+                cpio -Hustar -o --quiet -0 -R 1000:1000 || \
+                cpio -Hustar -o --quiet -0
+               ) | gzip
+       ';
+    die $!;
+}
+
 our @navsettings;
 
 @navsettings= ();
@@ -564,3 +584,13 @@ foreach my $group (@{ $section_groups{$section} }) {
     print "</a>\n";
 }
 
+my $homeurl =
+    'http://www.chiark.greenend.org.uk/ucgi/~ijackson/git/rrd-graphs/';
+print <<END
+<hr>Generated by "<a href="$homeurl">rrd-graphs</a>".
+Copyright 2010,2012 Ian Jackson.  There is <strong>NO WARRANTY</strong>.
+Available under the Affero Public General Licence, version 3 or any
+later version.  You may download the
+<a href="$self/rrd-graphs.tar.gz">source code</a>
+for the version currently running here.
+END