Issue104

Title Idea for binary package downloads
Priority wish Status chatting
Superseder Nosy List justin
Assigned To Keywords

Created on 2006-03-02.04:33:02 by justin, last changed by dillon.

Messages
msg1918 (view) Author: dillon Date: 2006-12-26.02:18:00
:Peter Avalos <pavalos@theshell.com> 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 
					<dillon@backplane.com>
msg1835 (view) Author: pavalos Date: 2006-12-22.22:29:58
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.)
msg341 (view) Author: justin Date: 2006-03-02.04:33:01
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);
}
History
Date User Action Args
2006-12-26 02:18:01dillonsetmessages: + msg1918
2006-12-22 22:29:58pavalossetstatus: unread -> chatting
messages: + msg1835
2006-10-01 02:12:44adminsetnosy: + justin
2006-03-04 23:03:45corecodesetpriority: wish
2006-03-02 04:33:02justincreate