From 2491240f9a384e31181ac3a14333d8db3ffc637b Mon Sep 17 00:00:00 2001 From: mcmartin Date: Thu, 19 May 2005 06:32:04 +0000 Subject: [PATCH] 0.4 installer with MD5 sums, post-content-freeze. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1808 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/build/win32_install/uqm-0.4.nsi | 150 +++++++++++++++++++--------- 1 file changed, 102 insertions(+), 48 deletions(-) diff --git a/sc2/build/win32_install/uqm-0.4.nsi b/sc2/build/win32_install/uqm-0.4.nsi index 08533a650..1078de8d9 100644 --- a/sc2/build/win32_install/uqm-0.4.nsi +++ b/sc2/build/win32_install/uqm-0.4.nsi @@ -1,13 +1,13 @@ ; 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 +Var PACKAGEDIR +Var UQMARGS +Var MAKEICON +Var UQMUSERDATA ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "The Ur-Quan Masters" -!define PRODUCT_VERSION "0.4" +!define PRODUCT_VERSION "0.4.0" !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}" @@ -24,18 +24,18 @@ Var MANDATORY ; 0 if the package being dealt with is optional ; Welcome page !insertmacro MUI_PAGE_WELCOME -; License page: Note that GPL is not a clickthrough license +; License page !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 +; Directory page !insertmacro MUI_PAGE_DIRECTORY -; Package Directory +; Package Dictory !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_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, leave this field alone. Click Next to continue." !define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Source Folder" !define MUI_DIRECTORYPAGE_VARIABLE $PACKAGEDIR !insertmacro MUI_PAGE_DIRECTORY @@ -66,13 +66,12 @@ var ICONS_GROUP ; MUI end ------ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile "uqm-draft-installer.exe" +OutFile "uqm-0.4.0-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. +AllowRootDirInstall true DirText "" "" "" "Please select a folder." InstType "Typical" InstType "Minimal" @@ -80,14 +79,24 @@ InstType "Complete" InstType "No Content" Function .onInit - ; Package directory defaults to the directory the installer is from. + Push $0 StrCpy $PACKAGEDIR $EXEDIR - ; Program arguments default to no additional arguments. StrCpy $UQMARGS "" + StrCpy $MAKEICON 0 + ReadEnvStr $0 APPDATA + StrCmp $0 "" NoAppData + ExpandEnvStrings $UQMUSERDATA "%APPDATA%\uqm" + Goto GotAppData +NoAppData: + ReadEnvStr $0 USERPROFILE + StrCmp $0 "" NoProfile + ExpandEnvStrings $UQMUSERDATA "%USERPROFILE%\Application Data\uqm" + Goto GotAppData +NoProfile: + StrCpy $UQMUSERDATA "$INSTDIR\userdata\uqm" +GotAppData: 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 @@ -98,8 +107,6 @@ Function Random 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 @@ -157,11 +164,14 @@ Function RandomServer 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. +# 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. +Var DOWNLOADTARGET +Var MANDATORY +Var MD5SUM Function HandlePackage Exch $0 # File location Exch @@ -169,11 +179,24 @@ Function HandlePackage Exch Push $2 Push $3 + # Check to make sure the file wasn't already installed + IfFileExists "$0\$1" 0 NotThere + md5dll::GetFileMD5 "$0\$1" + Pop $3 + StrCmp $MD5SUM $3 0 NotThere + MessageBox MB_ICONINFORMATION|MB_OK "The package $1 has already been installed." + Goto PackageDone +NotThere: SetOutPath "$0" SetOverwrite ifdiff IfFileExists "$PACKAGEDIR\$1" 0 AttemptDownload - CopyFiles "$PACKAGEDIR\$1" "$0\$1" - Goto PackageDone + md5dll::GetFileMD5 "$PACKAGEDIR\$1" + Pop $3 + StrCmp $MD5SUM $3 PackageOK + MessageBox MB_ICONINFORMATION|MB_OKCANCEL "The file $PACKAGEDIR\$1 appears to be corrupt. The expected MD5 sum was '$MD5SUM', but the actual MD5 sum was '$3'. Press OK to attempt to download a fresh copy from the distribution site, or Cancel to skip the package." IDOK AttemptDownload IDCANCEL PackageDone +PackageOK: + CopyFiles "$PACKAGEDIR\$1" "$0\$1" + Goto PackageDone AttemptDownload: Call RandomServer Pop $2 @@ -198,6 +221,17 @@ DisplayError: MessageBox MB_ICONEXCLAMATION|MB_YESNO "$2 $3 Do you want to retry from a different mirror?" IDYES AttemptDownload Goto DoneWithTempFile DownloadSuccessful: + md5dll::GetFileMD5 "$DOWNLOADTARGET\$1" + Pop $3 + StrCmp $MD5SUM $3 DownloadedPackageOK + IntCmp $MANDATORY 0 NotMandatory2 + StrCpy $3 "THIS IS A MANDATORY PACKAGE. Without this package, $(^Name) will NOT run." + Goto DisplayError2 +NotMandatory2: + StrCpy $3 "This is an optional package. $(^Name) will still run, but some content will not be available." +DisplayError2: + MessageBox MB_ICONEXCLAMATION|MB_YESNO "The downloaded file $1 doesn't match the internal MD5 sum. This probably means the download was corrupt. $3 Do you want to retry from a different mirror? (Select NO to install the downloaded package anyway - for instance, if you know that the content pack was upgraded or modified since.)" IDYES AttemptDownload +DownloadedPackageOK: CopyFiles "$DOWNLOADTARGET\$1" "$0\$1" DoneWithTempFile: RmDir /r $DOWNLOADTARGET @@ -228,6 +262,9 @@ SectionGroup "!UQM" SECGRP01 File "vorbisfile.dll" File "WhatsNew.txt" File "zlib1.dll" + SetOverwrite off + SetOutPath $UQMUSERDATA + File "keys.cfg" ; Shortcuts !insertmacro MUI_STARTMENU_WRITE_BEGIN Application @@ -241,8 +278,9 @@ SectionGroup "!UQM" SECGRP01 SetOverwrite ifnewer AddSize 12261 StrCpy $MANDATORY 1 + StrCpy $MD5SUM "f8daed517466d68805393e02a12fd642" File "content\version" - Push "uqm-0.4-content.uqm" + Push "uqm-0.4.0-content.uqm" Push "$INSTDIR\content\packages" Call HandlePackage @@ -250,6 +288,11 @@ SectionGroup "!UQM" SECGRP01 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application !insertmacro MUI_STARTMENU_WRITE_END SectionEnd + + Section "Desktop Icon" SECICON + SectionIn 1 2 3 4 + StrCpy $MAKEICON 1 + SectionEnd SectionGroupEnd SectionGroup /e "3DO Content" SECGRP02 @@ -257,7 +300,8 @@ SectionGroup /e "3DO Content" SECGRP02 SectionIn 1 3 AddSize 18536 StrCpy $MANDATORY 0 - Push "uqm-0.4-3domusic.uqm" + StrCpy $MD5SUM "8e9f1e777719e2934c8b8a9835c5452d" + Push "uqm-0.4.0-3domusic.uqm" Push "$INSTDIR\content\packages" Call HandlePackage ; Shortcuts @@ -269,7 +313,8 @@ SectionGroup /e "3DO Content" SECGRP02 SectionIn 1 3 AddSize 112291 StrCpy $MANDATORY 0 - Push "uqm-0.4-voice.uqm" + StrCpy $MD5SUM "52a084cfaa0bc7fcc63a295feb8cbd28" + Push "uqm-0.4.0-voice.uqm" Push "$INSTDIR\content\packages" Call HandlePackage ; Shortcuts @@ -283,6 +328,7 @@ SectionGroup "Modern Remixes" SECGRP03 SectionIn 3 AddSize 49012 StrCpy $MANDATORY 0 + StrCpy $MD5SUM "2df402b2951c0187604a81c3997fbb9d" Push "uqm-remix-pack1.zip" Push "$INSTDIR\content\packages\addons\remix\" Call HandlePackage @@ -296,6 +342,7 @@ SectionGroup "Modern Remixes" SECGRP03 SectionIn 3 AddSize 58869 StrCpy $MANDATORY 0 + StrCpy $MD5SUM "d5a9fb72b369bf5a5dbca3db9f1e1ea3" Push "uqm-remix-pack2.zip" Push "$INSTDIR\content\packages\addons\remix\" Call HandlePackage @@ -309,6 +356,7 @@ SectionGroup "Modern Remixes" SECGRP03 SectionIn 3 AddSize 38989 StrCpy $MANDATORY 0 + StrCpy $MD5SUM "567bc2d9e3ca067d21170c5ac5538441" Push "uqm-remix-pack3.zip" Push "$INSTDIR\content\packages\addons\remix\" Call HandlePackage @@ -318,18 +366,18 @@ SectionGroup "Modern Remixes" SECGRP03 !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 +# 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 @@ -343,8 +391,11 @@ Section -ShortcutsAndIcons 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 "$SMPROGRAMS\$ICONS_GROUP\Key Configuration.lnk" "$WINDIR\notepad" "$UQMUSERDATA\keys.cfg" + IntCmp $MAKEICON 1 0 NoIcon NoIcon CreateShortCut "$DESKTOP\The Ur-Quan Masters.lnk" "$INSTDIR\uqm.exe" $UQMARGS - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe" +NoIcon: + CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd @@ -362,7 +413,8 @@ SectionEnd !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 ${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 ${SECICON} "Adds a desktop icon linking directly to The Ur-Quan Masters." !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." @@ -370,7 +422,7 @@ SectionEnd !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_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 @@ -391,10 +443,11 @@ Section Uninstall 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\packages\uqm-0.4.0-voice.uqm" + Delete "$INSTDIR\content\packages\uqm-0.4.0-3domusic.uqm" + Delete "$INSTDIR\content\packages\uqm-0.4.0-content.uqm" Delete "$INSTDIR\content\version" + Delete "$INSTDIR\zlib.dll" Delete "$INSTDIR\zlib1.dll" Delete "$INSTDIR\WhatsNew.txt" Delete "$INSTDIR\vorbisfile.dll" @@ -412,6 +465,7 @@ Section Uninstall Delete "$INSTDIR\AUTHORS.txt" Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" + Delete "$SMPROGRAMS\$ICONS_GROUP\Key Configuration.lnk" Delete "$DESKTOP\The Ur-Quan Masters.lnk" Delete "$SMPROGRAMS\$ICONS_GROUP\The Ur-Quan Masters.lnk" Delete "$SMPROGRAMS\$ICONS_GROUP\Documentation\AUTHORS.lnk" @@ -419,7 +473,7 @@ Section Uninstall 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" @@ -431,4 +485,4 @@ Section Uninstall DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose true -SectionEnd \ No newline at end of file +SectionEnd