diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2006-08-25 21:18:40 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2006-08-25 21:18:40 +0000 |
commit | 4c9d74f170569a4cc2b174c230e23b369a4137e4 (patch) | |
tree | 9f6154c6d3196f9807331bd03d65392dfc7af580 /sitesummary-collector.cgi | |
parent | 53ab2a79f7baafe50c333bdafc1aebcab32465dc (diff) | |
download | sitesummary-4c9d74f170569a4cc2b174c230e23b369a4137e4.tar.gz sitesummary-4c9d74f170569a4cc2b174c230e23b369a4137e4.tar.bz2 sitesummary-4c9d74f170569a4cc2b174c230e23b369a4137e4.tar.xz |
Unpack the tarball.
Diffstat (limited to 'sitesummary-collector.cgi')
-rw-r--r-- | sitesummary-collector.cgi | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sitesummary-collector.cgi b/sitesummary-collector.cgi index 26e00f3..6f1a10c 100644 --- a/sitesummary-collector.cgi +++ b/sitesummary-collector.cgi @@ -13,7 +13,7 @@ use Socket; my $basedir = "/var/lib/sitesummary"; -$ENV{PATH}=""; +$ENV{PATH} = "/bin:/usr/bin"; print "Content-Type: text/plain\n\n"; if (exists $ENV{REQUEST_METHOD} && $ENV{REQUEST_METHOD} ne "POST") @@ -72,6 +72,7 @@ if ($filename =~ m/.tar.gz$/) { die "Unhandled file type '$filename'" } +# XXX Come up with some unique file name. my $savefile = "$basedir/tmpstorage/$peeripaddr-$timestamp-$filename"; open(SITESUMMARY, ">$savefile") or die "Unable to write to $savefile"; @@ -81,8 +82,18 @@ close SITESUMMARY; print "Thanks for your submission to site-summary!\n"; print "SITESUMMARY HTTP-POST OK\n"; +process_entry($savefile); + exit 0; +sub process_entry { + my $filename = shift; + if ($filename =~ m/(.+).tar.gz$/) { + mkdir $1; + chdir $1; + `tar zxf $filename`; + } +} sub get_peerinfo { my $sockethandle = shift; |