GanttProject 2.0.10

2010-05-03
Script by uib gmbh
Comments and improvements welcome

id: ganttproject
name: GanttProject
description: Free project scheduling and management.
version: 2.0.10

javavm is required, so make a dependency

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/
 
[Initial]
requiredWinstVersion >= "4.8.6"
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 $TEMP$
Set $TEMP$ = EnvVar("TEMP")
DefVar $LogDir$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $NewExe$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "ganttproject"
Set $MinimumSpace$    = "50 MB"
Set $InstallDir$      = "%ProgramFilesDir%\GanttProject"
Set $NewExe$          = $InstallDir$ + "\" + $ProductId$ + ".exe"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------
 
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 /3 "%ScriptPath%\" + $ProductId$ + ".png" "GanttProject"
 
	if FileExists("%ScriptPath%\delsub.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub.ins"
	endif
 
	Message "Installing GanttProject ..."
 
	comment "Start setup program"
	DefVar $MinorOS$
	set $MinorOS$ = GetNTVersion
	if ( $MinorOS$ = "Win2K" )
		; cannot find process "ganttproject-2.0.4" in win2k, maybe name too long for process
		; so here's a 15 secs timeout, which should be enough
		Message "Installing GanttProject ... (this may take 15 seconds)"
		Winbatch_install /WaitForProcessEnding "ganttproject-2." /TimeOutSeconds 15
	else
		Winbatch_install /WaitForProcessEnding "ganttproject-2.0.4.exe"
	endif
	Sub_check_exitcode
 
 
	comment "Create shortcuts"
	LinkFolder_install
 
endif
 
[Winbatch_install]
%scriptpath%\ganttproject-2.0.10.exe /S
 
[LinkFolder_install]
set_basefolder common_desktopdirectory
set_subfolder ""
 
set_link
	name: GanttProject
	target: $NewExe$
	parameters:
	working_dir: $InstallDir$
	icon_file:
	icon_index:
end_link
 
[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 GanttProject ..."
 
if FileExists($InstallDir$ + "\uninstall.exe")
	comment "Uninstall program found, starting uninstall"
	Winbatch_uninstall /WaitForProcessEnding "uninstall.exe"
	sub_check_exitcode
 
	DefVar $done$
	Set $done$ = "false"
	DefStringList $for$
	Set $for$ = createStringList("0","1","2","3","4","5","6","7","8","9")
	for %x% in $for$ do Sub_check_done
	if ($done$ = "false")
		logError "Fatal: installdir not found!"
		isFatalError
	endif
endif
 
comment "Delete program shortcuts"
LinkFolder_uninstall
 
[Sub_check_done]
if ($done$ = "false")
	if FileExists($InstallDir$ + "\uninstall.exe")
		comment "Waiting five seconds for next check ..."
		sleepSeconds 5
	else
		comment "Install dir not found => uninstall done"
		Set $done$ = "true"
	endif
endif
 
[Winbatch_uninstall]
"$InstallDir$\uninstall.exe" /S
 
[LinkFolder_uninstall]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element GanttProject
 
[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/
 
[Initial]
requiredWinstVersion >= "4.8.6"
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 $TEMP$
Set $TEMP$ = EnvVar("TEMP")
DefVar $LogDir$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir$
DefVar $LicenseRequired$
DefVar $LicensePool$
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "ganttprojekt"
Set $InstallDir$      = "%ProgramFilesDir%\GanttProject"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------
 
 
comment "Show product picture"
ShowBitmap /3 "%ScriptPath%\" + $ProductId$ + ".png" "GanttProject"
 
Message "Uninstalling GanttProject ..."
 
if FileExists("%ScriptPath%\delsub.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub.ins"
endif

QR Code
QR Code userspace:ganttproject_2.0.10 (generated for current page)