On Sat, Dec 05, 2009 at 10:47:25PM +0300, Igor Zinovik wrote:
> if (-e "/var/db/pkg/ftpmirror.cache") {
> open my $fh, '<', "/var/db/pkg/ftpmirror.cache" or
> die("Permission denied");
> @mirrors = <$fh>;
> close $fh;
> print $mirrors[0];
> exit;
> }
...
> open $fh, '>', "/var/db/pkg/ftpmirror.cache" or
> die("Cannot create mirror cache file");
>
you can't do this. /var/db/pkg only holds packages. This will confuse
pkg_add when you try to update things.
Apart from this, this is a really tough problem, because of infrastructure
issues. Basically, our mirrors are not that reliable, and the closest
one often won't have the packages you need... which is a reason why it's
mostly some user settings...