source: opsi/products/bitlocker/CLIENT_DATA/setup.ins@ 1031

Last change on this file since 1031 was 1031, checked in by joergs, on Jul 12, 2012 at 2:45:19 PM

bugfix for status on 64bit

File size: 4.7 KB
Line 
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]
7requiredWinstVersion >= "4.10.8.6"
8
9DefVar $MsiId$
10DefVar $UninstallProgram$
11DefVar $LogDir$
12DefVar $ProductId$
13DefVar $MinimumSpace$
14DefVar $InstallDir$
15DefVar $ExitCode$
16DefVar $LicenseRequired$
17DefVar $LicenseKey$
18DefVar $LicensePool$
19
20DefVar $TpmPassword$
21DefVar $RecoveryPassword$
22
23Set $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
31Set $ProductId$ = "bitlocker"
32Set $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
39if 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
43else
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 /Sysnative
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 /Sysnative
71endif
72
73[ShellInAnIcon_status]
74manage-bde -status
75manage-bde -protectors c: -get
76
77[winbatch_tpm_activate]
78manage-bde -tpm -TurnOn
79
80[sub_check_exitcode_tpm_activate]
81comment "Test exit code"
82set $ExitCode$ = getLastExitCode
83if ($ExitCode$ = "0")
84 comment "Looks good: setup program gives exitcode zero. Reboot required"
85 ExitWindows /ImmediateReboot
86else
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
93endif
94
95
96[winbatch_tpm_TakeOwnerShip]
97manage-bde -tpm -TakeOwnerShip $TpmPassword$
98
99[sub_check_exitcode_tpm_TakeOwnerShip]
100comment "Test exit code"
101set $ExitCode$ = getLastExitCode
102if ($ExitCode$ = "0")
103 comment "Looks good: setup program gives exitcode zero"
104else
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
111endif
112
113[winbatch_bitlocker_activate]
114manage-bde -on c: -RecoveryPassword $RecoveryPassword$
115
116[sub_check_exitcode_bitlocker_activate]
117comment "Test exit code"
118set $ExitCode$ = getLastExitCode
119if ($ExitCode$ = "0")
120 comment "Looks good: setup program gives exitcode zero"
121 ExitWindows /Reboot
122else
123 logError "Fatal: unknown error code ("+$ExitCode$+"), giving up"
124 isFatalError
125endif
126
127
128[Sub_check_exitcode]
129comment "Test for installation success via exit code"
130set $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
134if ($ExitCode$ = "0")
135 comment "Looks good: setup program gives exitcode zero"
136else
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
155endif
156
Note: See TracBrowser for help on using the repository browser.