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/en/credits/
|
---|
5 |
|
---|
6 | [Actions]
|
---|
7 | requiredWinstVersion >= "4.10.8.6"
|
---|
8 |
|
---|
9 | DefVar $MsiId$
|
---|
10 | DefVar $UninstallProgram$
|
---|
11 | DefVar $LogDir$
|
---|
12 | DefVar $ProductId$
|
---|
13 | DefVar $MinimumSpace$
|
---|
14 | DefVar $InstallDir$
|
---|
15 | DefVar $ExitCode$
|
---|
16 | DefVar $LicenseRequired$
|
---|
17 | DefVar $LicenseKey$
|
---|
18 | DefVar $LicensePool$
|
---|
19 |
|
---|
20 | DefVar $TpmPassword$
|
---|
21 | DefVar $RecoveryPassword$
|
---|
22 |
|
---|
23 | Set $LogDir$ = "%SystemDrive%\tmp"
|
---|
24 |
|
---|
25 | ; ----------------------------------------------------------------
|
---|
26 | ; - Please edit the following values -
|
---|
27 | ; ----------------------------------------------------------------
|
---|
28 | ;$ProductId$ should be the name of the product in opsi
|
---|
29 | ; therefore please: only lower letters, no umlauts,
|
---|
30 | ; no white space use '-' as a seperator
|
---|
31 | Set $ProductId$ = "bitlocker"
|
---|
32 | Set $MinimumSpace$ = "1 MB"
|
---|
33 | ; the path were we find the product after the installation
|
---|
34 | ;Set $InstallDir$ = "%ProgramFiles32Dir%\<path to the product>"
|
---|
35 | ;Set $LicenseRequired$ = "false"
|
---|
36 | ;Set $LicensePool$ = "p_" + $ProductId$
|
---|
37 | ; ----------------------------------------------------------------
|
---|
38 |
|
---|
39 | if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
|
---|
40 | LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
|
---|
41 | isFatalError
|
---|
42 | ; Stop process and set installation status to failed
|
---|
43 | else
|
---|
44 | comment "Show product picture"
|
---|
45 | ShowBitmap "%ScriptPath%\logo.png" $ProductId$
|
---|
46 |
|
---|
47 | ;if FileExists("%ScriptPath%\delsub.ins")
|
---|
48 | ; comment "Start uninstall sub section"
|
---|
49 | ; Sub "%ScriptPath%\delsub.ins"
|
---|
50 | ;endif
|
---|
51 |
|
---|
52 | Message "Installing " + $ProductId$ + " ..."
|
---|
53 |
|
---|
54 | comment "Start setup program"
|
---|
55 |
|
---|
56 | set $TpmPassword$ = GetProductProperty("TpmPassword", "none")
|
---|
57 | set $RecoveryPassword$ = GetProductProperty("RecoveryPassword", "none")
|
---|
58 |
|
---|
59 | ShellInAnIcon_status
|
---|
60 |
|
---|
61 | winbatch_tpm_activate
|
---|
62 | sub_check_exitcode_tpm_activate
|
---|
63 |
|
---|
64 | winbatch_tpm_TakeOwnerShip
|
---|
65 | sub_check_exitcode_tpm_TakeOwnerShip
|
---|
66 |
|
---|
67 | winbatch_bitlocker_activate
|
---|
68 | sub_check_exitcode_bitlocker_activate
|
---|
69 |
|
---|
70 | ShellInAnIcon_status
|
---|
71 | endif
|
---|
72 |
|
---|
73 | [ShellInAnIcon_status]
|
---|
74 | manage-bde -status
|
---|
75 | manage-bde -protectors c: -get
|
---|
76 |
|
---|
77 | [winbatch_tpm_activate]
|
---|
78 | manage-bde -tpm -TurnOn
|
---|
79 |
|
---|
80 | [sub_check_exitcode_tpm_activate]
|
---|
81 | comment "Test exit code"
|
---|
82 | set $ExitCode$ = getLastExitCode
|
---|
83 | if ($ExitCode$ = "0")
|
---|
84 | comment "Looks good: setup program gives exitcode zero. Reboot required"
|
---|
85 | ExitWindows /ImmediateReboot
|
---|
86 | else
|
---|
87 | if ($ExitCode$ = "-1")
|
---|
88 | comment "TPM is already activated, ignored"
|
---|
89 | else
|
---|
90 | logError "Fatal: unknown error code ("+$ExitCode$+"), giving up"
|
---|
91 | isFatalError
|
---|
92 | endif
|
---|
93 | endif
|
---|
94 |
|
---|
95 |
|
---|
96 | [winbatch_tpm_TakeOwnerShip]
|
---|
97 | manage-bde -tpm -TakeOwnerShip $TpmPassword$
|
---|
98 |
|
---|
99 | [sub_check_exitcode_tpm_TakeOwnerShip]
|
---|
100 | comment "Test exit code"
|
---|
101 | set $ExitCode$ = getLastExitCode
|
---|
102 | if ($ExitCode$ = "0")
|
---|
103 | comment "Looks good: setup program gives exitcode zero"
|
---|
104 | else
|
---|
105 | if ($ExitCode$ = "-1")
|
---|
106 | comment "TPM has an owner. ignored"
|
---|
107 | else
|
---|
108 | logError "Fatal: unknown error code ("+$ExitCode$+"), giving up"
|
---|
109 | isFatalError
|
---|
110 | endif
|
---|
111 | endif
|
---|
112 |
|
---|
113 | [winbatch_bitlocker_activate]
|
---|
114 | manage-bde -on c: -RecoveryPassword $RecoveryPassword$
|
---|
115 |
|
---|
116 | [sub_check_exitcode_bitlocker_activate]
|
---|
117 | comment "Test exit code"
|
---|
118 | set $ExitCode$ = getLastExitCode
|
---|
119 | if ($ExitCode$ = "0")
|
---|
120 | comment "Looks good: setup program gives exitcode zero"
|
---|
121 | ExitWindows /Reboot
|
---|
122 | else
|
---|
123 | logError "Fatal: unknown error code ("+$ExitCode$+"), giving up"
|
---|
124 | isFatalError
|
---|
125 | endif
|
---|
126 |
|
---|
127 |
|
---|
128 | [Sub_check_exitcode]
|
---|
129 | comment "Test for installation success via exit code"
|
---|
130 | set $ExitCode$ = getLastExitCode
|
---|
131 | ; informations to exit codes see
|
---|
132 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
133 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
134 | if ($ExitCode$ = "0")
|
---|
135 | comment "Looks good: setup program gives exitcode zero"
|
---|
136 | else
|
---|
137 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
138 | if ($ExitCode$ = "1605")
|
---|
139 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
140 | comment "Uninstall of a not installed product failed - no problem"
|
---|
141 | else
|
---|
142 | if ($ExitCode$ = "1641")
|
---|
143 | comment "looks good: setup program gives exitcode 1641"
|
---|
144 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
145 | else
|
---|
146 | if ($ExitCode$ = "3010")
|
---|
147 | comment "looks good: setup program gives exitcode 3010"
|
---|
148 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
149 | else
|
---|
150 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
151 | isFatalError
|
---|
152 | endif
|
---|
153 | endif
|
---|
154 | endif
|
---|
155 | endif
|
---|
156 |
|
---|