1 | ; Copyright (c) uib gmbh (www.uib.de)
|
---|
2 | ; This sourcecode is owned by uib
|
---|
3 | ; and published under the Terms of the General Public License.
|
---|
4 | ; credits: http://www.opsi.org/credits/
|
---|
5 |
|
---|
6 | [Actions]
|
---|
7 | ; at least 4.11.2, tested with 4.11.3.3
|
---|
8 | requiredWinstVersion >= "4.11.3.3"
|
---|
9 |
|
---|
10 | DefVar $MsiId32$
|
---|
11 | DefVar $UninstallProgram32$
|
---|
12 | DefVar $MsiId64$
|
---|
13 | DefVar $UninstallProgram64$
|
---|
14 | DefVar $LogDir$
|
---|
15 | DefVar $ProductId$
|
---|
16 | DefVar $MinimumSpace$
|
---|
17 | DefVar $InstallDir32$
|
---|
18 | DefVar $InstallDir64$
|
---|
19 | DefVar $ExitCode$
|
---|
20 | DefVar $LicenseRequired$
|
---|
21 | DefVar $LicenseKey$
|
---|
22 | DefVar $LicensePool$
|
---|
23 | DefVar $INST_SystemType$
|
---|
24 | DefVar $INST_architecture$
|
---|
25 |
|
---|
26 | Set $INST_SystemType$ = GetSystemType
|
---|
27 |
|
---|
28 | ;
|
---|
29 | ; get product properties for options
|
---|
30 | ;
|
---|
31 | ; multi-value values are return as string, seperated by ",", eg. "value1,value2,value3",
|
---|
32 | ; therefore we replace "," by " " (split, compose)
|
---|
33 | ;
|
---|
34 | DefVar $Options$
|
---|
35 | Set $Options$ = composeString( splitString ( GetProductProperty("options",""), "," ), " " )
|
---|
36 |
|
---|
37 | comment "options: " + $Options$
|
---|
38 |
|
---|
39 | Set $LogDir$ = "%SystemDrive%\tmp"
|
---|
40 |
|
---|
41 | ; ----------------------------------------------------------------
|
---|
42 | ; - Please edit the following values -
|
---|
43 | ; ----------------------------------------------------------------
|
---|
44 | ;$ProductId$ should be the name of the product in opsi
|
---|
45 | ; therefore please: only lower letters, no umlauts,
|
---|
46 | ; no white space use '-' as a seperator
|
---|
47 | Set $ProductId$ = "wsusoffline"
|
---|
48 | Set $MinimumSpace$ = "300 MB"
|
---|
49 | ; the path were we find the product after the installation
|
---|
50 | ;Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
|
---|
51 | ;Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
|
---|
52 | ;Set $LicenseRequired$ = "false"
|
---|
53 | ;Set $LicensePool$ = "p_" + $ProductId$
|
---|
54 | ; ----------------------------------------------------------------
|
---|
55 |
|
---|
56 | if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
|
---|
57 | LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
|
---|
58 | isFatalError
|
---|
59 | ; Stop process and set installation status to failed
|
---|
60 | endif
|
---|
61 |
|
---|
62 | comment "Show product picture"
|
---|
63 | ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
|
---|
64 |
|
---|
65 | ;if FileExists("%ScriptPath%\delsub3264.ins")
|
---|
66 | ; comment "Start uninstall sub section"
|
---|
67 | ; Sub "%ScriptPath%\delsub3264.ins"
|
---|
68 | ;endif
|
---|
69 |
|
---|
70 | comment "installing"
|
---|
71 | Message "Installing " + $ProductId$ + " ..."
|
---|
72 |
|
---|
73 | comment "Start setup program"
|
---|
74 | ;Winbatch_install
|
---|
75 | Shellbatch_install /sysnative
|
---|
76 |
|
---|
77 | ; include wsusoffline logfile (last 1000 lines)
|
---|
78 | includelog "%Systemroot%\wsusofflineupdate.log" "1000"
|
---|
79 |
|
---|
80 | ; check exit code, reboot is required
|
---|
81 | Sub_check_exitcode
|
---|
82 |
|
---|
83 | ;comment "Copy files"
|
---|
84 | ;Files_install_32 /32Bit
|
---|
85 | ;comment "Patch Registry"
|
---|
86 | ;Registry_install /32Bit
|
---|
87 |
|
---|
88 |
|
---|
89 |
|
---|
90 | ;[Winbatch_install]
|
---|
91 | ;"%ScriptPath%\exit-wrapper.cmd" "%ScriptPath%\client\cmd\DoUpdate.cmd" $Options$
|
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 | [ShellBatch_install]
|
---|
96 | @rem remove old wsusoffline logfile
|
---|
97 | del /q "%Systemroot%\wsusofflineupdate.log"
|
---|
98 | call "%ScriptPath%\client\cmd\DoUpdate.cmd" $Options$
|
---|
99 | exit %ERRORLEVEL%
|
---|
100 |
|
---|
101 |
|
---|
102 |
|
---|
103 | [Files_install_32]
|
---|
104 | ; Example of recursively copying some files into the installation directory:
|
---|
105 | ;
|
---|
106 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
|
---|
107 |
|
---|
108 | [Registry_install]
|
---|
109 | ; Example of setting some values of an registry key:
|
---|
110 | ;
|
---|
111 | ; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
---|
112 | ; set "name1" = "some string value"
|
---|
113 | ; set "name2" = REG_DWORD:0001
|
---|
114 | ; set "name3" = REG_BINARY:00 af 99 cd
|
---|
115 |
|
---|
116 |
|
---|
117 | [Sub_check_exitcode]
|
---|
118 | comment "Test for installation success via exit code"
|
---|
119 | set $ExitCode$ = getLastExitCode
|
---|
120 | ; informations to exit codes see
|
---|
121 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
122 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
123 | if ($ExitCode$ = "0")
|
---|
124 | comment "Looks good: setup program gives exitcode zero"
|
---|
125 | else
|
---|
126 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
127 | if ($ExitCode$ = "1605")
|
---|
128 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
129 | comment "Uninstall of a not installed product failed - no problem"
|
---|
130 | else
|
---|
131 | if ($ExitCode$ = "1641")
|
---|
132 | comment "looks good: setup program gives exitcode 1641"
|
---|
133 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
134 | ExitWindows /Reboot
|
---|
135 | else
|
---|
136 | if ($ExitCode$ = "3010")
|
---|
137 | comment "looks good: setup program gives exitcode 3010"
|
---|
138 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
139 | ExitWindows /Reboot
|
---|
140 | else
|
---|
141 | if ($ExitCode$ = "3011")
|
---|
142 | comment "looks good: setup program gives exitcode 3011"
|
---|
143 | comment "ERROR_SUCCESS: wsusoffline requires reboot and rerun."
|
---|
144 | ExitWindows /ImmediateReboot
|
---|
145 | else
|
---|
146 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
147 | isFatalError
|
---|
148 | endif
|
---|
149 | endif
|
---|
150 | endif
|
---|
151 | endif
|
---|
152 | endif
|
---|
153 |
|
---|