Versions
By Matteo Cristofaro 2012/08/17 19:00
Tested with opsi xxxxx
requiredWinstVersion >= 4.10.8.6
By Matteo Cristofaro 2012/08/17 19:00
Das Setup-File wird im ScriptPath in einem Unterverzeichnis “setup” abgelegt, also “CLIENT_DATA\setup\FreeCAD_0.12.5284_x86_setup.msi”
Tree:
delsub32.ins
freecad_0125284_x32.PNG
setup\FreeCAD_0.12.5284_x86_setup.msi
setup32.ins
uninstall32.ins
[Actions] requiredWinstVersion >= "4.10.8.6" DefVar $MsiId$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir$ DefVar $SetupFile$ DefVar $ExitCode$ Set $LogDir$ = "%SystemDrive%\tmp" Set $ProductId$ = "freecad_0125284_x32" Set $MinimumSpace$ = "350 MB" Set $SetupFile$ = "FreeCAD_0.12.5284_x86_setup.msi" Set $InstallDir$ = "%ProgramFiles32Dir%\FreeCAD0.12" ; ---------------------------------------------------------------- if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$ isFatalError ; Stop process and set installation status to failed else comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif Message "Installing " + $ProductId$ + " ..." comment "Copy files" Files_copy /32Bit comment "Start setup program" Winbatch_install Sub_check_exitcode endif SleepSeconds 15 [Files_copy] copy -s "%ScriptPath%\setup\$SetupFile$" "$InstallDir$\setup" [Winbatch_install] msiexec /i "$InstallDir$\setup\$SetupFile$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress [Sub_check_exitcode] comment "Test for installation success via exit code" set $ExitCode$ = getLastExitCode ; informations to exit codes see ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx ; http://msdn.microsoft.com/en-us/library/aa368542.aspx if ($ExitCode$ = "0") comment "Looks good: setup program gives exitcode zero" else comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ if ($ExitCode$ = "1605") comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed." comment "Uninstall of a not installed product failed - no problem" else if ($ExitCode$ = "1641") comment "looks good: setup program gives exitcode 1641" comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success." else if ($ExitCode$ = "3010") comment "looks good: setup program gives exitcode 3010" comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success." else logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$ isFatalError endif endif endif endif
Set $MsiId$ = '{81ABC4A0-DE63-11DE-8A39-0800200C9A66}' Message "Uninstalling " + $ProductId$ + " ..." if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "") comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall" Winbatch_uninstall_msi sub_check_exitcode endif comment "Delete files" Files_delete /32Bit SleepSeconds 15 [Winbatch_uninstall_msi] msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress [Files_delete] delete -sf "$InstallDir$\" [Sub_check_exitcode] comment "Test for installation success via exit code" set $ExitCode$ = getLastExitCode ; informations to exit codes see ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx ; http://msdn.microsoft.com/en-us/library/aa368542.aspx if ($ExitCode$ = "0") comment "Looks good: setup program gives exitcode zero" else comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ if ($ExitCode$ = "1605") comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed." comment "Uninstall of a not installed product failed - no problem" else if ($ExitCode$ = "1641") comment "looks good: setup program gives exitcode 1641" comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success." else if ($ExitCode$ = "3010") comment "looks good: setup program gives exitcode 3010" comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success." else logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$ isFatalError endif endif endif endif
[Actions] requiredWinstVersion >= "4.10.8.6" DefVar $MsiId$ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir$ DefVar $SetupFile$ Set $LogDir$ = "%SystemDrive%\tmp" Set $ProductId$ = "freecad_0125284_x32" Set $InstallDir$ = "%ProgramFiles32Dir%\FreeCAD0.12" ; ---------------------------------------------------------------- comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ Message "Uninstalling " + $ProductId$ + " ..." if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif