Skip to content

opsi.orgheader image

opsi.org
Views
WinstScripts >>

irfanview

Document Actions
last edited 11 months ago by sehlers

Qualified for opsi 3.3
----------------------------------------------------------------
; 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/

[Initial]
LogLevel=2
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
[Aktionen]
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $NewExe$
DefVar $InstallDir$
DefVar $ExitCode$

; This should be edited
set $ProductId$ = "IrfanView"
set $MinimumSpace$ = "2 MB"
set $InstallDir$="%ProgramFilesDir%\"+$ProductId$
set $NewExe$=$InstallDir$+"\"+"i_view32.exe"

DefVar $TEMP$ 
Set $TEMP$ = EnvVar("TEMP")

; Message at install time:
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 /3 "%scriptpath%\"+$ProductId$+".bmp" $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 "copy files"
	Files_install
	
	comment "set Registry"
	;Registry_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]
; something like
; "%SCRIPTPATH%\Setup.exe" /S
"%SCRIPTPATH%\iview423_setup.exe" /silent /folder="%ProgramFilesDir%\Irfanview" /desktop=1 /group=1 /allusers=1 /assoc=1

[Files_install]
; something like
copy -sv "%SCRIPTPATH%\lang_deutsch\*.*" "%ProgramFilesDir%\Irfanview"

[Registry_install]
; something like
; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
; set "key"="value"

[LinkFolder_install]
; something like
; set_basefolder common_programs
; set_subfolder $ProductId$
;
; set_link
;  name: $ProductId$
;  target: $NewExe$
;  parameters:
;  working_dir: $InstallDir$
;  icon_file:
;  icon_index:
; end_link