2012-12-12
Script by uib gmbh
Comments and improvements welcome
Tested with opsi 4.0.2
type: localboot
id: irfanview
description: Grafikviewer
version: 4.33
Full package: http://download.uib.de/opsi4.0/products/contribute/full-package/
; Copyright (c) uib gmbh (www.uib.de) ; This sourcecode is owned by uib ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/credits/ [Actions] requiredWinstVersion >= "4.11.2.6" setloglevel = 6 DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $NewExe$ DefVar $InstallDir$ DefVar $ExitCode$ DefVar $UserSpecificIni$ ; This should be edited set $ProductId$ = "IrfanView" set $MinimumSpace$ = "20 MB" set $InstallDir$ = "%ProgramFiles32Dir%\"+$ProductId$ set $NewExe$ = $InstallDir$+"\"+"i_view32.exe" Set $UserSpecificIni$ = '' if GetProductProperty("user_specific_ini", "false") = "true" Set $UserSpecificIni$ = '/ini="%APPDATA%\irfanview' endif Message "Installing "+$ProductId$+" ..." if not(HasMinimumSpace ("%SYSTEMDRIVE%", $MinimumSpace$)) LogError "Not enough space on C: . "+$MinimumSpace$+" auf C: fuer "+$ProductId$+" erforderlich." isFatalError ; stop process and set installation status to failed else comment "show product picture" ShowBitmap "%scriptpath%\"+$ProductId$+".png" $ProductId$ if FileExists("%ScriptPath%\delsub.ins") comment "start uninstall sub section" sub "%ScriptPath%\delsub.ins" endif ;Message at install time: Message "Installing "+$ProductId$+" ..." comment "start setup program" Winbatch_install sub_check_exitcode comment "Plugins start setup program" Winbatch_install_plugins sub_check_exitcode comment "copy LANGUAGE files" Files_install comment "set start menu" LinkFolder_install comment "test for installation success" if not(FileExists($NewExe$)) logError "Fatal: After Installation "+$NewExe$+" not found" isFatalError endif comment " patches Language" DefVar $Ini_file$ Set $Ini_file$ =$InstallDir$+"\"+"i_view32.ini" Patches_INI $Ini_file$ 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 logError "Fatal: Setup program gives an unknown exitcode unequal zero: "+$ExitCode$ isFatalError endif endif [Winbatch_install] "%SCRIPTPATH%\iview433_setup.exe" /silent /folder="%ProgramFiles32Dir%\Irfanview" /desktop=0 /group=0 /allusers=1 /assoc=1 /assocallusers=1 $UserSpecificIni$ [Winbatch_install_plugins] "%SCRIPTPATH%\irfanview_plugins_433_setup.exe" /silent [Files_install] copy -sv "%SCRIPTPATH%\irfanview_lang_deutsch\*.*" "%ProgramFiles32Dir%\Irfanview" [LinkFolder_install] set_basefolder common_programs set_subfolder $ProductId$ set_link name: "IrfanView" target: $NewExe$ parameters: working_dir: $InstallDir$ icon_file: $NewExe$ icon_index: 0 end_link set_link name: "IrfanView - Thumbnails" target: $NewExe$ parameters: /thumbs working_dir: $InstallDir$ icon_file: $NewExe$ icon_index: 7 end_link [Patches_INI] set [Language] DLL=DEUTSCH set [Language] Lang=DEUTSCH
; Message at install time: Message "Deinstalling "+$ProductId$+" ..." comment "start uninstall program if exists" if FileExists($InstallDir$+"\iv_uninstall.exe") Winbatch_uninstall sub_check_exitcode endif comment "delete files" Files_uninstall comment "clear start menu" LinkFolder_uninstall [Winbatch_uninstall] "$InstallDir$\iv_uninstall.exe" /silent [Files_uninstall] del -sf "$InstallDir$\" [LinkFolder_uninstall] set_basefolder common_programs delete_subfolder $ProductId$ [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
; Copyright (c) uib gmbh (www.uib.de) ; This sourcecode is owned by uib gmbh ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/credits/ [Actions] requiredWinstVersion >= "4.11.2.6" setloglevel = 6 DefVar $ProductId$ DefVar $InstallDir$ DefVar $ExitCode$ DefVar $licensepool$ ; This should be edited set $ProductId$ = "irfanview" set $InstallDir$="%ProgramFiles32Dir%\"+$ProductId$ comment "show product picture" ShowBitmap "%scriptpath%\"+$ProductId$+".png" $ProductId$ if FileExists("%ScriptPath%\delsub.ins") comment "start uninstall sub section" sub "%ScriptPath%\delsub.ins" endif