Changeset 808


Ignore:
Timestamp:
03/08/11 22:24:42 (8 years ago)
Author:
beliar
Message:

Patch by Beliar

  • Updated NSIS script to make it usable even when python is not installed in its default directory
  • Renamed parpg.pyw to run-parpg.pyw as its conflicts with the parpg package and
  • Reamed run-parpg.pyw to run-parpg.py since the first doesn't run
  • The NSIS script now uses Advances Uninstall Log 2.
Location:
branches/active/character_customization
Files:
1 added
1 edited

Legend:

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

    r792 r808  
    33!define PRODUCT_PUBLISHER "PARPG Development Team" 
    44!define PRODUCT_WEB_SITE "http://www.parpg.net/" 
    5 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" 
    6 !define PRODUCT_UNINST_ROOT_KEY "HKLM" 
     5!define INSTDIR_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" 
     6!define INSTDIR_REG_ROOT "HKLM" 
    77 
    88!define PARPG_DIR "game" 
    9 !define MODINSTDIR "$PROGRAMFILES\..\python27\Lib\site-packages" 
    10  
     9!define EXEC_SCRIPT_NAME "parpg-run.py" 
    1110# MUI 1.67 compatible ------ 
    1211!include "MUI.nsh" 
     12!include "AdvUninstLog2.nsh" 
    1313 
    1414# MUI Settings 
     
    2929!insertmacro MUI_PAGE_INSTFILES 
    3030# Finish page 
    31 !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\doc\README.txt" 
     31!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt" 
    3232!insertmacro MUI_PAGE_FINISH 
    3333 
     
    5151ShowUnInstDetails show 
    5252 
    53 #------------ Main. Packages PARPG code -------------- 
    54 Section "PARPG" PARPG 
    55   SectionIn RO 
    56   SetOutPath "$INSTDIR" 
    57   SetOverwrite try 
    58    
    59   # get all the core PARPG files 
    60   FILE /r /x *svn* "${PARPG_DIR}\fonts"  
    61   FILE /r /x *svn* "${PARPG_DIR}\gui"  
    62   FILE /r /x *svn* "${PARPG_DIR}\maps"  
    63   FILE /r /x *svn* "${PARPG_DIR}\music"  
    64   FILE /r /x *svn* "${PARPG_DIR}\objects"  
    65   FILE /r /x *svn* "${PARPG_DIR}\quests"  
    66   FILE /r /x *svn* "${PARPG_DIR}\character_scripts" 
    67  
    68   FILE "${PARPG_DIR}\system.cfg" 
    69   FILE "${PARPG_DIR}\README" 
    70   FILE "${PARPG_DIR}\run.py" 
    71  
    72   RENAME "README" "README.txt" 
    73   RENAME "run.py" "parpg.pyw" 
    74  
    75   CreateDirectory "$INSTDIR\saves" 
    76   CreateDirectory "$INSTDIR\screenshots" 
    77  
    78   # get the python modules 
    79   setOutPath "${MODINSTDIR}" 
    80  
    81   FILE /r /x *svn* "${PARPG_DIR}\parpg" 
    82  
    83   SetAutoClose true 
    84 SectionEnd 
    85  
    86 # Tools not included as they aren't ready for distribution 
    87 #Section -Tools 
    88   #SetOutPath "$INSTDIR\tools\map_editor" 
    89   #SetOverwrite try 
    90 #SectionEnd 
    91  
    92 Section -AdditionalIcons 
    93   #avoid shortcuts headaches on vista by doing everything in the all users start menu 
    94   SetShellVarContext all 
    95   SetOutPath $INSTDIR 
    96   WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" 
    97   CreateDirectory "$SMPROGRAMS\PARPG" 
    98   CreateShortCut "$SMPROGRAMS\PARPG\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" 
    99   CreateShortCut "$SMPROGRAMS\PARPG\Uninstall.lnk" "$INSTDIR\uninstall.exe" 
    100   SetOutPath "$INSTDIR" #this makes the following shortcut run in the installed directory 
    101   CreateShortCut "$SMPROGRAMS\PARPG\PARPG.lnk" "$INSTDIR\parpg.pyw" 
    102 SectionEnd 
    103  
    104 Section -Post 
    105   WriteUninstaller "$INSTDIR\uninstall.exe" 
    106   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" 
    107   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe" 
    108   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\gui\icons\window_icon.ico" 
    109   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" 
    110   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" 
    111   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" 
    112 SectionEnd 
    113  
    114 Function un.onUninstSuccess 
    115   HideWindow 
    116   MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." 
    117 FunctionEnd 
    118  
    119 Function un.onInit 
    120   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 
    121   Abort 
    122 FunctionEnd 
    123  
    124 Section Uninstall 
    125   #avoid shortcuts headaches on vista by doing everything in the all users start menu 
    126   SetShellVarContext all 
    127    
    128   # remove data files 
    129   RMDir /r "$INSTDIR\dialogue" 
    130   RMDir /r "$INSTDIR\fonts" 
    131   RMDir /r "$INSTDIR\gui" 
    132   RMDir /r "$INSTDIR\lib" 
    133   RMDir /r "$INSTDIR\maps" 
    134   RMDir /r "$INSTDIR\music" 
    135   RMDir /r "$INSTDIR\objects" 
    136   RMDir /r "$INSTDIR\quests" 
    137   RMDir /r "$INSTDIR\character_scripts" 
    138   RMDir "$INSTDIR\saves" #Test if the directory will get deleted when it contains files. The expected behaviour is that it will not. 
    139    
    140   Delete "$INSTDIR\parpg.pyw" 
    141   Delete "$INSTDIR\README.txt" 
    142   Delete "$INSTDIR\*.log" 
    143   Delete "$INSTDIR\${PRODUCT_NAME}.url" 
    144   Delete "$INSTDIR\uninstall.exe" 
    145    
    146   RMDir "$INSTDIR" 
    147  
    148   # Remove scripts 
    149   RMDir /r "${MODINSTDIR}\parpg" 
    150  
    151   # Remove shortcuts 
    152   RMDir /r "$SMPROGRAMS\PARPG" 
    153   
    154   # Remove Registry keys 
    155   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" 
    156   SetAutoClose true 
    157 SectionEnd 
    158  
     53!insertmacro UNATTENDED_UNINSTALL 
     54 
     55#Externals, at least Python, have to be installed first 
    15956SectionGroup Externals 
    16057#---------- DOWNLOAD PYTHON ------- 
     
    208105#--------- SECTION END ------------ 
    209106SectionGroupEnd 
    210 LangString DESC_PARPG ${LANG_ENGLISH} "PARPG - Techdemo 1 SVN r522" 
     107 
     108#------------ Main. Packages PARPG code -------------- 
     109Section "PARPG" PARPG 
     110  SectionIn RO 
     111 
     112  DetailPrint "Installing PARPG python package" 
     113  MessageBox MB_ICONINFORMATION|MB_OK "Setup will now call the PARPG python module installer. Please do not abort the installation." 
     114  SetOutPath "$TEMP" 
     115  File "parpg-module.exe" 
     116  ExecWait "$TEMP/parpg-module.exe" $0 
     117  Delete "parpg-module.exe" 
     118  SetOutPath "$INSTDIR" 
     119  !insertmacro UNINSTALL.LOG_OPEN_INSTALL 
     120  SetOverwrite try 
     121   
     122  # get all the core PARPG files 
     123  FILE /r /x *svn* "${PARPG_DIR}\fonts"  
     124  FILE /r /x *svn* "${PARPG_DIR}\gui"  
     125  FILE /r /x *svn* "${PARPG_DIR}\maps"  
     126  FILE /r /x *svn* "${PARPG_DIR}\music"  
     127  FILE /r /x *svn* "${PARPG_DIR}\objects"  
     128  FILE /r /x *svn* "${PARPG_DIR}\quests"  
     129  FILE /r /x *svn* "${PARPG_DIR}\character_scripts" 
     130 
     131  FILE "${PARPG_DIR}\README" 
     132  FILE "${PARPG_DIR}\run.py" 
     133  FILE "${PARPG_DIR}\system.cfg" 
     134   
     135  RENAME "README" "README.txt" 
     136  RENAME "run.py" "${EXEC_SCRIPT_NAME}" 
     137 
     138  CreateDirectory "$INSTDIR\saves" 
     139  CreateDirectory "$INSTDIR\screenshots" 
     140  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL 
     141  SetAutoClose true 
     142SectionEnd 
     143 
     144# Tools not included as they aren't ready for distribution 
     145#Section -Tools 
     146  #SetOutPath "$INSTDIR\tools\map_editor" 
     147  #SetOverwrite try 
     148#SectionEnd 
     149 
     150Section -AdditionalIcons 
     151  #avoid shortcuts headaches on vista by doing everything in the all users start menu 
     152  SetShellVarContext all 
     153  SetOutPath $INSTDIR 
     154  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" 
     155  CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" 
     156  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" 
     157  CreateShortcut '$SMPROGRAMS\${PRODUCT_NAME}\uninstall.lnk' '${UNINST_EXE}' 
     158  SetOutPath "$INSTDIR" #this makes the following shortcut run in the installed directory 
     159  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\PARPG.lnk" "$INSTDIR\${EXEC_SCRIPT_NAME}" 
     160SectionEnd 
     161 
     162Section -Post 
     163  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "DisplayName" "$(^Name)" 
     164  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "UninstallString" "${UNINST_EXE}" 
     165  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "DisplayIcon" "$INSTDIR\gui\icons\window_icon.ico" 
     166  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" 
     167  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" 
     168  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" 
     169SectionEnd 
     170 
     171Function .OnInit 
     172  !insertmacro UNINSTALL.LOG_PREPARE_INSTALL 
     173FunctionEnd 
     174 
     175Function .onInstSuccess 
     176  !insertmacro UNINSTALL.LOG_UPDATE_INSTALL 
     177FunctionEnd 
     178 
     179Function un.onUninstSuccess 
     180  HideWindow 
     181  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." 
     182FunctionEnd 
     183 
     184Function un.onInit 
     185  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 
     186  Abort 
     187FunctionEnd 
     188 
     189Section Uninstall 
     190  #avoid shortcuts headaches on vista by doing everything in the all users start menu 
     191  SetShellVarContext all 
     192   
     193  # remove data files 
     194  !insertmacro UNINSTALL.NEW_UNINSTALL "$INSTDIR" 
     195   
     196  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" 
     197  Delete "$SMPROGRAMS\${PRODUCT_NAME}\PARPG.lnk" 
     198  Delete "$SMPROGRAMS\${PRODUCT_NAME}\uninstall.lnk" 
     199  RmDir "$SMPROGRAMS\${PRODUCT_NAME}" 
     200   
     201  Delete "$INSTDIR\*.log" 
     202  Delete "$INSTDIR\system.cfg" 
     203  Delete "$INSTDIR\${PRODUCT_NAME}.url" 
     204   
     205  RMDir "$INSTDIR" 
     206 
     207  # Remove shortcuts 
     208  RMDir /r "$SMPROGRAMS\PARPG" 
     209  
     210  # Remove Registry keys 
     211  DeleteRegKey ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" 
     212  SetAutoClose true 
     213SectionEnd 
     214 
     215 
     216LangString DESC_PARPG ${LANG_ENGLISH} "PARPG - Techdemo 1 SVN r788" 
    211217LangString DESC_Python ${LANG_ENGLISH} "ActivePython 2.6.4.8 - Required to run PARPG. Requires an active internet connection to install." 
    212218LangString DESC_FIFE ${LANG_ENGLISH} "FIFE 0.3.0 SVN trunk r3236 - Required to run PARPG." 
Note: See TracChangeset for help on using the changeset viewer.