@echo off setlocal rem ######### CONFIG ######### set instdir=%ProgramFiles\Mozilla\nightly set tempdir=%temp rem ######### DON'T CHANGE STUFF BELOW THIS LINE ######### rem 4getmoz rem (C) Copyright 2001-2005 Henrik Gemal rem http://gemal.dk/mozilla/4getmoz.html echo 4getmoz v4.1.0 - http://gemal.dk/mozilla/4getmoz.html iff "%1" eq "help" then echo. echo 4getmoz [opt] - Installs latest nightly build of Mozilla or Mozilla Firefox echo Options: echo m or mozilla - install Mozilla Seamonkey echo f or firefox - install Mozilla Firefox echo t or thunderbird - install Mozilla Thunderbird echo s or sunbird - install Mozilla Sunbird echo all - installs all of the above echo nonet - no network traffic. installs local copy of zip file echo nodel - don't delete old build before install echo noask - don't ask to install anyway echo wget - use wget instead of internal 4NT copy echo saveplug - dont delete plugins folder echo debug - show debug information echo force - force install no question asked echo europe - install using sites in europe echo. echo Your current settings: echo instdir : %instdir echo tempdir : %tempdir quit endiff iff "%@search[unzip]" eq "" then echo. echo ERROR: You need unzip in your PATH! quit endiff set args=%1$ :start iff "%all" ne "" then iff "%firefox" eq "" .AND. "%thunderbird" eq "" then set firefox=1 set toolkit=1 elseiff "%firefox" eq "1" then set firefox=0 set thunderbird=1 set toolkit=1 elseiff "%thunderbird" eq "1" then set firefox=0 set thunderbird=0 set toolkit=0 set sunbird=1 elseiff "%sunbird" eq "1" then quit endiff endiff for %arg in (%args) do gosub arg iff "%toolkit" eq "1" then set jar=en-US.jar set jarfile=locale/en-US/global/build.dtd else set jar=toolkit.jar set jarfile=content/global/build.dtd endiff rem Reset all set urlftp= set urlhttp= set instbuildid= set instbuilddate= set ftpmoz=ftp.mozilla.org/pub/mozilla.org iff "%europe" eq "1" then set ftpmoz=ftp.uni-erlangen.de/pub/mozilla.org endiff iff "%firefox" eq "1" then set product=firefox set productdir=Mozilla Firefox set productzip=firefox-1.6a1.en-US.win32.zip set productzipdir=firefox set productexe=firefox.exe elseiff "%thunderbird" eq "1" then set product=thunderbird set productdir=Mozilla Thunderbird set productzip=thunderbird-1.6a1.en-US.win32.zip set productzipdir=thunderbird set productexe=thunderbird.exe set jar=en-US-mail.jar elseiff "%sunbird" eq "1" then set product=sunbird set productdir=Mozilla Sunbird set productzip=sunbird-0.2+.en-US.win32.zip set productzipdir=sunbird set productexe=sunbird.exe set urlftp=ftp://%ftpmoz/calendar/%product/nightly/latest-trunk/%productzip set urlhttp=http://%ftpmoz/calendar/%product/nightly/latest-trunk/%productzip else set product=seamonkey set productdir=Mozilla Seamonkey set productzip=seamonkey-1.1a.en-US.win32.zip set productzipdir=seamonkey set productexe=seamonkey.exe endiff set productname=%productdir iff "%urlftp" eq "" .or. "%urlhttp" eq "" then set urlftp=ftp://%ftpmoz/%product/nightly/latest-trunk/%productzip set urlhttp=http://%ftpmoz/%product/nightly/latest-trunk/%productzip endiff iff "%debug" eq "1" then echo. echo Install : %instdir echo Temporary : %tempdir echo. echo urlftp : %urlftp echo urlhttp : %urlhttp echo product : %product echo productdir : %productdir echo productzip : %productzip echo productzipdir : %productzipdir echo productexe : %productexe echo jar : %jar echo jarfile : %jarfile echo. endiff iff "%wget" eq "1" .and. "%@search[wget]" == "" then echo. echo ERROR: You need wget in your PATH! quit endiff echo. echo About to install %productname into echo %instdir\%productdir echo. REM REM ################################################################ REM iff "%nonet" ne "1" then echos Getting info about latest %productname build. Please wait.. :MOZFTP set i=%@inc[%i] echos . iff "%debug" eq "1" then echo. echo About to info from %urlftp pdir /(dymd) "%urlftp" > "%tempdir\4getmoz.tmp" else pdir /(dymd) "%urlftp" > "%tempdir\4getmoz.tmp" >&> nul endiff (set str="%@LINE[CON,0]") < "%tempdir\4getmoz.tmp" iff "%str" ne ""**EOF**"" then set downbuilddate=%@SUBSTR[%str,1,8] set downbuildday=%@SUBSTR[%str,7,2] if %@LEN[%@TRIM[%downbuildday]] eq 1 set downbuildday=0%@TRIM[%downbuildday] set downbuildmonth=%@SUBSTR[%str,5,2] if %@LEN[%@TRIM[%downbuildmonth]] eq 1 set downbuildday=0%@TRIM[%downbuildmonth] set downbuildyear=%@SUBSTR[%str,1,4] if %@LEN[%@TRIM[%downbuildyear]] eq 1 set downbuildyear=0%@TRIM[%downbuildyear] set downbuilddate=%downbuildyear%%downbuildmonth%%downbuildday echo. echo Latest %productname build is from %downbuilddate else if "%i" lt "3" goto /i MOZFTP echo. echo Unable to determine latest %productname build! iff "%debug" eq "1" then type "%tempdir\4getmoz.tmp" endiff endiff del /q "%tempdir\4getmoz.tmp" >&> nul else echo Not determining latest %productname build! endiff REM REM ################################################################ REM iff exist "%instdir\%productdir\" then set str=%@verinfo["%instdir\%productdir\%productexe",fileversion] iff "%str" ne "" then iff "%debug" eq "1" then echo Using verinfo %str endiff set instbuildid=%@SUBSTR[%str,%@EVAL[%@INDEX[%str,:]+2],10] set instbuilddate=%@SUBSTR[%instbuildid,0,8] endiff iff "%instbuilddate" eq "" .or. %@NUMERIC[%instbuilddate] ne 1 then echo Unable to determine installed %productname build! iff "%force" ne "1" then iff "%noask" ne "1" then unset /q ans inkey /k"yn" Install anyway (y/n)? %%ans else echo Not installing set ans=n endiff iff "%ans" ne "y" then iff "%all" ne "" then goto start else quit endiff endiff endiff endiff endiff REM REM ################################################################ REM iff %@NUMERIC[%instbuilddate] eq 1 then echo Installed %productname build is from %instbuilddate (%instbuildid) iff "%downbuilddate" ne "" .and. "%@EVAL[%instbuilddate]" ne "0" then iff %downbuilddate le %instbuilddate then iff "%nonet" ne "1" then echo It seems that you're already running latest build! endiff iff "%force" ne "1" then iff "%noask" ne "1" then unset /q ans inkey /k"yn" Install anyway (y/n)? %%ans else echo Not installing set ans=n endiff iff "%ans" ne "y" then iff "%all" ne "" then goto start else rem echo arghh quit endiff endiff endiff endiff else iff "%force" ne "1" .and. "%nonet" ne "1" then iff "%noask" ne "1" then unset /q ans inkey /k"yn" Install anyway (y/n)? %%ans else echo Not installing set ans=n endiff iff "%ans" ne "y" then iff "%all" ne "" then goto start else rem echo argh2 quit endiff endiff endiff endiff else echo %productname isn't installed iff "%debug" eq "1" then echo "%instdir\%productdir\chrome\%jar" not found endiff endiff REM REM ################################################################ REM iff "%nonet" ne "1" then echo Downloading %productname. Please wait. This may take a while... del /q "%tempdir\%productzip" >&> nul iff "%debug" eq "1" then iff "%wget" eq "1" then echo About to wget "%urlhttp" wget "%urlhttp" -O "%tempdir\%productzip" if "%ERRORLEVEL" ne "0" echo Errorlevel was %ERRORLEVEL else echo About to get "%urlhttp" copy /g "%urlhttp" "%tempdir" if "%ERRORLEVEL" ne "0" echo Errorlevel was %ERRORLEVEL endiff else iff "%wget" eq "1" then wget -q "%urlhttp" -O "%tempdir\%productzip" else copy /q "%urlhttp" "%tempdir" >&> nul endiff endiff endiff REM REM ################################################################ REM iff exist "%tempdir\%productzip" then iff "%ERRORLEVEL" ne "0" then echo Unable to download "%urlhttp" iff "%debug" eq "1" then echo Errorlevel was %ERRORLEVEL endiff iff "%all" ne "" then goto start else quit endiff endiff unzip -tq "%tempdir\%productzip" >& nul iff "%ERRORLEVEL" ne "0" then echo The file "%tempdir\%productzip" is corrupt! iff "%all" ne "" then goto start else quit endiff endiff iff "%debug" eq "1" then unzip -oj "%tempdir\%productzip" "%product\%productexe" -d %tempdir else unzip -qoj "%tempdir\%productzip" "%product\%productexe" -d %tempdir >&> nul endiff set str=%@verinfo["%tempdir\%productexe",fileversion] iff "%str" ne "" then iff "%debug" eq "1" then echo Using verinfo %str endiff set newbuildid=%@SUBSTR[%str,%@EVAL[%@INDEX[%str,:]+2],10] set newbuilddate=%@SUBSTR[%newbuildid,0,8] endiff echo About to install %productname build %newbuilddate (%newbuildid) iff "%force" ne "1" then iff %newbuildid le %instbuildid then iff "%noask" ne "1" then unset /q ans inkey /k"yn" Install anyway (y/n)? %%ans else echo Not installing set ans=n endiff iff "%ans" ne "y" then iff "%all" ne "" then goto start else quit endiff endiff endiff endiff iff exist "%instdir" then iff exist "%instdir\%productdir\" then :MOZQUIT del /q "%instdir\%productdir\%productexe" >&> nul iff exist "%instdir\%productdir\%productexe" then echo %productdir is running! Exit it so that the installation can continue... pause goto /i MOZQUIT endiff :TBQUIT del /q "%instdir\%productdir\components\talkback.exe" >&> nul iff exist "%instdir\%productdir\components\talkback.exe" then echo Talkback is running! Exit it so that the installation can continue... pause goto /i TBQUIT endiff iff exist "%instdir\%productdir\mozilla.bmp" then copy /q "%instdir\%productdir\mozilla.bmp" "%tempdir" endiff iff "%nodel" ne "1" then echo Deleting %instdir\%productdir iff "%saveplug" eq "1" .and. exist "%instdir\%productdir\plugins" then echo Preserving plugins folder... iff "%debug" eq "1" then except ("%instdir\%productdir\plugins") del /sxyq "%instdir\%productdir" else except ("%instdir\%productdir\plugins") del /sxyq "%instdir\%productdir" >&> nul endiff else iff exist "%instdir\%productdir\components\myspell" then except ("%instdir\%productdir\components\myspell") del /sxyq "%instdir\%productdir" >&> nul else del /sxyq "%instdir\%productdir" >&> nul endiff iff exist "%instdir\%productdir" .and. %@FILES["%instdir\%productdir"] gt 1 then echo Unable to delete "%instdir\%productdir" iff "%all" ne "" then goto start else quit endiff endiff endiff endiff endiff else iff "%debug" eq "1" then echo "creating <%instdir>" endiff mkdir /s "%instdir" endiff echo Unzipping %productzip into %instdir\%productdir echo Please wait... iff "%debug" eq "1" then unzip -qo "%tempdir\%productzip" -d "%tempdir" else unzip -qo "%tempdir\%productzip" -d "%tempdir" endiff move /qs "%tempdir\%productzipdir" "%instdir\%productdir" >&> nul iff exist "%tempdir\mozilla.bmp" then move /q "%tempdir\mozilla.bmp" "%instdir\%productdir" endiff rmdir /q "%tempdir\%productzipdir" >&> nul echo. set str=%@verinfo["%instdir\%productdir\%productexe",fileversion] iff "%str" ne "" then set newbuildid=%@SUBSTR[%str,%@EVAL[%@INDEX[%str,:]+2],10] echo Old BuildID: %instbuildid echo New BuildID: %newbuildid echo. endiff echo Start %product by running: echo %instdir\%productdir\%productexe else echo %productzip was not found in %tempdir. endiff iff "%all" ne "" then goto start endiff endlocal quit REM REM ################################################################ REM :arg iff "%arg" eq "all" then set all=1 elseiff "%arg" eq "debug" then set debug=1 elseiff "%arg" eq "nodel" then set nodel=1 elseiff "%arg" eq "noask" then set noask=1 elseiff "%arg" eq "wget" then set wget=1 elseiff "%arg" eq "nonet" then set nonet=1 elseiff "%arg" eq "saveplug" then set saveplug=1 elseiff "%arg" eq "force" then set force=1 elseiff "%arg" eq "europe" then set europe=1 elseiff "%arg" eq "f" .or. "%arg" eq "firefox" then set firefox=1 set toolkit=1 elseiff "%arg" eq "s" .or. "%arg" eq "sunbird" then set sunbird=1 elseiff "%arg" eq "t" .or. "%arg" eq "thunderbird" then set thunderbird=1 set toolkit=1 elseiff "%arg" ne "m" .and. "%arg" ne "mozilla" then echo ERROR: %arg is a unknown option! Use 4getmoz help quit endiff