[wpkg-users] Installation/upgrade of same package on different architectures

Rainer Meier r.meier at wpkg.org
Fri Sep 25 00:03:37 CEST 2009


Hi Justin,

Justin Brinegar wrote:
> We plan to use the output of the ver command to differentiate in
> scripts, but I just wondered if a better way existed.

I am using exactly this approach for my Internet Explorer 8 package:

@echo off

set PROGRAM_NAME=Internet Explorer
set LANG_SUFFIX=ENU
set INSTALLER_TYPE=custom
set INSTALLER=install.cmd
set INSTALLER_LOC=%~dp0
set CMDPATH=%~dpn0

REM Detect Windows version
VER | findstr /i "5\.0\." > nul
IF %ERRORLEVEL% EQU 0 (
    echo Windows  2000 found
    REM Windows 2000 (no binaries yet)
    exit 2
)

ver | findstr /i "5\.1\." > nul
IF %ERRORLEVEL% EQU 0 (
    echo Windows XP found
    set CMD32=IE8-WindowsXP-x86-%LANG_SUFFIX%.exe
    set CMD64=IE8-WindowsXP-x86-%LANG_SUFFIX%.exe
    goto continue
)
echo test
ver | findstr /i "5\.2\." > nul
IF %ERRORLEVEL% EQU 0 (
    echo Windows Server 2003 found
    exit 2
)

ver | findstr /i "6\.0\." > nul
IF %ERRORLEVEL% EQU 0 (
    echo Windows Vista found
    set CMD32=IE8-WindowsVista-x86-%LANG_SUFFIX%.exe
    set CMD64=IE8-WindowsVista-x64-%LANG_SUFFIX%.exe
    goto continue
)
ver | findstr /i "6\.1\." > nul
IF %ERRORLEVEL% EQU 0 (
    REM Windows 7
    exit 0
)
if "%CMD32%" == "" exit 3
:continue

if exist "%INSTALLER_LOC%unattended-preinstall.cmd" (
	call "%INSTALLER_LOC%unattended-preinstall.cmd"
	if "%~n0" == "unattended" goto install
)

if exist "%CMDPATH%-preinstall.cmd" (
	call "%CMDPATH%-preinstall.cmd"
)

:install
echo Installing %PROGRAM_NAME%

set PROGRAM_FILES=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set PROGRAM_FILES=%ProgramFiles(x86)%

echo Installing %CMD32%, %CMD64%
call "%INSTALLER_LOC%%INSTALLER%" %INSTALLER_TYPE% "%CMD32%" "%CMD64%" ""
"/quiet /update-no /no-default /norestart"
set EXIT_CODE=%ERRORLEVEL%

if exist "%CMDPATH%-postinstall.cmd" (
	call "%CMDPATH%-postinstall.cmd"
	if "%~n0" == "unattended" goto end
)

if exist "%INSTALLER_LOC%unattended-postinstall.cmd" (
	call "%INSTALLER_LOC%unattended-postinstall.cmd"
)

:end
exit /B %EXIT_CODE%



br,
Rainer



More information about the wpkg-users mailing list