.NetFramework 3.5

Versions
By Matteo Cristofaro 2012/08/17 19:00

Tested with opsi xxxxx
requiredWinstVersion >= 4.10.8.6 By Matteo Cristofaro 2012/08/17 19:00

Das Skript lässt sich wahrscheinlich noch ein wenig optimieren, funktioniert aber.

Das Setup-File wird im ScriptPath in einem Unterverzeichnis “setup” abgelegt, also “CLIENT_DATA\setup\dotnetfx35.exe”

Tree:
delsub3264.ins
dotnet_framework_35.png
setup\dotnetfx35.exe
setup3264.ins
uninstall3264.ins

setup3264.ins

[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $MsiId32_1$
DefVar $MsiId32_2$
DefVar $MsiId32_3$
DefVar $MsiId32_4$
DefVar $MsiId32_5$
DefVar $MsiId32_6$
DefVar $MsiId64_1$
DefVar $MsiId64_2$
DefVar $MsiId64_3$
DefVar $MsiId64_4$
DefVar $MsiId64_5$
DefVar $MsiId64_6$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $SetupFile$
DefVar $ExitCode$
DefVar $INST_SystemType$
DefVar $INST_architecture$
 
Set $INST_SystemType$ = GetSystemType
Set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
Set $LogDir$ 		= "%SystemDrive%\tmp"
Set $ProductId$       	= "dotnet_framework_35"
Set $MinimumSpace$    	= "400 MB"
Set $InstallDir32$      = "%ProgramFiles32Dir%\Microsoft.NET"
Set $InstallDir64$      = "%ProgramFiles64Dir%\Microsoft.NET"
Set $SetupFile$		= "dotnetfx35.exe"
; ----------------------------------------------------------------
 
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 "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
	if FileExists("%ScriptPath%\delsub3264.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub3264.ins"
	endif
 
	comment "installing"
 
	if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
		Message "Installing " + $ProductId$ + " 32 Bit..."
		comment "Start setup program"
 
		comment "Copy files"
		Files_copy_32 /32Bit
 
		Winbatch_install_32
		Sub_check_exitcode
	endif
 
	if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
		Message "Installing " + $ProductId$ + " 64 Bit..."
		comment "Start setup program"
 
		comment "Copy files"
		Files_copy_64 /64Bit
 
		Winbatch_install_64
		Sub_check_exitcode
	endif
endif
 
 
[Files_copy_32]
copy -s "%ScriptPath%\setup\$SetupFile$" "$InstallDir32$\setup"
 
 
[Winbatch_install_32]
"$InstallDir32$\setup\$SetupFile$" /q /norestart 
 
 
[Files_copy_64]
copy -s "%ScriptPath%\setup\$SetupFile$" "$InstallDir64$\setup"
 
 
[Winbatch_install_64]
"$InstallDir64$\setup\$SetupFile$" /q /norestart 
 
 
[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

delsub3264.ins

Set $MsiId32_1$ = '{2FC099BD-AC9B-33EB-809C-D332E1B27C40}'
Set $MsiId32_2$ = '{2BA00471-0328-3743-93BD-FA813353A783}'
Set $MsiId32_3$ = '{9309DD7E-EBFE-3C95-8B47-30D3A012F606}'
Set $MsiId32_4$ = '{A1071AEB-B0EF-3F5F-BC84-83A270EBE496}'
Set $MsiId32_5$ = '{B508B3F1-A24A-32C0-B310-85786919EF28}'
Set $MsiId32_6$ = '{1545207E-C6F3-31D7-9918-BDBB65075FBF}'
 
Set $MsiId64_1$ = '{2FC099BD-AC9B-33EB-809C-D332E1B27C40}'
Set $MsiId64_2$ = '{2BA00471-0328-3743-93BD-FA813353A783}'
Set $MsiId64_3$ = '{9309DD7E-EBFE-3C95-8B47-30D3A012F606}'
Set $MsiId64_4$ = '{A1071AEB-B0EF-3F5F-BC84-83A270EBE496}'
Set $MsiId64_5$ = '{B508B3F1-A24A-32C0-B310-85786919EF28}'
Set $MsiId64_6$ = '{1545207E-C6F3-31D7-9918-BDBB65075FBF}'
 
 
if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
	Message "Uninstalling " + $ProductId$ + " 32 Bit..."
 
	if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32_1$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId32_1$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi_32
		sub_check_exitcode
	endif
 
	comment "Delete files"
	Files_delete_32 /32Bit
 
endif
 
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
	Message "Uninstalling " + $ProductId$ + " 64 Bit..."
 
	if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64_1$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId64_1$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi_64
		sub_check_exitcode
	endif
 
	comment "Delete files"
	Files_delete_64 /64Bit
endif
 
 
 
[Winbatch_uninstall_msi_32]
msiexec /x $MsiId32_1$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId32_2$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId32_3$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId32_4$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId32_5$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId32_6$ /qb! REBOOT=ReallySuppress
 
 
[Files_delete_32]
delete -sf "$InstallDir32$\"
 
 
[Winbatch_uninstall_msi_64]
msiexec /x $MsiId64_1$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId64_2$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId64_3$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId64_4$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId64_5$ /qb! REBOOT=ReallySuppress
msiexec /x $MsiId64_6$ /qb! REBOOT=ReallySuppress
 
 
[Files_delete_64]
delete -sf "$InstallDir64$\"
 
 
[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

uninstall3264.ins

[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $MsiId32_1$
DefVar $MsiId32_2$
DefVar $MsiId32_3$
DefVar $MsiId32_4$
DefVar $MsiId32_5$
DefVar $MsiId32_6$
DefVar $MsiId64_1$
DefVar $MsiId64_2$
DefVar $MsiId64_3$
DefVar $MsiId64_4$
DefVar $MsiId64_5$
DefVar $MsiId64_6$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $SetupFile$
DefVar $INST_SystemType$
DefVar $INST_architecture$
 
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
Set $LogDir$ 		= "%SystemDrive%\tmp"
Set $ProductId$       	= "dotnet_framework_35"
Set $InstallDir32$      = "%ProgramFiles32Dir%\Microsoft.NET"
Set $InstallDir64$      = "%ProgramFiles64Dir%\Microsoft.NET"
Set $SetupFile$		= "dotnetfx35.exe"
; ----------------------------------------------------------------
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
Message "Uninstalling " + $ProductId$ + " ..."
 
if FileExists("%ScriptPath%\delsub3264.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub3264.ins"
endif

QR Code
QR Code userspace:net_framework_3.5 (generated for current page)