#! /usr/bin/perl $input=$ENV{QUERY_STRING} || $ARGV[0]; $package=`apt-cache show $ARGV[0] | grep ^Filename | head -1 | cut -f2 -d " "`; chomp $package; $locationstr=`grep -l $package /var/lib/apt/lists/*Packages`; $locationfile=(split "/",$locationstr)[-1]; ($location,undef) = split ("_dists", $locationfile); $location =~ s#_#/#g; if ($ENV{QUERY_STRING}) {print "Content-type: text/plain\n\n"}; print "http://$location/$package\n";