Project

General

Profile

Actions

Bug #104

closed

Idea for binary package downloads

Added by justin about 18 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

It would be handy if we had a single URL for binary package installation
that was both simple to remember and would hit a random mirror. In the
same way that "ftp#.freebsd.org" always gets you to data, I'd like to have
something convenient.

HTTP URL that returns a random Location: line that points at a mirror, it
will redirect correctly to a directory to find the file. The correct
package name needs to be pulled from the request and re-tacked onto the
end of the next request for the file.

So, if we had a program on dragonflybsd.org that returned a Location
header with the requested file's name tacked on it, we'd have an
always-balanced, easy-to-remember source for pkgsrc binaries.

The program to do the redirect would be something like the below:

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <dirent.h>

static int VerboseOpt;
static const char *FilePath;
static const char *FileName;
static char *Av0;

static const char *filecomp(const char *path);

char *Mirrors[] = {
"ftp://packages.stura.uni-rostock.de/pkgsrc-current/DragonFly/RELEASE/i386/All/",
"http://chlamydia.fs.ei.tum.de/pub/DragonFly/packages/RELEASE/i386/All/",
"ftp://ftp.pvv.ntnu.no/pub/DragonFly/packages/pkgsrc-current/DragonFly/RELEASE/i386/All/",
"http://theshell.com/pub/DragonFly/packages/RELEASE/i386/All/",
"http://www.gobsd.com/pkgsrc/DragonFly/RELEASE/i386/All/",
"ftp://ftp.jaist.ac.jp/pub/DragonFly/packages/DEVELOPMENT/i386/"
};

int
main(int ac, char **av) {
FILE *fi;
char *base;
int i;

/*
 * Process options
*/
Av0 = av[0];
for (i = 1; i < ac; ++i) {
char *ptr = av[i];
if (*ptr != '-') {
FilePath = ptr;
continue;
}
ptr += 2;
switch(ptr[-1]) {
case 'v':
VerboseOpt = 1;
break;
}
}
/*
 * Output headers and HTML start.
*/
if (FilePath == NULL) {
fprintf(stderr, "%s: no file specified\n", av[0]);
exit(1);
}
FileName = filecomp(FilePath);
srandom(time(NULL));
printf("Location: s",
Mirrors[random()
(sizeof(Mirrors)/sizeof(Mirrors[0]))]);
printf("%s", FileName);
printf("\r\n\r\n");
}

static
const char *
filecomp(const char *path) {
const char *ptr;

if ((ptr = strrchr(path, '/')) != NULL)
return(ptr + 1);
else
return(path);
}
Actions #1

Updated by pavalos over 17 years ago

Interesting idea. It might even be better to setup a standardized mirroring
configuration where the mirrors are setup to be publically accessible, and
pull the data from their sources (Matt's network for cvs and iso-images,
joerg's for packages, corecode's for snapshots, etc.)

Actions #2

Updated by dillon over 17 years ago

:Peter Avalos <> added the comment:
:
:Interesting idea. It might even be better to setup a standardized mirroring
:configuration where the mirrors are setup to be publically accessible, and
:pull the data from their sources (Matt's network for cvs and iso-images,
:joerg's for packages, corecode's for snapshots, etc.)
:
:----------
:status: unread -> chatting

I have this insane idea for a massively redundant 'clustered' storage
system, using crypto to sign the data blocks (chained from the 'root'
which would be a single domain whos crypto key is looked up via DNS)
Call me crazy....
-Matt
Matthew Dillon
&lt;&gt;
Actions #3

Updated by tuxillo over 14 years ago

No that we have pkg_radd, does this still applies?

Actions #4

Updated by corecode over 14 years ago

avalon does this now.

Actions

Also available in: Atom PDF