This shows you the differences between two versions of the page.
userspace:netfx_4.0 [2011/11/16 12:22] Thomas_H |
userspace:netfx_4.0 [2021/08/23 08:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== .NetFX 4.0 ====== | ||
- | Tested with opsi 4.0.1\\ | ||
- | requiredWinstVersion >= 4.10.8.6 | ||
- | By // | ||
- | The installation-files can be downloaded at http:// | ||
- | |||
- | Special thanks to: joerg.ludwig for his code, to be found in the [[https:// | ||
- | |||
- | Tree:\\ | ||
- | AutoIt3.exe\\ | ||
- | delsub.ins\\ | ||
- | dotNetFX.jpg\\ | ||
- | dotNetFx40_Full_x86_x64.exe\\ | ||
- | setup.ins\\ | ||
- | uninstall.ins | ||
- | |||
- | ==== setup.ins ==== | ||
- | <code winst> | ||
- | [Initial] | ||
- | LogLevel=9 | ||
- | ; 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 | ||
- | |||
- | |||
- | [Actions] | ||
- | requiredWinstVersion >= " | ||
- | |||
- | DefVar $UninstallProgram32$ | ||
- | DefVar $UninstallProgram64$ | ||
- | DefVar $ProductId$ | ||
- | DefVar $MinimumSpace$ | ||
- | DefVar $InstallDir32$ | ||
- | DefVar $InstallDir64$ | ||
- | DefVar $ExitCode$ | ||
- | DefVar $LicenseRequired$ | ||
- | DefVar $LicenseKey$ | ||
- | DefVar $LicensePool$ | ||
- | DefVar $INST_SystemType$ | ||
- | DefVar $INST_architecture$ | ||
- | DefVar $Version$ | ||
- | DefVar $Inst_Cmd32$ | ||
- | DefVar $Inst_Cmd64$ | ||
- | DefVar $Uninst_Cmd32$ | ||
- | DefVar $Uninst_Cmd64$ | ||
- | DefVar $Inst_Prg$ | ||
- | DefVar $Uninst_Prg$ | ||
- | DefVar $LogDir$ | ||
- | DefVar $opsiadminuser$ | ||
- | DefVar $opsiadminpwd$ | ||
- | |||
- | Set $INST_SystemType$ = GetSystemType | ||
- | set $INST_architecture$ = GetProductProperty(" | ||
- | |||
- | |||
- | Set $LogDir$ = " | ||
- | |||
- | ; ---------------------------------------------------------------- | ||
- | ; - Please edit the following values | ||
- | ; ---------------------------------------------------------------- | ||
- | ; | ||
- | ; therefore please: only lower letters, no umlauts, | ||
- | ; no white space use ' | ||
- | Set $ProductId$ | ||
- | Set $Version$ | ||
- | Set $MinimumSpace$ | ||
- | ; the path were we find the product after the installation | ||
- | Set $InstallDir32$ | ||
- | Set $InstallDir64$ | ||
- | Set $LicenseRequired$ = " | ||
- | Set $LicensePool$ | ||
- | Set $Inst_Prg$ | ||
- | Set $Inst_Cmd32$ | ||
- | Set $Inst_Cmd64$ | ||
- | Set $Uninst_Cmd32$ | ||
- | Set $Uninst_Cmd64$ | ||
- | Set $Uninst_Prg$ | ||
- | Set $opsiadminuser$ = " | ||
- | Set $opsiadminpwd$ = randomstr | ||
- | ; ---------------------------------------------------------------- | ||
- | |||
- | if not(HasMinimumSpace (" | ||
- | LogError "Not enough space on %SystemDrive%, | ||
- | isFatalError | ||
- | ; Stop process and set installation status to failed | ||
- | else | ||
- | comment "Show product picture" | ||
- | ShowBitmap " | ||
- | |||
- | if FileExists(" | ||
- | comment "Start uninstall sub section" | ||
- | Sub " | ||
- | endif | ||
- | |||
- | if $LicenseRequired$ = " | ||
- | comment " | ||
- | Sub_get_licensekey | ||
- | endif | ||
- | |||
- | comment " | ||
- | |||
- | Message " | ||
- | FilesCopy | ||
- | Message " | ||
- | comment "Start setup program" | ||
- | DosBatchUserdel | ||
- | DosBatchUseradd | ||
- | DefStringList $res$ | ||
- | Set $res$ = getOutStreamFromSection(" | ||
- | if count($res$) = " | ||
- | DefVar $e$ | ||
- | Set $e$ = takeString(0, | ||
- | Comment "setup exit code: " + $e$ | ||
- | if ($e$ = " | ||
- | ExitWindows /Reboot | ||
- | endif | ||
- | else | ||
- | LogError " | ||
- | IsFatalError | ||
- | endif | ||
- | DosBatchUserdel | ||
- | ; Ok, let's check, if .Net Framework was installed... | ||
- | if not(FileExists(" | ||
- | LogError " | ||
- | IsFatalError | ||
- | endif | ||
- | FilesDelete | ||
- | Sub_check_exitcode | ||
- | |||
- | endif | ||
- | |||
- | [FilesCopy] | ||
- | copy " | ||
- | |||
- | [DosBatchUseradd] | ||
- | net user " | ||
- | net localgroup Administratoren /add " | ||
- | |||
- | [DosBatchUserdel] | ||
- | net user " | ||
- | rmdir /s /q " | ||
- | |||
- | [ExecWithSetup] | ||
- | ; http:// | ||
- | ; return exit code via stdout as winst cannot read exit codes from ExecWith | ||
- | $ExitCode = RunAsWait(" | ||
- | '" | ||
- | if not @error then | ||
- | ConsoleWrite($exitcode) | ||
- | endif | ||
- | |||
- | [FilesDelete] | ||
- | delete " | ||
- | |||
- | [Sub_check_exitcode] | ||
- | comment "Test for installation success via exit code" | ||
- | set $ExitCode$ = getLastExitCode | ||
- | ; informations to exit codes see | ||
- | ; http:// | ||
- | ; http:// | ||
- | if ($ExitCode$ = " | ||
- | comment "Looks good: setup program gives exitcode zero" | ||
- | else | ||
- | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ | ||
- | if ($ExitCode$ = " | ||
- | comment " | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 1641" | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 3010" | ||
- | comment " | ||
- | else | ||
- | logError " | ||
- | isFatalError | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | |||
- | |||
- | </ | ||
- | ==== uninstall.ins ==== | ||
- | |||
- | <code winst> | ||
- | [Initial] | ||
- | LogLevel=9 | ||
- | ; 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 | ||
- | |||
- | [Actions] | ||
- | requiredWinstVersion >= " | ||
- | |||
- | DefVar $UninstallProgram32$ | ||
- | DefVar $UninstallProgram64$ | ||
- | DefVar $LogDir$ | ||
- | DefVar $ExitCode$ | ||
- | DefVar $ProductId$ | ||
- | DefVar $InstallDir32$ | ||
- | DefVar $InstallDir64$ | ||
- | DefVar $LicenseRequired$ | ||
- | DefVar $LicensePool$ | ||
- | DefVar $INST_SystemType$ | ||
- | DefVar $INST_architecture$ | ||
- | DefVar $Uninst_Cmd32$ | ||
- | DefVar $Uninst_Cmd64$ | ||
- | DefVar $Uninst_Prg$ | ||
- | |||
- | Set $INST_SystemType$ = GetSystemType | ||
- | set $INST_architecture$ = GetProductProperty(" | ||
- | |||
- | |||
- | Set $LogDir$ = " | ||
- | |||
- | ; ---------------------------------------------------------------- | ||
- | ; - Please edit the following values | ||
- | ; ---------------------------------------------------------------- | ||
- | Set $ProductId$ | ||
- | Set $InstallDir32$ | ||
- | Set $InstallDir64$ | ||
- | Set $LicenseRequired$ = " | ||
- | Set $LicensePool$ | ||
- | Set $Uninst_Prg$ | ||
- | Set $Uninst_Cmd32$ | ||
- | Set $Uninst_Cmd64$ | ||
- | ; ---------------------------------------------------------------- | ||
- | |||
- | comment "Show product picture" | ||
- | ShowBitmap " | ||
- | |||
- | Message " | ||
- | |||
- | if FileExists(" | ||
- | comment "Start uninstall sub section" | ||
- | Sub " | ||
- | endif | ||
- | |||
- | if $LicenseRequired$ = " | ||
- | comment " | ||
- | Sub_free_license | ||
- | endif | ||
- | |||
- | ExitWindows /Reboot | ||
- | |||
- | [Sub_free_license] | ||
- | comment " | ||
- | |||
- | comment " | ||
- | DefVar $result$ | ||
- | Set $result$ = FreeLicense($LicensePool$) | ||
- | ; If there is an assignment of a license pool to the product, it is possible to use | ||
- | ; Set $result$ = FreeLicense("", | ||
- | ; | ||
- | ; If there is an assignment of a license pool to a windows software id, it is possible to use | ||
- | ; DefVar $WindowsSoftwareId$ | ||
- | ; $WindowsSoftwareId$ = " | ||
- | ; set $result$ = FreeLicense("", | ||
- | |||
- | </ | ||
- | |||
- | |||
- | ==== delsub.ins ==== | ||
- | |||
- | <code winst> | ||
- | |||
- | Set $UninstallProgram32$ = $InstallDir32$+" | ||
- | Set $UninstallProgram64$ = $InstallDir64$+" | ||
- | |||
- | if (($INST_SystemType$ = "x86 System" | ||
- | Message " | ||
- | |||
- | if FileExists($UninstallProgram32$) | ||
- | comment " | ||
- | Winbatch_uninstall_32 | ||
- | comment " | ||
- | Files_uninstall_32 | ||
- | sub_check_exitcode | ||
- | endif | ||
- | endif | ||
- | |||
- | if ($INST_SystemType$ = "64 Bit System" | ||
- | Message " | ||
- | |||
- | if FileExists($UninstallProgram64$) | ||
- | comment " | ||
- | Winbatch_uninstall_64 | ||
- | comment " | ||
- | Files_uninstall_64 | ||
- | sub_check_exitcode | ||
- | endif | ||
- | endif | ||
- | |||
- | [Winbatch_uninstall_32] | ||
- | $UninstallProgram32$ $Uninst_Cmd32$ | ||
- | |||
- | |||
- | [Winbatch_uninstall_64] | ||
- | $UninstallProgram64$ $Uninst_Cmd64$ | ||
- | |||
- | [Files_uninstall_32] | ||
- | ; Example for recursively deleting the installation directory (don't forget the trailing backslash): | ||
- | ; | ||
- | delete -sf " | ||
- | |||
- | [Files_uninstall_64] | ||
- | ; Example for recursively deleting the installation directory (don't forget the trailing backslash): | ||
- | ; | ||
- | delete -sf " | ||
- | |||
- | [Sub_check_exitcode] | ||
- | comment "Test for installation success via exit code" | ||
- | set $ExitCode$ = getLastExitCode | ||
- | ; informations to exit codes see | ||
- | ; http:// | ||
- | ; http:// | ||
- | if ($ExitCode$ = " | ||
- | comment "Looks good: setup program gives exitcode zero" | ||
- | else | ||
- | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ | ||
- | if ($ExitCode$ = " | ||
- | comment " | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 1641" | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 3010" | ||
- | comment " | ||
- | else | ||
- | logError " | ||
- | isFatalError | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | |||
- | </ |