Initial commit.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1652 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2005-04-19 07:50:21 +00:00
parent a2edc53fc5
commit 29a3553f5e
+434
View File
@@ -0,0 +1,434 @@
; Script generated by the HM NIS Edit Script Wizard.
Var PACKAGEDIR ; Source directory for pre-downloaded .zip and .uqm files
Var UQMARGS ; Options to add to the shortcuts; "--addon remix" if remixes installed
Var DOWNLOADTARGET ; Temp directory for holding the file downloaded
Var MANDATORY ; 0 if the package being dealt with is optional
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "The Ur-Quan Masters"
!define PRODUCT_VERSION "0.4"
!define PRODUCT_WEB_SITE "http://sc2.sourceforge.net"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\uqm.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page: Note that GPL is not a clickthrough license
!define MUI_LICENSEPAGE_BUTTON "Install"
!define MUI_LICENSEPAGE_TEXT_BOTTOM "Press the Install button to continue."
!insertmacro MUI_PAGE_LICENSE "COPYING.txt"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Install Directory
!insertmacro MUI_PAGE_DIRECTORY
; Package Directory
!define MUI_PAGE_HEADER_TEXT "Choose Package Location"
!define MUI_PAGE_HEADER_SUBTEXT "Choose the folder that holds packages that have already been downloaded."
!define MUI_DIRECTORYPAGE_TEXT_TOP "Setup will look for already-downloaded content packages in the following folder. To copy them from a different folder, click Browse and select another folder. If you are doing a net install, you may leave this field blank. Click Next to continue."
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Source Folder"
!define MUI_DIRECTORYPAGE_VARIABLE $PACKAGEDIR
!insertmacro MUI_PAGE_DIRECTORY
; Start menu page
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Games\The Ur-Quan Masters"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
!define MUI_FINISHPAGE_RUN "$INSTDIR\uqm.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS $UQMARGS
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "uqm-draft-installer.exe"
InstallDir "$PROGRAMFILES\The Ur-Quan Masters\"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
; DirText values are shared between both directory dialogs, alas. Probably recycled resources.
; We compensate by being generic.
DirText "" "" "" "Please select a folder."
InstType "Typical"
InstType "Minimal"
InstType "Complete"
InstType "No Content"
Function .onInit
; Package directory defaults to the directory the installer is from.
StrCpy $PACKAGEDIR $EXEDIR
; Program arguments default to no additional arguments.
StrCpy $UQMARGS ""
FunctionEnd
; Filched from the NSIS forums; produces a random number. Push an
; integer N, call Random, pop a random number between 0 and N.
Function Random
Exch $0
Push $1
System::Call 'kernel32::QueryPerformanceCounter(*l.r1)'
System::Int64Op $1 % $0
Pop $0
Pop $1
Exch $0
FunctionEnd
; Call this, and pop a random SourceForge server. The voxel server is
; not listed, as it seems to break all the time on our files.
Function RandomServer
Push $0
Push 13
Call Random
Pop $0
IntCmp $0 0 0 +4 +4
StrCpy $0 "mesh"
Exch $0
Return
IntCmp $0 1 0 +4 +4
StrCpy $0 "cogent"
Exch $0
Return
IntCmp $0 2 0 +4 +4
StrCpy $0 "nchc"
Exch $0
Return
IntCmp $0 3 0 +4 +4
StrCpy $0 "optusnet"
Exch $0
Return
IntCmp $0 4 0 +4 +4
StrCpy $0 "heanet"
Exch $0
Return
IntCmp $0 5 0 +4 +4
StrCpy $0 "ovh"
Exch $0
Return
IntCmp $0 6 0 +4 +4
StrCpy $0 "switch"
Exch $0
Return
IntCmp $0 7 0 +4 +4
StrCpy $0 "puzzle"
Exch $0
Return
IntCmp $0 8 0 +4 +4
StrCpy $0 "kent"
Exch $0
Return
IntCmp $0 9 0 +4 +4
StrCpy $0 "belnet"
Exch $0
Return
IntCmp $0 10 0 +4 +4
StrCpy $0 "easynews"
Exch $0
Return
IntCmp $0 11 0 +4 +4
StrCpy $0 "citkit"
Exch $0
Return
StrCpy $0 "jaist"
Exch $0
FunctionEnd
; To use:
; Push the file name.
; Push the installation location.
; It will install it from the Package Directory if necessary; otherwise it
; will download it to a temp file and install that.
Function HandlePackage
Exch $0 # File location
Exch
Exch $1 # File name
Exch
Push $2
Push $3
SetOutPath "$0"
SetOverwrite ifdiff
IfFileExists "$PACKAGEDIR\$1" 0 AttemptDownload
CopyFiles "$PACKAGEDIR\$1" "$0\$1"
Goto PackageDone
AttemptDownload:
Call RandomServer
Pop $2
GetTempFileName $DOWNLOADTARGET
Delete $DOWNLOADTARGET
CreateDirectory $DOWNLOADTARGET
NSISdl::download "http://$2.dl.sourceforge.net/sourceforge/sc2/$1" "$DOWNLOADTARGET\$1"
Pop $2
StrCmp $2 "success" DownloadSuccessful
StrCmp $2 "cancel" DownloadCanceled
StrCpy $2 "Could not install the package $1 due to the following error: $\"$2$\"."
Goto CheckMandatory
DownloadCanceled:
StrCpy $2 "Download was canceled by user."
CheckMandatory:
IntCmp $MANDATORY 0 NotMandatory
StrCpy $3 "THIS IS A MANDATORY PACKAGE. Without this package, $(^Name) will NOT run."
Goto DisplayError
NotMandatory:
StrCpy $3 "This is an optional package. $(^Name) will still run, but some content will not be available."
DisplayError:
MessageBox MB_ICONEXCLAMATION|MB_YESNO "$2 $3 Do you want to retry from a different mirror?" IDYES AttemptDownload
Goto DoneWithTempFile
DownloadSuccessful:
CopyFiles "$DOWNLOADTARGET\$1" "$0\$1"
DoneWithTempFile:
RmDir /r $DOWNLOADTARGET
PackageDone:
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
SectionGroup "!UQM" SECGRP01
Section "Executable" SEC01
SectionIn 1 2 3 4 RO
SetOutPath "$INSTDIR"
SetOverwrite try
File "AUTHORS.txt"
File "COPYING.txt"
File "jpeg.dll"
File "libpng13.dll"
File "Manual.txt"
File "ogg.dll"
File "OpenAL32.dll"
File "README.txt"
File "SDL.dll"
File "SDL_image.dll"
File "uqm.exe"
File "vorbis.dll"
File "vorbisfile.dll"
File "WhatsNew.txt"
File "zlib1.dll"
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section "Core Data" SEC02
SectionIn 1 2 3
CreateDirectory "$INSTDIR\content\packages\addons"
SetOutPath "$INSTDIR\content"
SetOverwrite ifnewer
AddSize 12261
StrCpy $MANDATORY 1
File "content\version"
Push "uqm-0.4-content.uqm"
Push "$INSTDIR\content\packages"
Call HandlePackage
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
SectionGroupEnd
SectionGroup /e "3DO Content" SECGRP02
Section "Music" SEC03
SectionIn 1 3
AddSize 18536
StrCpy $MANDATORY 0
Push "uqm-0.4-3domusic.uqm"
Push "$INSTDIR\content\packages"
Call HandlePackage
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section "Voiceovers" SEC04
SectionIn 1 3
AddSize 112291
StrCpy $MANDATORY 0
Push "uqm-0.4-voice.uqm"
Push "$INSTDIR\content\packages"
Call HandlePackage
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
SectionGroupEnd
SectionGroup "Modern Remixes" SECGRP03
Section "Pack 1" SEC05
SectionIn 3
AddSize 49012
StrCpy $MANDATORY 0
Push "uqm-remix-pack1.zip"
Push "$INSTDIR\content\packages\addons\remix\"
Call HandlePackage
StrCpy $UQMARGS "--addon remix"
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section "Pack 2" SEC06
SectionIn 3
AddSize 58869
StrCpy $MANDATORY 0
Push "uqm-remix-pack2.zip"
Push "$INSTDIR\content\packages\addons\remix\"
Call HandlePackage
StrCpy $UQMARGS "--addon remix"
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section "Pack 3" SEC07
SectionIn 3
AddSize 38989
StrCpy $MANDATORY 0
Push "uqm-remix-pack3.zip"
Push "$INSTDIR\content\packages\addons\remix\"
Call HandlePackage
StrCpy $UQMARGS "--addon remix"
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section "Pack 4" SEC08
SectionIn 3
AddSize 50000 # ESTIMATE: Update later
StrCpy $MANDATORY 0
Push "uqm-remix-pack4.zip"
Push "$INSTDIR\content\packages\addons\remix\"
Call HandlePackage
StrCpy $UQMARGS "--addon remix"
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
SectionGroupEnd
Section -ShortcutsAndIcons
SetOutPath $INSTDIR
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\The Ur-Quan Masters.lnk" "$INSTDIR\uqm.exe" $UQMARGS
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP\Documentation"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Documentation\AUTHORS.lnk" "$INSTDIR\AUTHORS.txt"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Documentation\COPYING.lnk" "$INSTDIR\COPYING.txt"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Documentation\Manual.lnk" "$INSTDIR\Manual.txt"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Documentation\README.lnk" "$INSTDIR\README.txt"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Documentation\WhatsNew.lnk" "$INSTDIR\WhatsNew.txt"
CreateShortCut "$DESKTOP\The Ur-Quan Masters.lnk" "$INSTDIR\uqm.exe" $UQMARGS
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\uqm.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\uqm.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
SectionEnd
; Section descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SECGRP01} "The core executables and content libraries for The Ur-Quan Masters. All elements in this section must be installed for the game to be playable."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Includes the main program, all subsidiary libraries, and basic documentation for The Ur-Quan Masters. Required for play."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Graphics, sound, and the PC-edition music for the Ur-Quan masters. Required for play. If this package is selected and not present in the packages directory, the installer will attempt to download it."
!insertmacro MUI_DESCRIPTION_TEXT ${SECGRP02} "Optional content packages containing music and sound unique to the 1993 3DO release."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Optional package which includes the remixed songs from the 3DO release. If this package is selected and not present in the packages directory, the installer will attempt to download it."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Optional package containing the voiceovers from the 3DO release. If this package is selected and not present in the packages directory, the installer will attempt to download it."
!insertmacro MUI_DESCRIPTION_TEXT ${SECGRP03} "Optional content packages containing the official UQM remixes by The Precursors. Selecting any element from this group will also enable the 'remix' addon by default in any shortcuts."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC05} `Ur-Quan Masters Remix Pack 1 - 'Super Melee!' Optional add-on music package. If this package is selected and not present in the packages directory, the installer will attempt to download it.`
!insertmacro MUI_DESCRIPTION_TEXT ${SEC06} `Ur-Quan Masters Remix Pack 2 - 'Neutral Aliens - Don't Shoot!' Optional add-on music package. If this package is selected and not present in the packages directory, the installer will attempt to download it.`
!insertmacro MUI_DESCRIPTION_TEXT ${SEC07} `Ur-Quan Masters Remix Pack 3 - 'The Ur-Quan Hierarchy.' Optional add-on music package. If this package is selected and not present in the packages directory, the installer will attempt to download it.`
!insertmacro MUI_DESCRIPTION_TEXT ${SEC08} `Ur-Quan Masters Remix Pack 4 - 'The Alliance of Free Stars.' Optional add-on music package. If this package is selected and not present in the packages directory, the installer will attempt to download it.`
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\content\packages\addons\remix\uqm-remix-pack4.zip"
Delete "$INSTDIR\content\packages\addons\remix\uqm-remix-pack3.zip"
Delete "$INSTDIR\content\packages\addons\remix\uqm-remix-pack2.zip"
Delete "$INSTDIR\content\packages\addons\remix\uqm-remix-pack1.zip"
Delete "$INSTDIR\content\packages\uqm-0.4-voice.uqm"
Delete "$INSTDIR\content\packages\uqm-0.4-3domusic.uqm"
Delete "$INSTDIR\content\packages\uqm-0.4-content.uqm"
Delete "$INSTDIR\content\version"
Delete "$INSTDIR\zlib1.dll"
Delete "$INSTDIR\WhatsNew.txt"
Delete "$INSTDIR\vorbisfile.dll"
Delete "$INSTDIR\vorbis.dll"
Delete "$INSTDIR\uqm.exe"
Delete "$INSTDIR\SDL_image.dll"
Delete "$INSTDIR\SDL.dll"
Delete "$INSTDIR\README.txt"
Delete "$INSTDIR\OpenAL32.dll"
Delete "$INSTDIR\ogg.dll"
Delete "$INSTDIR\Manual.txt"
Delete "$INSTDIR\libpng13.dll"
Delete "$INSTDIR\jpeg.dll"
Delete "$INSTDIR\COPYING.txt"
Delete "$INSTDIR\AUTHORS.txt"
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
Delete "$DESKTOP\The Ur-Quan Masters.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\The Ur-Quan Masters.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Documentation\AUTHORS.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Documentation\COPYING.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Documentation\Manual.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Documentation\README.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Documentation\WhatsNew.lnk"
RMDir "$SMPROGRAMS\$ICONS_GROUP\Documentation"
RMDir "$SMPROGRAMS\$ICONS_GROUP"
RMDir "$INSTDIR\content\packages\addons\remix"
RMDir "$INSTDIR\content\packages\addons"
RMDir "$INSTDIR\content\packages"
RMDir "$INSTDIR\content"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd