; 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.10.8.6" DefVar $MsiId32$ DefVar $UninstallProgram32$ DefVar $MsiId64$ DefVar $UninstallProgram64$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir32$ DefVar $InstallDir64$ DefVar $ExitCode$ DefVar $LicenseRequired$ DefVar $LicenseKey$ DefVar $LicensePool$ DefVar $INST_SystemType$ DefVar $INST_architecture$ Set $INST_SystemType$ = GetSystemType set $INST_architecture$ = GetProductProperty("install_architecture","system specific") Set $LogDir$ = "%SystemDrive%\tmp" DefVar $MSVersion$ Set $MSVersion$ = GetMsVersionInfo DefVar $win8_net3.5$ Set $win8_net3.5$ = GetProductProperty("win8_net3.5", "1") DefVar $java_reinstall$ Set $java_reinstall$ = GetProductProperty("java_reinstall", "1") DefVar $extract_install$ Set $extract_install$ = GetProductProperty("extract_install", "0") DefVar $extract_use$ Set $extract_use$ = GetProductProperty("extract_use", "0") DefVar $connection_set_max_latency$ Set $connection_set_max_latency$ = GetProductProperty("connection_set_max_latency", "30") DefVar $connection_wan$ DefStringList $Output$ DefVar $timer_value$ Set $timer_value$ = GetProductProperty("timer_value", "40") DefVar $timer_enabled$ Set $timer_enabled$ = GetProductProperty("timer_enabled", "1") DefVar $inst_net1.1$ Set $inst_net1.1$ = GetProductProperty("inst_net1.1", "1") DefVar $inst_net2.0$ Set $inst_net2.0$ = GetProductProperty("inst_net2.0", "1") DefVar $inst_net3.0$ Set $inst_net3.0$ = GetProductProperty("inst_net3.0", "1") DefVar $inst_net3.5$ Set $inst_net3.5$ = GetProductProperty("inst_net3.5", "1") DefVar $inst_net4.0$ Set $inst_net4.0$ = GetProductProperty("inst_net4.0", "0") DefVar $inst_net4.5$ Set $inst_net4.5$ = GetProductProperty("inst_net4.5", "1") DefVar $inst_msjsharp$ Set $inst_msjsharp$ = GetProductProperty("inst_msjsharp", "1") DefVar $inst_silver$ Set $inst_silver$ = GetProductProperty("inst_silver", "1") DefVar $inst_jre7$ Set $inst_jre7$ = GetProductProperty("inst_jre7", "1") DefVar $inst_AdobeShock$ Set $inst_AdobeShock$ = GetProductProperty("inst_AdobeShock", "1") DefVar $inst_basicruntimes$ Set $inst_basicruntimes$ = GetProductProperty("inst_basicruntimes", "1") DefVar $inst_msdx9$ Set $inst_msdx9$ = GetProductProperty("inst_msdx9", "1") DefVar $inst_msdxm$ Set $inst_msdxm$ = GetProductProperty("inst_msdxm", "1") DefVar $inst_msvc$ Set $inst_msvc$ = GetProductProperty("inst_msvc", "1") DefVar $inst_AdobeFlash$ Set $inst_AdobeFlash$ = GetProductProperty("inst_AdobeFlash", "1") ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: ; from builder-product.cfg : all variables definded by attribute WINST[index] ; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE ; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL ; auto generated winst-variables ; $IconFile$: path to product picture ; @@BUILDER_VARIABLES@@ ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- ;$ProductId$ should be the name of the product in opsi ; therefore please: only lower letters, no umlauts, ; no white space use '-' as a seperator Set $ProductId$ = "sereby.aio" Set $MinimumSpace$ = "400 MB" ; the path were we find the product after the installation Set $InstallDir32$ = "%ProgramFiles32Dir%\aio" Set $InstallDir64$ = "%ProgramFiles64Dir%\aio" 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 "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ ; if FileExists("%ScriptPath%\delsub.ins") ; comment "Start uninstall sub section" ; Sub "%ScriptPath%\delsub.ins" ; endif if $LicenseRequired$ = "true" comment "Licensing required, reserve license and get license key" Sub_get_licensekey 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 "Install Netframework 2.0 - 3.5 for Windows 8" if ( $MSVersion$ = "6.2" ) and ($win8_net3.5$ = "1") and not (FileExists("%Systemroot%\Microsoft.NET\Framework\v3.5\Microsoft.Build.Tasks.v3.5.dll")) if (FileExists("%ScriptPath%\X86\net3.5-win8\sources\sxs\amd64_addinprocess32_b77a5c561934e089_6.2.9200.16384_none_d9d957a176ab19d8\addinprocess32.exe")) Message "Install Netframework 2.0 - 3.5 for Windows 8" Dosbatch_install_dotNet_2-3.5_8 winst /SysNative else LogError "Not compatible without Netframework 3.5 for Windows 8" isFatalError endif endif comment "Reinstall Java" if ($java_reinstall$ = "1") Message "Uninstalling " + "Java" + " 32 + 64 Bit..." Dosbatch_java_reinstall endif comment "Install the extracted version of the sereby packet on opsiserver" if (($extract_install$ = "1") and not (FileExists("%ScriptPath%\X86\sereby\extracted\WinPKG.exe"))) Message "Installing extracted " + $ProductId$ + " on depotserver..." Dosbatch_extract_install endif comment "Get connection latency between server and client" if ($extract_use$ = "auto") Message "Get connection latency..." Dosbatch_get_connection_latency Set $Output$ = getOutStreamFromSection('Dosbatch_get_connection_latency') Set $connection_wan$ = takeFirstStringContaining($Output$, "opsi wan mode : ") Set $connection_wan$ = TakeString(1, SplitString($connection_wan$, " : ")) endif comment "Build sereby configuration" Message "Build sereby configuration" Dosbatch_build_config winst /SysNative comment "Choose version to install" if (($extract_use$ = "1") or (($extract_use$ = "auto") and ($connection_wan$ = "1"))) Message "Installing extracted " + $ProductId$ + " 32 Bit..." comment "Start extracted setup program" Dosbatch_install_extracted_32 Sub_check_exitcode else Message "Installing " + $ProductId$ + " 32 Bit..." comment "Start setup program" Winbatch_install_32 Sub_check_exitcode endif comment "Copy files" Files_install_32 /32Bit comment "Patch Registry" Registry_install /32Bit comment "Create shortcuts" LinkFolder_install 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 "Install Netframework 2.0 - 3.5 for Windows 8" if ( $MSVersion$ = "6.2" ) and ($win8_net3.5$ = "1") and not (FileExists("%Systemroot%\Microsoft.NET\Framework\v3.5\Microsoft.Build.Tasks.v3.5.dll")) if (FileExists("%ScriptPath%\X86\net3.5-win8\sources\sxs\amd64_addinprocess32_b77a5c561934e089_6.2.9200.16384_none_d9d957a176ab19d8\addinprocess32.exe")) Message "Install Netframework 2.0 - 3.5 for Windows 8" Dosbatch_install_dotNet_2-3.5_8 winst /SysNative else LogError "Not compatible without Netframework 3.5 for Windows 8" isFatalError endif endif comment "Reinstall Java" if ($java_reinstall$ = "1") Message "Uninstalling " + "Java" + " 32 + 64 Bit..." Dosbatch_java_reinstall endif comment "Install the extracted version of the sereby packet on opsiserver" if (($extract_install$ = "1") and not (FileExists("%ScriptPath%\X86\sereby\extracted\WinPKG.exe"))) Message "Installing extracted " + $ProductId$ + " on depotserver..." Dosbatch_extract_install endif comment "Get connection latency between server and client" if ($extract_use$ = "auto") Message "Get connection latency..." Dosbatch_get_connection_latency Set $Output$ = getOutStreamFromSection('Dosbatch_get_connection_latency') Set $connection_wan$ = takeFirstStringContaining($Output$, "opsi wan mode : ") Set $connection_wan$ = TakeString(1, SplitString($connection_wan$, " : ")) endif comment "Build sereby configuration" Message "Build sereby configuration" Dosbatch_build_config winst /SysNative comment "Choose version to install" if (($extract_use$ = "1") or (($extract_use$ = "auto") and ($connection_wan$ = "1"))) Message "Installing extracted " + $ProductId$ + " 64 Bit..." comment "Start extracted setup program" Dosbatch_install_extracted_32 Sub_check_exitcode else Message "Installing " + $ProductId$ + " 64 Bit..." comment "Start setup program" Winbatch_install_64 Sub_check_exitcode endif comment "Copy files" Files_install_64 /64Bit comment "Patch Registry" Registry_install /64Bit comment "Create shortcuts" LinkFolder_install endif comment "Reboot" ExitWindows /Reboot endif [Dosbatch_install_dotNet_2-3.5_8] dism /online /enable-feature /featurename:NetFx3 /All /Source:%ScriptPath%\X86\net3.5-win8\sources\sxs /LimitAccess [Dosbatch_java_reinstall] cscript /nologo "%ScriptPath%\X86\java\JavaUninstallScript.vbs" /keeponly [Dosbatch_extract_install] @echo off &setlocal "$Install32Exe$" -gm0 -nr echo Ident opsi Server echo . for /f "tokens=2 delims=\" %%a in ('net use p:') do set "opsiservername=%%a" echo opsi Server: %opsiservername% @echo off net use x: \\%opsiservername%\opt_pcbin net use p: /delete /yes net use p: \\%opsiservername%\opt_pcbin\install xcopy "%SystemDrive%\AiO-Files\*.*" "%ScriptPath%\X86\sereby\extracted\" /S /E /D /Y rd "%SystemDrive%\AiO-Files" /S /Q net use p: /delete /yes net use p: \\%opsiservername%\opsi_depot net use x: /delete /yes [Dosbatch_get_connection_latency] @echo off setlocal enabledelayedexpansion echo Ident opsi Server echo . for /f "tokens=2 delims=\" %%a in ('net use p:') do set "opsiservername=%%a" echo opsi Server : %opsiservername% for /f "tokens=4 delims='='" %%a in ('ping %opsiservername% -n 10') do set "opsiserverping=%%a" set Latenzms=!opsiserverping:~1,10! echo Latenz in ms : %Latenzms% for /f "tokens=1 delims=m" %%a in ('@echo %Latenzms%') do set "Latenz=%%a" echo Latenz : %Latenz% if %Latenz% GTR $connection_set_max_latency$ (set wan=1) else (set wan=0) @echo opsi wan mode : %wan% [Dosbatch_build_config] copy "%ScriptPath%\X86\winpkg\WinPKG.xml" "$LogDir$" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/timer[@value=40]/@value" -v $timer_value$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/timer[@enabled=1]/@enabled" -v $timer_enabled$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='net1.1']/@checked" -v $inst_net1.1$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='net2.0']/@checked" -v $inst_net2.0$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='net3.0']/@checked" -v $inst_net3.0$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='net3.5']/@checked" -v $inst_net3.5$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='net4.0']/@checked" -v $inst_net4.0$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='net4.5']/@checked" -v $inst_net4.5$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='msjsharp']/@checked" -v $inst_msjsharp$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='silver']/@checked" -v $inst_silver$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='jre7']/@checked" -v $inst_jre7$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='AdobeShock']/@checked" -v $inst_AdobeShock$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='basicruntimes']/@checked" -v $inst_basicruntimes$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='msdx9']/@checked" -v $inst_msdx9$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='msdxm']/@checked" -v $inst_msdxm$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='msvc']/@checked" -v $inst_msvc$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old" xml ed -O -u "/settings/set[@component='AdobeFlash']/@checked" -v $inst_AdobeFlash$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml" move $LogDir$\WinPKG.xml "%System%" del $LogDir$\WinPKG.xml.old [Dosbatch_install_extracted_32] @echo off p: cd "%ScriptPath%\X86\sereby\extracted" "$Install_extracted_32Exe$" [Winbatch_install_32] ; Choose one of the following examples as basis for your installation ; You can use $LicenseKey$ var to pass a license key to the installer ; ; === Nullsoft Scriptable Install System ================================================================ "$Install32Exe$" [Files_install_32] ; Example of recursively copying some files into the installation directory: ; ; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$" [Dosbatch_install_extracted_64] @echo off p: cd "%ScriptPath%\X86\sereby\extracted" "$Install_extracted_64Exe$" [Winbatch_install_64] ; Choose one of the following examples as basis for your installation ; You can use $LicenseKey$ var to pass a license key to the installer ; ; === MSI package ======================================================================================= "$Install64Exe$" [Files_install_64] ; Example of recursively copying some files into the installation directory: ; ; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$" [Registry_install] ; Example of setting some values of an registry key: ; ; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] ; set "name1" = "some string value" ; set "name2" = REG_DWORD:0001 ; set "name3" = REG_BINARY:00 af 99 cd [LinkFolder_install] ; Example of deleting a folder from AllUsers startmenu: ; ; set_basefolder common_programs ; delete_subfolder $ProductId$ ; ; Example of creating an shortcut to the installed exe in AllUsers startmenu: ; ; set_basefolder common_programs ; set_subfolder $ProductId$ ; ; set_link ; name: $ProductId$ ; target: ; parameters: ; working_dir: $InstallDir$ ; icon_file: ; icon_index: ; end_link ; ; Example of creating an shortcut to the installed exe on AllUsers desktop: ; ; set_basefolder common_desktopdirectory ; set_subfolder "" ; ; set_link ; name: $ProductId$ ; target: ; parameters: ; working_dir: $InstallDir$ ; icon_file: ; icon_index: 2 ; end_link [Sub_get_licensekey] if opsiLicenseManagementEnabled comment "License management is enabled and will be used" comment "Trying to get a license key" Set $LicenseKey$ = demandLicenseKey ($LicensePool$) ; If there is an assignment of exactly one licensepool to the product the following call is possible: ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$) ; ; If there is an assignment of a license pool to a windows software id, it is possible to use: ; DefVar $WindowsSoftwareId$ ; $WindowsSoftwareId$ = "..." ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$) DefVar $ServiceErrorClass$ set $ServiceErrorClass$ = getLastServiceErrorClass comment "Error class: " + $ServiceErrorClass$ if $ServiceErrorClass$ = "None" comment "Everything fine, we got the license key '" + $LicenseKey$ + "'" else if $ServiceErrorClass$ = "LicenseConfigurationError" LogError "Fatal: license configuration must be corrected" LogError getLastServiceErrorMessage isFatalError else if $ServiceErrorClass$ = "LicenseMissingError" LogError "Fatal: required license is not supplied" isFatalError endif endif endif else LogError "Fatal: license required, but license management not enabled" isFatalError 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 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