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 $LogDir$
|
---|
11 | DefVar $ProductId$
|
---|
12 | DefVar $MinimumSpace$
|
---|
13 | DefVar $ExitCode$
|
---|
14 | DefVar $INST_SystemType$
|
---|
15 | DefVar $INST_architecture$
|
---|
16 |
|
---|
17 | Set $INST_SystemType$ = GetSystemType
|
---|
18 |
|
---|
19 | ;
|
---|
20 | ; get product properties for options
|
---|
21 | ;
|
---|
22 | ; multi-value values are return as string, seperated by ",", eg. "value1,value2,value3",
|
---|
23 | ; therefore we replace "," by " " (split, compose)
|
---|
24 | ;
|
---|
25 | DefVar $Options$
|
---|
26 | Set $Options$ = composeString( splitString ( GetProductProperty("options",""), "," ), " " )
|
---|
27 |
|
---|
28 | comment "options: " + $Options$
|
---|
29 |
|
---|
30 | Set $LogDir$ = "%SystemDrive%\tmp"
|
---|
31 |
|
---|
32 | ; ----------------------------------------------------------------
|
---|
33 | ; - Please edit the following values -
|
---|
34 | ; ----------------------------------------------------------------
|
---|
35 | ;$ProductId$ should be the name of the product in opsi
|
---|
36 | ; therefore please: only lower letters, no umlauts,
|
---|
37 | ; no white space use '-' as a seperator
|
---|
38 | Set $ProductId$ = "wsusoffline"
|
---|
39 | Set $MinimumSpace$ = "1000 MB"
|
---|
40 | ; ----------------------------------------------------------------
|
---|
41 |
|
---|
42 | if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
|
---|
43 | LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
|
---|
44 | isFatalError
|
---|
45 | ; Stop process and set installation status to failed
|
---|
46 | endif
|
---|
47 |
|
---|
48 | comment "Show product picture"
|
---|
49 | ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
|
---|
50 |
|
---|
51 | comment "installing"
|
---|
52 | Message "Installing " + $ProductId$ + " ..."
|
---|
53 |
|
---|
54 | comment "Start setup program"
|
---|
55 | ;Winbatch_install
|
---|
56 | Shellbatch_install /winst /sysnative
|
---|
57 |
|
---|
58 | ; include wsusoffline logfile (last 1000 lines)
|
---|
59 | includelog "%Systemroot%\wsusofflineupdate.log" "1000"
|
---|
60 |
|
---|
61 | ; check exit code, reboot is required
|
---|
62 | Sub_check_exitcode
|
---|
63 |
|
---|
64 |
|
---|
65 | [ShellBatch_install]
|
---|
66 | @rem remove old wsusoffline logfile
|
---|
67 | del /q "%Systemroot%\wsusofflineupdate.log"
|
---|
68 | call "%ScriptPath%\client\cmd\DoUpdate.cmd" $Options$
|
---|
69 | exit %ERRORLEVEL%
|
---|
70 |
|
---|
71 |
|
---|
72 | [Sub_check_exitcode]
|
---|
73 | comment "Test for installation success via exit code"
|
---|
74 | set $ExitCode$ = getLastExitCode
|
---|
75 | ; informations to exit codes see
|
---|
76 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
77 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
78 | if ($ExitCode$ = "0")
|
---|
79 | comment "Looks good: setup program gives exitcode zero"
|
---|
80 | else
|
---|
81 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
82 | if ($ExitCode$ = "1605")
|
---|
83 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
84 | comment "Uninstall of a not installed product failed - no problem"
|
---|
85 | else
|
---|
86 | if ($ExitCode$ = "1641")
|
---|
87 | comment "looks good: setup program gives exitcode 1641"
|
---|
88 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
89 | ExitWindows /Reboot
|
---|
90 | else
|
---|
91 | if ($ExitCode$ = "3010")
|
---|
92 | comment "looks good: setup program gives exitcode 3010"
|
---|
93 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
94 | ExitWindows /Reboot
|
---|
95 | else
|
---|
96 | if ($ExitCode$ = "3011")
|
---|
97 | comment "looks good: setup program gives exitcode 3011"
|
---|
98 | comment "ERROR_SUCCESS: wsusoffline requires reboot and rerun."
|
---|
99 | ExitWindows /ImmediateReboot
|
---|
100 | else
|
---|
101 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
102 | isFatalError
|
---|
103 | endif
|
---|
104 | endif
|
---|
105 | endif
|
---|
106 | endif
|
---|
107 | endif
|
---|
108 |
|
---|