This is an old revision of the document!
Script by Lars_k
Tested with opsi 4.0.1
Test with W7 32 & 64 Bit
The installion-files available Download from : http://www.7-zip.org/
Tree:
DATA_CLIENT\\ ├ Bild.png ( Product Picture) \\ ├ setup.ins \\ ├ uninstall.ins \\ ├ Folder Depot \\ ├ in Depot \\ └ Depot ├ 7z920.exe \\ └ 7z920-x64.msi \\
[Initial] ExitOnError=true StayOnTop = true [Actions] requiredWinstVersion >= "4.10.5" DefVar $ProductId$ DefVar $ExitCode$ DefVar $NTVersioninfo$ DefVar $32bitfile$ DefVar $64bitfile$ DefVar $uninstallstring$ DefVar $Parameter$ SetLogLevel=6 Set $32bitfile$ ="7z920.exe" Set $64bitfile$ ="7z920-x64.msi" ; ---------------------------------------------------------------- Set $ProductId$ = "7 Zip 9.20" ; ---------------------------------------------------------------- ShowBitmap "%ScriptPath%\bild.png" $ProductId$ Message "Installiert " + $ProductId$ + " ..." if not (HasMinimumSpace ("%SYSTEMDRIVE%", "50 MB")) LogError "Es ist nicht genügend freien Speicherplatz auf dem Laufwerk : %SYSTEMDRIVE% vorhanden." isFatalError endif ; OS Version ermitteln > Win2000 Set $NTVersioninfo$ = GetMsVersionInfo if not ( $NTVersioninfo$ >= "5.1" ) LogError "Kein Komp. Betriebssystem vorhanden." isFatalError endif ; 64 Bit OS if GetSystemType = "64 Bit System" comment " 64 Bit System" Sub_uninstall Winbatch_7zip64bit comment " 7Zip wird installiert" Sub_check_exitcode endif ; 32 Bit OS if GetSystemType = "x86 System" comment " 32 Bit System" Sub_uninstall Winbatch_7zip32bit comment " 7Zip wird installiert" Sub_check_exitcode endif [Winbatch_7zip32bit] %ScriptPath%\depot\$32bitfile$ /S [Winbatch_7zip64bit] msiexec /i %ScriptPath%\depot\$64bitfile$ /qn [Winbatch_remove] "$uninstallstring$" $Parameter$ [Sub_uninstall] ; Prüft ob eine 64 Bit Version installiert ist. if ( FileExists("%ProgramFiles64Dir%\7-zip") ) comment "64 Bit Version gefunden" Set $uninstallstring$ = "MsiExec" Set $Parameter$ = " /X{23170F69-40C1-2702-0920-000001000000} /qn" Winbatch_remove Sub_check_exitcode comment "64 Bit Version deinstalliert" endif ; Prüft ob eine 32 Bit Version installiert ist. if ( FileExists("%ProgramFiles32Dir%\7-zip") ) comment "32 Bit Version gefunden" Set $uninstallstring$ = "%ProgramFiles32Dir%\7-zip\Uninstall.exe" Set $Parameter$ = " /S" Winbatch_remove Sub_check_exitcode comment "32 Bit Version deinstalliert" endif [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
[Initial] ExitOnError=true StayOnTop = true [Actions] requiredWinstVersion >= "4.10.5" DefVar $ProductId$ DefVar $ExitCode$ DefVar $NTVersioninfo$ DefVar $uninstallstring$ DefVar $Parameter$ SetLogLevel=6 ; ---------------------------------------------------------------- Set $ProductId$ = "7 Zip 9.20" ; ---------------------------------------------------------------- ShowBitmap "%ScriptPath%\bild.png" $ProductId$ Message "Deinstalliert " + $ProductId$ + " ..." ; OS Version ermitteln > Win2000 Set $NTVersioninfo$ = GetMsVersionInfo if not ( $NTVersioninfo$ >= "5.1" ) LogError "Kein Komp. Betriebssystem vorhanden." isFatalError endif ; 64 Bit OS if GetSystemType = "64 Bit System" comment " 64 Bit System" comment " 7Zip wird entfernt." Sub_uninstall endif ; 32 Bit OS if GetSystemType = "x86 System" comment " 32 Bit System" comment " 7Zip wird entfernt" Sub_uninstall endif [Winbatch_remove] "$uninstallstring$" $Parameter$ [Sub_uninstall] ; Prüft ob eine 64 Bit Version installiert ist. if ( FileExists("%ProgramFiles64Dir%\7-zip") ) comment "64 Bit Version gefunden" Set $uninstallstring$ = "MsiExec" Set $Parameter$ = " /X{23170F69-40C1-2702-0920-000001000000} /qn" Winbatch_remove Sub_check_exitcode comment "64 Bit Version deinstalliert" endif ; Prüft ob eine 32 Bit Version installiert ist. if ( FileExists("%ProgramFiles32Dir%\7-zip") ) comment "32 Bit Version gefunden" Set $uninstallstring$ = "%ProgramFiles32Dir%\7-zip\Uninstall.exe" Set $Parameter$ = " /S" Winbatch_remove Sub_check_exitcode comment "32 Bit Version deinstalliert" endif [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