Changeset 811


Ignore:
Timestamp:
03/09/11 17:18:15 (8 years ago)
Author:
beliar
Message:

Patch by Beliar

  • Modified NSIS script to prepare for a change on how to install the module
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/active/character_customization/setup.nsi

    r808 r811  
    1919# Welcome page 
    2020!insertmacro MUI_PAGE_WELCOME 
    21  
     21!define MUI_PAGE_CUSTOMFUNCTION_PRE SelectFilesCheck 
    2222!insertmacro MUI_PAGE_COMPONENTS 
    2323 
    2424# License page 
    2525!insertmacro MUI_PAGE_LICENSE "${PARPG_DIR}\license\gpl30.license" 
    26 # Directory page 
     26# Instfiles page Externals 
     27!define MUI_PAGE_CUSTOMFUNCTION_PRE SelectFilesExternals 
     28!insertmacro MUI_PAGE_INSTFILES 
     29# Directory page PARPG 
     30!define MUI_PAGE_CUSTOMFUNCTION_PRE SelectFilesPARPG 
    2731!insertmacro MUI_PAGE_DIRECTORY 
    28 # Instfiles page 
     32# Instfiles page PARPG 
    2933!insertmacro MUI_PAGE_INSTFILES 
     34 
     35 
    3036# Finish page 
    3137!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt" 
     38!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DeleteSectionsINI 
    3239!insertmacro MUI_PAGE_FINISH 
    3340 
     
    5461 
    5562#Externals, at least Python, have to be installed first 
    56 SectionGroup Externals 
     63SectionGroup Externals Externals 
    5764#---------- DOWNLOAD PYTHON ------- 
    5865Section "ActivePython (required)" Python 
     
    106113SectionGroupEnd 
    107114 
    108 #------------ Main. Packages PARPG code -------------- 
    109 Section "PARPG" PARPG 
     115SectionGroup PARPG PARPG 
     116Section "PARPG Module" PARPG-module 
    110117  SectionIn RO 
    111  
    112118  DetailPrint "Installing PARPG python package" 
    113119  MessageBox MB_ICONINFORMATION|MB_OK "Setup will now call the PARPG python module installer. Please do not abort the installation." 
     
    116122  ExecWait "$TEMP/parpg-module.exe" $0 
    117123  Delete "parpg-module.exe" 
     124SectionEnd 
     125#------------ Main. Packages PARPG code -------------- 
     126Section "PARPG Datafiles" PARPG-data 
     127  SectionIn RO 
    118128  SetOutPath "$INSTDIR" 
    119129  !insertmacro UNINSTALL.LOG_OPEN_INSTALL 
     
    141151  SetAutoClose true 
    142152SectionEnd 
    143  
    144153# Tools not included as they aren't ready for distribution 
    145154#Section -Tools 
     
    148157#SectionEnd 
    149158 
    150 Section -AdditionalIcons 
     159Section "Additional" -AdditionalIcons 
    151160  #avoid shortcuts headaches on vista by doing everything in the all users start menu 
    152161  SetShellVarContext all 
     
    160169SectionEnd 
    161170 
    162 Section -Post 
     171Section "Post" -Post 
    163172  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "DisplayName" "$(^Name)" 
    164173  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "UninstallString" "${UNINST_EXE}" 
     
    168177  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" 
    169178SectionEnd 
     179SectionGroupEnd 
     180 
     181##=========================================================================== 
     182## Settings 
     183##=========================================================================== 
     184  
     185!define PARPG_StartIndex ${PARPG} 
     186!define PARPG_EndIndex   ${-Post} 
     187  
     188!define EXT_StartIndex ${Externals} 
     189!define EXT_EndIndex   ${OpenAL} 
    170190 
    171191Function .OnInit 
    172192  !insertmacro UNINSTALL.LOG_PREPARE_INSTALL 
     193  !insertmacro SetSectionFlag ${PARPG} ${SF_RO} 
     194  InitPluginsDir 
     195FunctionEnd 
     196 
     197## If user goes back to this page from 1st Directory page 
     198## we need to put the sections back to how they were before 
     199Var IfBack 
     200Function SelectFilesCheck 
     201 StrCmp $IfBack 1 0 NoCheck 
     202  Call ResetFiles 
     203 NoCheck: 
     204FunctionEnd 
     205 
     206Function IsExternalsSelected 
     207Push $R0 
     208Push $R1 
     209  
     210 StrCpy $R0 ${EXT_StartIndex}    # Group 2 start 
     211  
     212  Loop: 
     213   IntOp $R0 $R0 + 1 
     214   SectionGetFlags $R0 $R1                      # Get section flags 
     215    IntOp $R1 $R1 & ${SF_SELECTED} 
     216    StrCmp $R1 ${SF_SELECTED} 0 +3              # If section is selected, done 
     217     StrCpy $R0 1 
     218     Goto Done 
     219    StrCmp $R0 ${EXT_EndIndex} 0 Loop 
     220  
     221 Done: 
     222Pop $R1 
     223Exch $R0 
     224FunctionEnd 
     225 
     226## Here we are selecting first sections to install 
     227## by unselecting all the others! 
     228Function SelectFilesExternals 
     229  
     230 # If user clicks Back now, we will know to reselect Group 2's sections for 
     231 # Components page 
     232 StrCpy $IfBack 1 
     233  
     234 # We need to save the state of the Group 2 Sections 
     235 # for the next InstFiles page 
     236Push $R0 
     237Push $R1 
     238  
     239 StrCpy $R0 ${PARPG_StartIndex} # Group 2 start 
     240  
     241  Loop: 
     242   IntOp $R0 $R0 + 1 
     243   SectionGetFlags $R0 $R1                                  # Get section flags 
     244    WriteINIStr "$PLUGINSDIR\sections.ini" Sections $R0 $R1 # Save state 
     245    !insertmacro UnselectSection $R0                        # Then unselect it 
     246    StrCmp $R0 ${PARPG_EndIndex} 0 Loop 
     247  
     248 # Don't install prog 1? 
     249 Call IsExternalsSelected 
     250 Pop $R0 
     251 StrCmp $R0 1 +4 
     252  Pop $R1 
     253  Pop $R0 
     254  Abort 
     255  
     256Pop $R1 
     257Pop $R0 
     258FunctionEnd 
     259 
     260## Here we need to unselect all Group 1 sections 
     261## and then re-select those in Group 2 (that the user had selected on 
     262## Components page) 
     263Function SelectFilesPARPG 
     264Push $R0 
     265Push $R1 
     266  
     267 StrCpy $R0 ${EXT_StartIndex}    # Group 1 start 
     268  
     269  Loop: 
     270   IntOp $R0 $R0 + 1 
     271    !insertmacro UnselectSection $R0            # Unselect it 
     272    StrCmp $R0 ${EXT_EndIndex} 0 Loop 
     273  
     274 Call ResetFiles 
     275  
     276Pop $R1 
     277Pop $R0 
     278FunctionEnd 
     279 
     280## This will set all sections to how they were on the components page 
     281## originally 
     282Function ResetFiles 
     283Push $R0 
     284Push $R1 
     285  
     286 StrCpy $R0 ${PARPG_StartIndex}    # Group 2 start 
     287  
     288  Loop: 
     289   IntOp $R0 $R0 + 1 
     290   ReadINIStr "$R1" "$PLUGINSDIR\sections.ini" Sections $R0 # Get sec flags 
     291    SectionSetFlags $R0 $R1                               # Re-set flags for this sec 
     292    StrCmp $R0 ${PARPG_EndIndex} 0 Loop 
     293  
     294Pop $R1 
     295Pop $R0 
     296FunctionEnd 
     297 
     298## Here we are deleting the temp INI file at the end of installation 
     299Function DeleteSectionsINI 
     300 FlushINI "$PLUGINSDIR\Sections.ini" 
     301 Delete "$PLUGINSDIR\Sections.ini" 
    173302FunctionEnd 
    174303 
Note: See TracChangeset for help on using the changeset viewer.