Changeset 1035 for opsi


Ignore:
Timestamp:
07/12/12 17:43:24 (8 years ago)
Author:
joergs
Message:

some Windows 7 system not as expected and return errorcode 0 instead of -1, therefore use registry RebootCounter to cound number of reboots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • opsi/products/bitlocker/CLIENT_DATA/setup.ins

    r1033 r1035  
    1717DefVar $LicenseKey$
    1818DefVar $LicensePool$
     19
     20DefVar $RegKeyRebootCounter$
     21DefVar $RebootCounter$
     22Set    $RegKeyRebootCounter$ = "[HKLM\SOFTWARE\opsi.org\custom\bitlocker]"
     23
    1924
    2025DefVar $TpmPassword$
     
    4954        ;       Sub "%ScriptPath%\delsub.ins"
    5055        ;endif
     56
     57    sub_get_rebootcounter
     58    comment "rebootcounter = $RebootCounter$"
     59
    5160       
    52         Message "Installing " + $ProductId$ + " ..."
     61        Message "Installing " + $ProductId$ + ", Counter: " + $RebootCounter$
    5362       
    5463        comment "Start setup program"
     
    5968        ShellInAnIcon_status winst /sysnative
    6069
    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 winst /sysnative
     70    if (( $RebootCounter$ = "" ) or ( $RebootCounter$ = "0" ))
     71        #winbatch_tpm_activate
     72        #sub_check_exitcode_tpm_activate
     73        ShellInAnIcon_tpm_activate winst /sysnative
     74        set $RebootCounter$ = "1"
     75        sub_do_reboot
     76    endif
     77
     78    #winbatch_tpm_TakeOwnerShip
     79    #sub_check_exitcode_tpm_TakeOwnerShip
     80    ShellInAnIcon_tpm_TakeOwnerShip winst /sysnative
     81
     82    #winbatch_bitlocker_activate
     83    #sub_check_exitcode_bitlocker_activate
     84    ShellInAnIcon_tpm_bitlocker_activate winst /sysnative
     85    ExitWindows /Reboot
     86
     87    ShellInAnIcon_status winst /sysnative
    7188endif
    7289
     
    7592manage-bde -protectors c: -get
    7693
     94[ShellInAnIcon_tpm_activate]
     95manage-bde -tpm -TurnOn
     96
    7797[winbatch_tpm_activate]
    7898manage-bde -tpm -TurnOn
     
    80100[sub_check_exitcode_tpm_activate]
    81101comment "Test exit code"
     102# WARNING:
     103#   There are systems, that return 0, even if the TPM is already activated.
     104#   This results in an endless loop
     105#
    82106set $ExitCode$ = getLastExitCode
    83107if ($ExitCode$ = "0")
     
    94118
    95119
     120
     121[ShellInAnIcon_tpm_TakeOwnerShip]
     122manage-bde -tpm -TakeOwnerShip $TpmPassword$
     123
    96124[winbatch_tpm_TakeOwnerShip]
    97125manage-bde -tpm -TakeOwnerShip $TpmPassword$
     
    101129set $ExitCode$ = getLastExitCode
    102130if ($ExitCode$ = "0")
    103         comment "Looks good: setup program gives exitcode zero"
     131    comment "Looks good: setup program gives exitcode zero"
    104132else
    105133        if ($ExitCode$ = "-1")
    106134                comment "TPM has an owner. ignored"
    107135        else
    108                 logError "Fatal: unknown error code ("+$ExitCode$+"), giving up"
    109                 isFatalError
     136        logError "Fatal: unknown error code ("+$ExitCode$+"), giving up"
     137        isFatalError
    110138        endif
    111139endif
     140
     141[ShellInAnIcon_bitlocker_activate]
     142manage-bde -on c: -RecoveryPassword $RecoveryPassword$
    112143
    113144[winbatch_bitlocker_activate]
     
    118149set $ExitCode$ = getLastExitCode
    119150if ($ExitCode$ = "0")
    120         comment "Looks good: setup program gives exitcode zero"
    121         ExitWindows /Reboot
     151    comment "Looks good: setup program gives exitcode zero"
     152    ExitWindows /Reboot
    122153else
    123                 logError "Fatal: unknown error code ("+$ExitCode$+"), giving up"
    124                 isFatalError
     154    logError "Fatal: unknown error code ("+$ExitCode$+"), giving up"
     155    isFatalError
    125156endif
    126157
     
    155186endif
    156187
     188[sub_get_rebootcounter]
     189    Set $RebootCounter$ = GetRegistryStringValue( $RegKeyRebootCounter$ + "RebootCounter")
     190    if ( $RebootCounter$ = "" )
     191        set $RebootCounter$ = "0"
     192    endif
     193
     194[sub_set_rebootcounter]
     195    if ( $RebootCounter$ = "" )
     196        set $RebootCounter$ = "0"
     197    endif
     198    registry_rebootcounter
     199
     200[sub_do_reboot]
     201    sub_set_rebootcounter
     202    ExitWindows /ImmediateReboot
     203
     204[registry_rebootcounter]
     205openkey $RegKeyRebootCounter$
     206set "RebootCounter" = "$Rebootcounter$"
Note: See TracChangeset for help on using the changeset viewer.