Hello Everyone,

I really didn't feel like bothering with Cygwin in order to download all the updates/packages. The following script seems to be totally cross-platform, though I haven't rebooted to test it out in linux yet. Oh and it also will continue unfinished downloads [instead of checking if they exist]

I thought I'd throw it out on the list. It might need a little cleaning up though, as I am definitely a perl novice.

You should download the win32 version of wget: this is where I got mine:
http://allserv.ugent.be/~bpuype/wget/

Take it easy,
Christian

(P.S. The 7-zip download is not working for me)


# prepare.pl -- a perl version of the prepare script # lets you run prepare without cygwin (tested on ActivePerl) # It also requires a version of wget for win32 # largely copied from : http://www.adp-gmbh.ch/perl/find.html

use warnings;
use strict;

use Cwd;
use File::Find;
use File::Path;

# Set the correct language
my $lang = "ENU";
if ( $ARGV[0] ) {
   $lang = $ARGV[0];
}

# Set the current directory
my $current = cwd;

# look in the scripts directory
find(\&d, cwd."\/scripts");

sub d {

   my $file = $File::Find::name;

   $file =~ s,/,\\,g;

   return unless -f $file;
   return unless $file =~ m/(\.bat|\.aut)/i;

   open F, $file or print "Couldn't open $file\n" && return;

while (<F>) {
if ( my $line = m/^\:\:\sURL\|($lang|ALL)\|(\S+)\|(\S+)\s/) {

my $url = $2;

# split dir and filename (I chose not to do this in the above regexp)
my($directory, $filename) = $3 =~ m/(.*\/)(.*)$/;

# Make the path if it doesn't exist
mkpath("$current\/$directory");


         system("wget -c -O $current\/$directory$filename $url");
       }
   }    
   close F;
}



-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
unattended-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unattended-devel

Reply via email to