dman84 wrote:

> triple take for that too.. post it here;
> 
> Dennis
> 
> Art Wagner wrote:
> 
>> I'll second that request. I'm using linux and a script like that would 
>> be MOST useful.
>> Art Wagner
>> 
>> Ben Ruppel wrote:
>> 
>>> hey, could you post that script?  I don't know perl, AND I'm on win32, 
>>> but I do have activestate perl installed.  I'd like to see what such a 
>>> script looks like; I don't know the language at all.

Ack!  Me and my big mouth!  OK, here it is.

CAVEATS:

1. It is technically crummy, and not a good example of what perl can do.
I'm not very good at perl myslef, so there's lots of stuff hard-coded to
my particular wants, needs, and environment.  There's a lot of
superfluous stuff that I used while I was debugging it and never
removed.  The bottom line is it works _for me_.

2. I don't use the mozilla installers, just the zips, so I don't know
what changes there might need to be for the installer.

3. It's basically just a bunch of system calls.  This is what it does:
- removes old registry files
- removes select files from the profile that aren't carried forward
- backs up my main profile (the only one really at risk)
- appends the currently installed build# to the current /bin/ directory
name, like bin_102603.  I enter the build# as a run-time parameter when
I start the script.
- unzips the new build, which becomes the new /bin/ directory

It does not do anything with Windows shortcuts.  All my shortcuts just
point to the /bin/ directory, whatever build that may be.  After I start
the new build for the first time, I manually change the downloaded file
name to include the new build number.  If a new build turns out to be
crappy (like 10/24-25 were), it's a piece of cake to blow it away,
restore my profile (if it got hosed up) and revert to the previous build
with minimal damage.

Use at your own risk.  I take no responsibility for it screwing up
anybody else's system. ;)
# standard backups etc for a new build
# run from DOS prompt: perl mozunzip.pl <old build#>

$buildID = shift @ARGV;
$fn1 = "";
$fn2 = "";
$newbuildID = "";

$mozreg = "c:\\windows\\mozregistry.dat";
$mozver = "c:\\windows\\mozver.dat";
$reg = "c:\\windows\\applic~1\\mozilla\\registry";
$profdir = "e:\\progra~1\\netscape";
$prof = "\\barney";
$rendir = "d:\\progra~1\\netscape\\bin";
$inszip = "e:\\download\\temp\\mozilla.exe";  # zip file converted to self-extracting 
.exe

# registry files
system("del $mozreg");
system("del $mozver");
$fn1 = $reg.".dat";
$fn2 = $reg."-sv.dat";
system("copy $fn1 $fn2");

# remove old profile backup
$fn2 = $profdir.$prof;
system("deltree $fn2");

# delete cache files and XUL.mfl before copying
$fn1 = $profdir."\\mozilla".$prof."\\44w6jgj2.slt\\cache\\*.*";
system("del $fn1");
$fn1 = $profdir."\\mozilla".$prof."\\44w6jgj2.slt\\XUL.mfl";
system("del $fn1");

# copy current profile to backup
$fn1 = $profdir."\\mozilla".$prof;
$fn2 = $profdir.$prof;
system("xcopy $fn1 $fn2 /s");

# rename the old build
while (!defined($buildID) || $buildID eq "")
{
    print "Enter bin build to rename (mmddtt): ";
    $buildID = <STDIN>;
    chomp $buildID;
}
    
# rename the current bin directory
$fn2 = "bin_".$buildID;
system("rename $rendir $fn2");

# unzip the new build
system($inszip);

# move the new build
$fn1 = "e:\\download\\temp\\mozilla-win32-talkback.zip";
$fn2 = "e:\\download\\mozilla\\mozilla-win32-talkback-xxxxxx.zip"; # have to rename it 
manually
system("move $fn1 $fn2");

print "all done";

Reply via email to