diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2006-08-25 21:28:47 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2006-08-25 21:28:47 +0000 |
commit | 5412cc862084b5b293dacfd159997617ada97b7c (patch) | |
tree | 77fd2ea46384f45c8d0c6164c54e7ada2ab05571 | |
parent | 4c9d74f170569a4cc2b174c230e23b369a4137e4 (diff) | |
download | sitesummary-5412cc862084b5b293dacfd159997617ada97b7c.tar.gz sitesummary-5412cc862084b5b293dacfd159997617ada97b7c.tar.bz2 sitesummary-5412cc862084b5b293dacfd159997617ada97b7c.tar.xz |
Trivial storage system using ethernet mac address.
-rw-r--r-- | sitesummary-collector.cgi | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sitesummary-collector.cgi b/sitesummary-collector.cgi index 6f1a10c..b73403c 100644 --- a/sitesummary-collector.cgi +++ b/sitesummary-collector.cgi @@ -88,11 +88,24 @@ exit 0; sub process_entry { my $filename = shift; + my $dirname; if ($filename =~ m/(.+).tar.gz$/) { - mkdir $1; - chdir $1; + $dirname = $1; + mkdir $dirname; + chdir $dirname; `tar zxf $filename`; } + my $eth0mac; + open(IFCONFIG, "system/ifconfig-a") || die; + while (<IFCONFIG>) { + chomp; + $eth0mac = $1 if (m/eth0\s+Link encap:Ethernet HWaddr (\S+)/); + } + close (IFCONFIG); + print STDERR "MAC: $eth0mac\n"; + my $newdir = "$basedir/entries/ether-$eth0mac"; + unlink $newdir if ( -d $newdir ); + rename $dirname, $newdir || die; } sub get_peerinfo { |