I'll go you one better Max: a combined bat/perl script that downloads and
installs a snapshot.  Attached is what I use to install the latest snapshots;
put it anywhere (rename it to ".bat", I had to get it through Outlook), MAKE
SURE YOU DON'T HAVE ANY CYGWIN THINGS RUNNING, run it, and you're set.  Only
tried on XP.  Needs perl and wget in your Windows PATH.

USE AT YOUR OWN RISK.  THERE'S NO "UNDO".  NOT SUPPORTED BY ME OR ANYBODY ELSE
IN ANY WAY.  THIS MEANS YOU.

--
Gary R. Van Sickle
Brewer.  Patriot.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf
> Of Max Bowsher
> Sent: Friday, March 07, 2003 12:28 PM
> To: Ronald Landheer-Cieslak; [EMAIL PROTECTED]
> Subject: Re: Testsuite
>
>
> Ronald Landheer-Cieslak wrote:
> > BTW: is there any way to get the "current" or "latest" snapshot with a
> > simple wget? (i.e. is there a
> > http://www.cygwin.com/snapshots/latest...?) It would make it easier
> > to make a "snapshot" target and get the new-cygwin1.dll from there :)
>
> Not currently. If you are willing to use perl, the attached might serve as a
> base.
>
> Curiously, I couldn't find any scripts to do with snapshot page generation
> in sources.redhat.com CVS.
>
>
> Max.
>
@echo off
rem  InstallLatestCygwinSnapshot.bat
rem  A combined bat/perl script to automatically install the latest snapshot.
rem  Requires Cygwin perl and wget on your path.

rem Run the perl script part, which is at the end.
perl -x -- %0

if ERRORLEVEL 1 goto :error1

rem  Replace cygwin1.dll
cd c:\unix\bin
del cygwin1.dll
ren deleteme.dll cygwin1.dll
echo Done.
pause
exit

:error1
echo Error.
pause
exit 1

rem -------------------- PERL STARTS HERE -----------------
#!/bin/perl
# My sweet LORD perl is cool!

use File::Temp qw/ tempfile tempdir /;

# Get the snapshots page
print "Getting list of snapshots...\n";
$page = `wget -O- http://cygwin.com/snapshots/ 2>/dev/null`;

if ($?)
{
        die "Couldn't get list of snapshots";
}

# Parse the URLs out of it.
(@base) = ($page =~ m|(http.*cygwin-inst.*bz2)|gm);

# Sort them by date, newest to oldest.
@base = sort {$b cmp $a} @base;

# Get the newest one.
$URL = @base[0];
($BASENAME) = (@base[0] =~ m!([^/]*bz2$)!);

print "Latest snapshot is ", $BASENAME, "\n";

# Download the file
print "Downloading ", $URL, "...\n";
system("wget -cq -nd --directory-prefix=/. $URL") == 0
        or die "Couldn't download file";

# Create a temp dir for extractiong cygwin1.dll
$tempdir = tempdir( CLEANUP => 1);

# Extract as much as we can (i.e. hopefully everything except cygwin1.dll)
# Extract *only* the cygwin1.dll, to a different name in /bin, and we'll move
# it to its final resting place back in cmd.exe.
print "Extracting...\n";
system("cd / &&
        tar -xjf $BASENAME --exclude=usr/bin/cygwin1.dll &&
        cp $BASENAME $tempdir/$BASENAME &&
        cd $tempdir &&
        tar -xjf $BASENAME usr/bin/cygwin1.dll &&
        cp usr/bin/cygwin1.dll /bin/deleteme.dll") == 0
        or die "Extraction failed";


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to