====== Lazarus ======
2012-08-31\\
Script by uib GmbH \\
Comments and improvements welcome \\
id: lazarus\\
name: Lazarus\\
description: Free Pascal + IDE + Extensions (32/64)\\
advice: FPC 2.6.0 , indy 10.2.0.3\\
version: 1.0\\
Full package: http://download.uib.de/opsi4.0/products/contribute/full-package/
Up to opsi-Winst version 4.11.3 uib used the lazarus-version 0.9.30 to program.\\
Full package: http://download.uib.de/opsi4.0/products/contribute/full-package/
==== setup.ins ====
; 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.3.2"
DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LogDir$
DefVar $InstallationLog$
DefVar $SystemType$
DefVar $install_architecture$
Set $LogDir$ = "%SystemDrive%\opsi.org\log"
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
Set $ProductId$ = "lazarus"
Set $MinimumSpace$ = "100 MB"
; the path were we find the product after the installation
set $InstallDir32$ = "%systemdrive%\lazarus"
set $InstallDir64$ = "%systemdrive%\lazarus64"
Set $InstallationLog$ = $LogDir$ + "\"+$ProductId$+".log"
Set $install_architecture$ = GetProductProperty("install_architecture", "32 only")
Set $SystemType$ = GetSystemType
; ----------------------------------------------------------------
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
isFatalError "no space"
; 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 "Installing " + $ProductId$ + " ..."
comment "start setup program"
if $install_architecture$ = "32 only"
Set $InstallDir$ = "c:\lazarus"
comment "Installing lazarus x86"
Winbatch_install_x86
sub_check_exitcode
endif
if $install_architecture$ = "64 only"
if $SystemType$ = "64 Bit System"
Set $InstallDir$ = "c:\lazarus64"
comment "Installing lazarus x64"
Winbatch_install_x64
Sub_check_exitcode
else
LogError "Could not install 64 bit version on non 64 bit system"
isFatalError "wrong architecture"
endif
endif
comment "Copy files"
Files_install
if $install_architecture$ = "32 only"
DosInAnIcon_compile_packages winst winst /32bit
else
DosInAnIcon_compile_packages winst /64bit
endif
endif
[Winbatch_install_x86]
; === Inno Setup ========================================================================================
; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html
; You may create setup answer file by: setup.exe /SAVEINF="filename"
; You may use an answer file by the parameter /LOADINF="filename"
"%ScriptPath%\lazarus-1.0-fpc-2.6.0-win32.exe" /sp- /silent /norestart /nocancel
[Winbatch_install_x64]
; === Inno Setup ========================================================================================
; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html
; You may create setup answer file by: setup.exe /SAVEINF="filename"
; You may use an answer file by the parameter /LOADINF="filename"
"%ScriptPath%\lazarus-1.0-fpc-2.6.0-win64.exe" /sp- /silent /norestart /nocancel
[Files_install]
copy -s "%ScriptPath%\indy\*.*" "$InstallDir$\components\indy"
copy -s "%ScriptPath%\richmemo\*.*" "$InstallDir$\components\richmemo"
copy -s "%ScriptPath%\dcpcrypt-2.0.4.1\*.*" "$InstallDir$\components\dcpcrypt"
copy "%ScriptPath%\lazarus-cfg\*.*" "$InstallDir$"
[DosInAnIcon_compile_packages]
cd "$InstallDir$"
"$InstallDir$\lazbuild.exe" "$InstallDir$\components\indy\lazarus\indylaz.lpk"
"$InstallDir$\lazbuild.exe" "$InstallDir$\components\richmemo\richmemopackage.lpk"
"$InstallDir$\lazbuild.exe" "$InstallDir$\components\dcpcrypt\dcpcrypt_laz.lpk"
[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
==== delsub.ins ====
; 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/
Message "Uninstalling " + $ProductId$ + " ..."
Set $UninstallProgram$ = $InstallDir32$ + "\unins000.exe"
if FileExists($UninstallProgram$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall
sub_check_exitcode
endif
Set $UninstallProgram$ = $InstallDir64$ + "\unins000.exe"
if FileExists($UninstallProgram$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall
sub_check_exitcode
endif
comment "Delete files"
if FileExists($InstallDir32$)
Files_uninstall32
endif
if FileExists($InstallDir64$)
Files_uninstall64
endif
comment "Cleanup registry"
Registry_uninstall
comment "Delete program shortcuts"
LinkFolder_uninstall
[Winbatch_uninstall]
; === Inno Setup ========================================================================================
"$UninstallProgram$" /silent /norestart
[Files_uninstall32]
del -sf "$InstallDir32$\"
[Files_uninstall64]
del -sf "$InstallDir64$\"
[Registry_uninstall]
; Example of deleting a registry key:
;
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
[LinkFolder_uninstall]
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
; delete_subfolder $ProductId$
;
; Example of deleting a shortcut from AllUsers desktop:
;
; set_basefolder common_desktopdirectory
; set_subfolder ""
; delete_element $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
==== uninstall.ins ====
; 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.3.2"
DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $InstallationLog$
DefVar $SystemType$
DefVar $install_architecture$
Set $LogDir$ = "%SystemDrive%\opsi.org\log"
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
Set $ProductId$ = "lazarus"
Set $MinimumSpace$ = "100 MB"
; the path were we find the product after the installation
set $InstallDir32$ = "%systemdrive%\lazarus"
set $InstallDir64$ = "%systemdrive%\lazarus64"
Set $install_architecture$ = GetProductProperty("install_architecture", "32 only")
Set $SystemType$ = GetSystemType
Set $LogDir$ = "%SystemDrive%\opsi.org\log"
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists("%ScriptPath%\delsub.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub.ins"
endif