updated nsis script

- omni-bot files are now fetched online
- fixed a bug in the required space count
- some cleaning
This commit is contained in:
Remy Marquis 2013-10-24 17:24:05 +02:00
parent 875d294c24
commit 06e3cc1e30

View file

@ -1,10 +1,21 @@
; ------------------------
; ET:Legacy NSIS installer
; ------------------------
; Files should be in ./etlegacy-windows-${VERSION}
; Before runing NSIS, ensure to
; - add NSIS zip plug-in in the current folder (download at http://nsis.sourceforge.net/ZipDLL_plug-in)
; - add ET:Legacy binary files in a ."/etlegacy-windows-${VERSION}" subfolder without omni-bot files.
; - change the version number below. You don't need to change anything else.
!define VERSION "2.71rc3"
; ------------------------
; GENERAL
; ------------------------
!addplugindir "."
CRCCheck on
RequestExecutionLevel admin
; Variables
Name "ET:Legacy ${VERSION}"
OutFile "etlegacy-windows-${VERSION}-full-installer.exe"
@ -14,13 +25,6 @@ BrandingText "ET:Legacy ${VERSION} | http://www.etlegacy.com"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "InstallPath"
InstallDir "$PROGRAMFILES\Enemy Territory - Legacy\"
; ------------------------
; GENERAL
; ------------------------
CRCCheck on
RequestExecutionLevel admin
; Header file
!include MUI2.nsh
@ -62,7 +66,6 @@ RequestExecutionLevel admin
Section "Enemy Territory: Legacy" FILES
SectionIn RO
SetOverwrite ifnewer
AddSize 75000 ; approx
SetOutPath $INSTDIR
File /r "etlegacy-windows-${VERSION}\*.*"
SectionEnd
@ -79,7 +82,7 @@ Section "Wolfenstein: Enemy Territory assets" ASSETS
IfFileExists "$1\etmain\pak0.pk3" 0 +3
copyfiles "$1\etmain\pak0.pk3" "$INSTDIR\etmain\"
GOTO COPY_PAK1
IfFileExists '$TEMP\etl_install\pak0.pk3' 0 GET_INSTALL
IfFileExists "$TEMP\etl_install\pak0.pk3" 0 GET_INSTALL
copyfiles "$TEMP\etl_install\pak0.pk3" "$INSTDIR\etmain\"
GOTO COPY_PAK1
@ -88,7 +91,7 @@ Section "Wolfenstein: Enemy Territory assets" ASSETS
IfFileExists "$1\etmain\pak1.pk3" 0 +3
copyfiles "$1\etmain\pak1.pk3" "$INSTDIR\etmain\"
GOTO COPY_PAK2
IfFileExists '$TEMP\etl_install\pak1.pk3' 0 GET_PATCH
IfFileExists "$TEMP\etl_install\pak1.pk3" 0 GET_PATCH
copyfiles "$TEMP\etl_install\pak1.pk3" "$INSTDIR\etmain\"
GOTO COPY_PAK2
@ -97,7 +100,7 @@ Section "Wolfenstein: Enemy Territory assets" ASSETS
IfFileExists "$1\etmain\pak2.pk3" 0 +3
copyfiles "$1\etmain\pak2.pk3" "$INSTDIR\etmain\"
GOTO COPY_MP_BIN
IfFileExists '$TEMP\etl_install\pak2.pk3' 0 GET_PATCH
IfFileExists "$TEMP\etl_install\pak2.pk3" 0 GET_PATCH
copyfiles "$TEMP\etl_install\pak2.pk3" "$INSTDIR\etmain\"
GOTO COPY_MP_BIN
@ -106,7 +109,7 @@ Section "Wolfenstein: Enemy Territory assets" ASSETS
IfFileExists "$1\etmain\mp_bin.pk3" 0 +3
copyfiles "$1\etmain\mp_bin.pk3" "$INSTDIR\etmain\"
GOTO END
IfFileExists '$TEMP\etl_install\mp_bin.pk3' 0 GET_PATCH
IfFileExists "$TEMP\etl_install\mp_bin.pk3" 0 GET_PATCH
copyfiles "$TEMP\etl_install\mp_bin.pk3" "$INSTDIR\etmain\"
GOTO END
@ -130,7 +133,7 @@ Section "Wolfenstein: Enemy Territory assets" ASSETS
ExecWait "$TEMP\WolfET.exe /x $TEMP\etl_install"
IfFileExists "$TEMP\etl_install\pak0.pk3" +2
MessageBox MB_ICONEXCLAMATION|MB_OK "Fatal Error: Installer extraction failed."
copyfiles '$TEMP\etl_install\pak0.pk3' '$INSTDIR\etmain'
copyfiles "$TEMP\etl_install\pak0.pk3" "$INSTDIR\etmain"
IfFileExists "$INSTDIR\etmain\pak0.pk3" COPY_PAK1
MessageBox MB_ICONEXCLAMATION|MB_OK "Fatal Error: Copy failed (pak0.pk3)."
@ -170,6 +173,30 @@ Section "Wolfenstein: Enemy Territory assets" ASSETS
END:
SectionEnd
Section "Omni-Bot" OMNIBOT
AddSize 65000 ; approx
SetOutPath $TEMP
GOTO GET_BOT
GET_BOT:
IfFileExists "$TEMP\omnibot-windows-latest.zip" UNPACK_BOT
NSISdl::download "http://mirror.etlegacy.com/omnibot/omnibot-windows-latest.zip" omnibot-windows-latest.zip
IfFileExists "$TEMP\omnibot-windows-latest.zip" UNPACK_BOT
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Download Error: Couldn't fetch Omni-bot file." \
IDCANCEL END IDRETRY GET_BOT
UNPACK_BOT:
ZipDLL::extractall "$TEMP\omnibot-windows-latest.zip" "$INSTDIR\legacy\omni-bot"
IfFileExists "$INSTDIR\legacy\omni-bot\*.*" END
MessageBox MB_ICONEXCLAMATION|MB_OK "Fatal Error: Omni-bot extraction failed."
END:
SetOutPath $INSTDIR
CreateDirectory "$SMPROGRAMS\Enemy Territory - Legacy"
CreateShortCut "$SMPROGRAMS\Enemy Territory - Legacy\Enemy Territory - Legacy with Omni-Bots.lnk" "$INSTDIR\etl.exe" "+set omni_bot enable 1 +set omnibot_path legacy\omni-bot\"
SectionEnd
Section "Protocol registration" URI
WriteRegStr HKCR "et" "URL Protocol" ""
WriteRegStr HKCR "et" "" "URL: Enemy Territory Protocol"
@ -204,18 +231,15 @@ Section -ETKEY
SectionEnd
Section -Shortcuts
SetOverwrite on
SetOutPath $INSTDIR
CreateDirectory "$SMPROGRAMS\Enemy Territory - Legacy"
CreateShortCut "$SMPROGRAMS\Enemy Territory - Legacy\Enemy Territory - Legacy Homepage.lnk" "http://www.etlegacy.com"
CreateShortCut "$SMPROGRAMS\Enemy Territory - Legacy\Enemy Territory - Legacy.lnk" "$INSTDIR\etl.exe"
CreateShortCut "$SMPROGRAMS\Enemy Territory - Legacy\Enemy Territory - Legacy with Omni-Bots.lnk" "$INSTDIR\etl.exe" "+set omni_bot enable 1 +set omnibot_path legacy\omni-bot\"
CreateShortCut "$SMPROGRAMS\Enemy Territory - Legacy\Uninstall.lnk" "$INSTDIR\uninstall.exe"
CreateShortCut "$DESKTOP\ET-Legacy.lnk" "$INSTDIR\etl.exe"
SectionEnd
Section -Post
SetOverwrite on
WriteUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallPath" "$INSTDIR"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
@ -231,8 +255,9 @@ SectionEnd
; Section descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${FILES} "Install Enemy Territory: Legacy files with Omni-Bot."
!insertmacro MUI_DESCRIPTION_TEXT ${FILES} "Install Enemy Territory: Legacy files."
!insertmacro MUI_DESCRIPTION_TEXT ${ASSETS} "Retrieve Wolfenstein: Enemy Territory .pk3 assets. Data files will be downloaded if not found locally."
!insertmacro MUI_DESCRIPTION_TEXT ${OMNIBOT} "Install Omni-Bot files for your server or offline training. The latest version will be downloaded."
!insertmacro MUI_DESCRIPTION_TEXT ${URI} "Register et:// protocol with Enemy Territory: Legacy."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
@ -264,7 +289,7 @@ SectionEND
; Section descriptions
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${UNFILES} "Uninstall Enemy Territory: Legacy"
!insertmacro MUI_DESCRIPTION_TEXT ${UNFILES} "Uninstall Enemy Territory: Legacy and Omni-bot files."
!insertmacro MUI_DESCRIPTION_TEXT ${UNASSETS} "Uninstall Wolfenstein: Enemy Territory .pk3 assets (pak0.pk3, pak1.pk3, pak2.pk3 and mp_bin.pk3)."
!insertmacro MUI_DESCRIPTION_TEXT ${WOLFETL} "Delete ETKEY and all files created or downloaded inside the MyDocuments\WolfETL folder."
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END