NSIS Ant and Eclipse
I realize this may not be the proper place to post a question about the NSIS Ant Task but that project appears to be dead so I thought I would ask here to see if any one else has had this problem and/or knows how to resolve it.
I use the NSIS Ant Task to run NSIS from my ant script. Everything used to work fine in eclipse 3.3.2 but when I upgraded to eclipse 3.4.1 I had problems with the NSIS part of the ant script. Everything starts fine. I can see logging messages from NSIS where it is going through the !define statements then starts the !include statements but after the log message to !include MUI.nsh there is a line to !include System.nsh and then it just hangs. I've tried letting it run for several minutes but it never comes back.
Any help would be greatly appreciated.
Thanks,
Scott
Here is the output when running ant:
[nsis] MakeNSIS v2.40 - Copyright 1995-2008 Contributors
[nsis] See the file COPYING for license details.
[nsis] Credits can be found in the Users Manual.
[nsis] Command line defined: "CLIENT_VERSION=5.1"
[nsis] Command line defined: "CLIENT_BUILD=b"
[nsis] Command line defined: "IRFANVIEW_VERSION=3.95"
[nsis] Command line defined: "JRE_VERSION=1.6.0_07"
[nsis] Command line defined: "OUTDIR=C:/java/eclipse/workspace/ASBS/deployable-jars/install/war"
[nsis] Command line defined: "OUTFILE=asbs-install.exe"
[nsis] Command line defined: "DOWNLOAD_SERVER=http://xyz:8080/asbs-install"
[nsis] Command line defined: "ENVIRONMENT=xyz"
[nsis] Processing config:
[nsis] Processing plugin dlls: "C:\Program Files\NSIS\Plugins\*.dll"
[nsis] - AdvSplash::show
[nsis] - Banner::destroy
[nsis] - Banner::getWindow
[nsis] - Banner::show
[nsis] - BgImage::AddImage
[nsis] - BgImage::AddText
[nsis] - BgImage::Clear
[nsis] - BgImage::Destroy
[nsis] - BgImage::Redraw
[nsis] - BgImage::SetBg
[nsis] - BgImage::SetReturn
[nsis] - BgImage::Sound
[nsis] - Dialer::AttemptConnect
[nsis] - Dialer::AutodialHangup
[nsis] - Dialer::AutodialOnline
[nsis] - Dialer::AutodialUnattended
[nsis] - Dialer::GetConnectedState
[nsis] - InstallOptions::dialog
[nsis] - InstallOptions::initDialog
[nsis] - InstallOptions::show
[nsis] - LangDLL::LangDialog
[nsis] - Math::Script
[nsis] - NSISArray::ArrayCount
[nsis] - NSISArray::ArrayExists
[nsis] - NSISArray::Clear
[nsis] - NSISArray::Concat
[nsis] - NSISArray::Copy
[nsis] - NSISArray::Cut
[nsis] - NSISArray::Debug
[nsis] - NSISArray::Delete
[nsis] - NSISArray::ErrorStyle
[nsis] - NSISArray::Exists
[nsis] - NSISArray::ExistsI
[nsis] - NSISArray::FreeUnusedMem
[nsis] - NSISArray::Join
[nsis] - NSISArray::New
[nsis] - NSISArray::Pop
[nsis] - NSISArray::Push
[nsis] - NSISArray::Put
[nsis] - NSISArray::ReDim
[nsis] - NSISArray::Read
[nsis] - NSISArray::ReadToStack
[nsis] - NSISArray::Reverse
[nsis] - NSISArray::Search
[nsis] - NSISArray::SearchI
[nsis] - NSISArray::SetAutoReDim
[nsis] - NSISArray::SetSize
[nsis] - NSISArray::Shift
[nsis] - NSISArray::SizeOf
[nsis] - NSISArray::Sort
[nsis] - NSISArray::Splice
[nsis] - NSISArray::Subtract
[nsis] - NSISArray::Swap
[nsis] - NSISArray::Unload
[nsis] - NSISArray::Unshift
[nsis] - NSISArray::Write
[nsis] - NSISArray::WriteList
[nsis] - NSISArray::WriteListC
[nsis] - NSISdl::download
[nsis] - NSISdl::download_quiet
[nsis] - Splash::show
[nsis] - StartMenu::Init
[nsis] - StartMenu::Select
[nsis] - StartMenu::Show
[nsis] - System::Alloc
[nsis] - System::Call
[nsis] - System::Copy
[nsis] - System::Free
[nsis] - System::Get
[nsis] - System::Int64Op
[nsis] - System::Store
[nsis] - TypeLib::GetLibVersion
[nsis] - TypeLib::Register
[nsis] - TypeLib::UnRegister
[nsis] - UserInfo::GetAccountType
[nsis] - UserInfo::GetName
[nsis] - UserInfo::GetOriginalAccountType
[nsis] - VPatch::GetFileCRC32
[nsis] - VPatch::GetFileMD5
[nsis] - VPatch::vpatchfile
[nsis] - ZipDLL::extractall
[nsis] - ZipDLL::extractfile
[nsis] - inetc::get
[nsis] - inetc::head
[nsis] - inetc::post
[nsis] - inetc::put
[nsis] - nsDialogs::Create
[nsis] - nsDialogs::CreateControl
[nsis] - nsDialogs::CreateItem
[nsis] - nsDialogs::GetUserData
[nsis] - nsDialogs::OnBack
[nsis] - nsDialogs::OnChange
[nsis] - nsDialogs::OnClick
[nsis] - nsDialogs::OnNotify
[nsis] - nsDialogs::SelectFileDialog
[nsis] - nsDialogs::SelectFolderDialog
[nsis] - nsDialogs::SetRTL
[nsis] - nsDialogs::SetUserData
[nsis] - nsDialogs::Show
[nsis] - nsExec::Exec
[nsis] - nsExec::ExecToLog
[nsis] - nsExec::ExecToStack
[nsis] !define: "MUI_INSERT_NSISCONF"=""
[nsis] Changing directory to: "C:\java\eclipse\workspace\ASBS\build\install\files"
[nsis] Processing script file: "C:\java\eclipse\workspace\ASBS\build\install\files\asbs.nsi"
[nsis] !define: "DOWNLOAD_SERVER_NAME"="http://xyz:8080/asbs-install"
[nsis] !define: "OUTDIR_NAME"="C:/java/eclipse/workspace/ASBS/deployable-jars/install/war"
[nsis] !define: "OUTFILE_NAME"="asbs-install.exe"
[nsis] !define: "LOGICLIB_SECTIONCMP"=""
[nsis] !define: "INSTALLER_VERSION"="1.0.2.0"
[nsis] !define: "APP_NAME_LONG"="Selection Board System"
[nsis] !define: "APP_NAME_SHORT"="SBS"
[nsis] !define: "ARCHIVE_NAME"="Archive Viewer"
[nsis] !define: "COPYRIGHT_YEAR"="2008"
[nsis] !define: "APP_ROOT_REG_KEY"="Software\$(^Name)\ahrc00wkg2360"
[nsis] !define: "INSTALL_DIR_REG_KEY"="Install Directory"
[nsis] !define: "APPDATA_DIR_REG_KEY"="Application Data Directory"
[nsis] !define: "USER_TYPE_REG_KEY"="User Type"
[nsis] !define: "START_MENU_FOLDER_REG_KEY"="Start Menu Folder"
[nsis] !define: "CLASSPATH_REG_KEY"="Classpath"
[nsis] !define: "COMPONENTS_REG_KEY"="Components"
[nsis] !define: "CLIENT_COMP_REG_KEY"="Client"
[nsis] !define: "IRFANVIEW_COMP_REG_KEY"="IrfanView"
[nsis] !define: "JRE_COMP_REG_KEY"="JRE"
[nsis] !define: "VERSION_REG_KEY"="Version"
[nsis] !define: "BUILD_REG_KEY"="Build"
[nsis] !define: "TEMP_DOWNLOAD_DIRECTORY"="$TEMP\asbs_install"
[nsis] !define: "INSTALL_PROPS_FILENAME"="install.properties"
[nsis] !define: "CLIENT_JAR_FILENAME"="lib\asbs-client.jar"
[nsis] !define: "INSTALL_TYPE_FULL"="full"
[nsis] !define: "INSTALL_TYPE_UPGRADE"="upgrade"
[nsis] !define: "INSTALL_USER_SCRUBBER"="Scrubber"
[nsis] !define: "INSTALL_USER_VOTER"="Voter"
[nsis] !define: "INSTALL_USER_INI"="InstallUser.ini"
[nsis] !define: "ARCHIVE_VIEWER_INI"="ArchiveViewer.ini"
[nsis] !define: "INSTALL_READY_INI"="InstallReady.ini"
[nsis] !define: "SETTINGS_FILENAME"="settings.ini"
[nsis] !define: "CONFIG_PROPS_FILENAME"="config.properties"
[nsis] !define: "RELEASE_NOTES_FILENAME"="Release Notes.doc"
[nsis] !define: "APP_ICO_FILENAME"="UncleSam.ico"
[nsis] !define: "APP_EXE_FILENAME"="asbs.cmd"
[nsis] !define: "ARCHIVE_ICO_FILENAME"="ArchiveViewer.ico"
[nsis] !define: "ARCHIVE_EXE_FILENAME"="archive.cmd"
[nsis] !define: "UNINSTALLER_FILENAME"="Uninstall.exe"
[nsis] SetCompressor: /FINAL /SOLID lzma
[nsis] !include: "C:\Program Files\NSIS\Include\MUI.nsh"
[nsis] !include: "C:\Program Files\NSIS\Contrib\Modern UI\System.nsh"
Here is the .nsi script:
; asbs.nsi
;
; This script creates an installer for the Selection Board System.
;
; Command Line Flags (specified via /D command line switch):
; CLIENT_VERSION - required - The version of ASBS to be installed.
; CLIENT_BUILD - required - The build of ASBS to be installed.
; IRFANVIEW_VERSION - required - The version of IrfanView to be installed.
; JRE_VERSION - required - The version of Java Runtime Environment to be
; installed.
; DOWNLOAD_SERVER - required - The name and port of the server which will host
; the files to be downloaded by this installer.
; ENVIRONMENT - required - The application environment (e.g., dev,
; stl-dev, qa, prod, stl-prod).
; OUTDIR - optional - The directory where the installer executable
; will be saved (e.g., C:\temp, ..\install).
; Default: same directory as this file
; OUTFILE - optional - The name of the installer executable created by
; this script. The default value should always be
; used except for debugging purposes.
; Default: asbs_install.exe
;-------------------------------------------------------------------------------
;Configuration
!ifndef CLIENT_VERSION
!error "CLIENT_VERSION flag must be specified."
!endif
!ifndef CLIENT_BUILD
!error "CLIENT_BUILD flag must be specified."
!endif
!ifndef IRFANVIEW_VERSION
!error "IRFANVIEW_VERSION flag must be specified."
!endif
!ifndef JRE_VERSION
!error "JRE_VERSION flag must be specified."
!endif
!ifndef DOWNLOAD_SERVER
!error "DOWNLOAD_SERVER flag must be specified."
!else
!define DOWNLOAD_SERVER_NAME "${DOWNLOAD_SERVER}"
!endif
!ifndef ENVIRONMENT
!error "ENVIRONMENT flag must be specified."
!endif
!ifdef OUTDIR
!if "${OUTDIR}" == ""
!define OUTDIR_NAME "."
!else
!define OUTDIR_NAME "${OUTDIR}"
!endif
!else
!define OUTDIR_NAME "."
!endif
!ifdef OUTFILE
!if "${OUTFILE}" == ""
!define OUTFILE_NAME "asbs-install.exe"
!else
!define OUTFILE_NAME "${OUTFILE}"
!endif
!else
!define OUTFILE_NAME "asbs-install.exe"
!endif
!define LOGICLIB_SECTIONCMP
!define INSTALLER_VERSION "1.0.2.0"
!define APP_NAME_LONG "Selection Board System"
!define APP_NAME_SHORT "ASBS"
!define ARCHIVE_NAME "Archive Viewer"
!define /date COPYRIGHT_YEAR "%Y"
!define APP_ROOT_REG_KEY "Software\$(^Name)\${ENVIRONMENT}"
!define INSTALL_DIR_REG_KEY "Install Directory"
!define APPDATA_DIR_REG_KEY "Application Data Directory"
!define USER_TYPE_REG_KEY "User Type"
!define START_MENU_FOLDER_REG_KEY "Start Menu Folder"
!define CLASSPATH_REG_KEY "Classpath"
!define COMPONENTS_REG_KEY "Components"
!define CLIENT_COMP_REG_KEY "Client"
!define IRFANVIEW_COMP_REG_KEY "IrfanView"
!define JRE_COMP_REG_KEY "JRE"
!define VERSION_REG_KEY "Version"
!define BUILD_REG_KEY "Build"
!define TEMP_DOWNLOAD_DIRECTORY "$TEMP\asbs_install"
!define INSTALL_PROPS_FILENAME "install.properties"
!define CLIENT_JAR_FILENAME "lib\asbs-client.jar"
!define INSTALL_TYPE_FULL "full"
!define INSTALL_TYPE_UPGRADE "upgrade"
!define INSTALL_USER_SCRUBBER "Scrubber"
!define INSTALL_USER_VOTER "Voter"
!define INSTALL_USER_INI "InstallUser.ini"
!define ARCHIVE_VIEWER_INI "ArchiveViewer.ini"
!define INSTALL_READY_INI "InstallReady.ini"
!define SETTINGS_FILENAME "settings.ini"
!define CONFIG_PROPS_FILENAME "config.properties"
!define RELEASE_NOTES_FILENAME "Release Notes.doc"
!define APP_ICO_FILENAME "UncleSam.ico"
!define APP_EXE_FILENAME "asbs.cmd"
!define ARCHIVE_ICO_FILENAME "ArchiveViewer.ico"
!define ARCHIVE_EXE_FILENAME "archive.cmd"
!define UNINSTALLER_FILENAME "Uninstall.exe"
!macro AddConfirmItem item list delim
${If} ${list} == ""
StrCpy ${list} "${item}"
${Else}
StrCpy ${list} "${list}${delim}${item}"
${EndIf}
!macroend
!macro CheckStartMenu
; check to see if shortcuts were created during a previous install
ReadRegStr $R0 "HKLM" "${APP_ROOT_REG_KEY}" "${START_MENU_FOLDER_REG_KEY}"
${If} ${Errors}
StrCpy $SKIP_STARTMENU ${FALSE} ; do not skip start menu page
${Else}
StrCpy $SKIP_STARTMENU ${TRUE} ; skip start menu page
StrCpy $STARTMENU_FOLDER $R0
${EndIf}
!macroend
SetCompressor /SOLID /FINAL lzma
;--------------------------------
;Includes
!include MUI.nsh
!include WinMessages.nsh
!include Sections.nsh
!include LogicLib.nsh
!include StrFunc.nsh
!include ZipDLL.nsh
!include TextFunc.nsh
!include FileFunc.nsh
!include NSISArray.nsh
${StrLoc}
!insertmacro ConfigRead
!insertmacro Locate
;--------------------------------
;Variables
Var SECTION_DESC_CLIENT
Var SECTION_DESC_IRFANVIEW
Var SECTION_DESC_JRE
Var CLIENT_ZIP_FILENAME
Var IRFANVIEW_ZIP_FILENAME
Var JRE_ZIP_FILENAME
Var INSTALLED_CLIENT_VER
Var INSTALLED_CLIENT_BUILD
Var INSTALLED_IRFANVIEW_VER
Var INSTALLED_JRE_VER
Var DO_INSTALL_CLIENT
Var DO_INSTALL_IRFANVIEW
Var DO_INSTALL_JRE
Var INSTALL_TYPE
Var STARTMENU_FOLDER
Var SKIP_STARTMENU
Var INSTALL_USER
Var INSTALL_ARCHIVE_VIEWER
Var CHECK_INSTALL_ARCHIVE_VIEWER
Var RETRIEVED_HEADERS
Var INSTALL_DIR_PREEXISTS
Var APP_DATA_DIR_PREEXISTS
Var APP_DATA_DIRECTORY
Var LOGS_DIRECTORY
Var SETTINGS_DIRECTORY
${Array} "LogsArray" 7 50
${ArrayFunc} WriteListC
${ArrayFunc} SizeOf
${ArrayFunc} Read
;--------------------------------
;Configuration
;Names
Name "${APP_NAME_SHORT}"
Caption "$(^Name) ${CLIENT_VERSION} Setup"
OutFile "${OUTDIR_NAME}\${OUTFILE_NAME}"
SetDateSave on
SetDatablockOptimize on
CRCCheck force
SilentInstall normal
BGGradient off
InstallColors /windows
XPStyle on
AllowSkipFiles off
AutoCloseWindow false
ShowInstDetails hide
BrandingText "Human Resources"
;Default installation folder
InstallDir "$PROGRAMFILES\$(^Name)"
;Get installation folder from registry if available
InstallDirRegKey "HKLM" "${APP_ROOT_REG_KEY}" "${INSTALL_DIR_REG_KEY}"
;Interface Settings
!define MUI_CUSTOMFUNCTION_Abort myUserAbort
!define MUI_ICON "setup.ico"
!define MUI_UNICON "uninstall.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ".\UncleSamHeader.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
!define MUI_COMPONENTSPAGE_CHECKBITMAP "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp"
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!define MUI_WELCOMEPAGE_TITLE "Welcome to the $(^Name) ${CLIENT_VERSION} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of $(^Name) (${APP_NAME_LONG}) ${CLIENT_VERSION}.\r\n\r\n$_CLICK"
!define MUI_COMPONENTSPAGE_TEXT_TOP "The following components will be installed for $(^Name). $_CLICK"
!define MUI_COMPONENTSPAGE_TEXT_COMPLIST "Components to be installed:"
!define MUI_FINISHPAGE_TITLE "$(^Name) ${CLIENT_VERSION} Setup Complete"
!define MUI_FINISHPAGE_TEXT "${APP_NAME_LONG} ${CLIENT_VERSION} has been installed successfully.\r\n\r\n$_CLICK"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\${RELEASE_NOTES_FILENAME}"
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show Release Notes"
!define MUI_FINISHPAGE_RUN_FUNCTION FinishPageRun
!define MUI_FINISHPAGE_RUN
!define MUI_PAGE_CUSTOMFUNCTION_PRE PreWelcomePage
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveWelcomePage
!insertmacro MUI_PAGE_WELCOME
Page custom CreateInstallTypePage LeaveInstallTypePage
!define MUI_PAGE_CUSTOMFUNCTION_PRE PreComponentsPage
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowComponentsPage
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowDirectoryPage
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveDirectoryPage
DirText "" "" "" "Select the folder in which to install $(^Name) (note: you must have rights to the selected folder):"
!insertmacro MUI_PAGE_DIRECTORY
Page custom CreateArchiveViewerPage LeaveArchiveViewerPage
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${APP_NAME_LONG}"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${APP_ROOT_REG_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${START_MENU_FOLDER_REG_KEY}"
!define MUI_PAGE_CUSTOMFUNCTION_PRE PreStartMenuPage
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
Page custom CreateInstallReadyPage
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_PAGE_CUSTOMFUNCTION_PRE PreFinishPage
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowFinishPage
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveFinishPage
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.PreFinishPage
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Version Information
VIProductVersion "${INSTALLER_VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP_NAME_SHORT}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "Install ${APP_NAME_LONG}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Human Resources"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© ${COPYRIGHT_YEAR} XYZ"
VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "${OUTFILE_NAME}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${APP_NAME_SHORT} Installer"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${CLIENT_VERSION}${CLIENT_BUILD}"
;--------------------------------
;Installer Sections
Section "-Initialization"
${If} ${FileExists} $APP_DATA_DIRECTORY
StrCpy $APP_DATA_DIR_PREEXISTS ${TRUE}
${Else}
StrCpy $APP_DATA_DIR_PREEXISTS ${FALSE}
CreateDirectory $APP_DATA_DIRECTORY ; create the application data folder
${EndIf}
${Unless} ${FileExists} $LOGS_DIRECTORY
CreateDirectory $LOGS_DIRECTORY
${EndUnless}
${Unless} ${FileExists} $SETTINGS_DIRECTORY
CreateDirectory $SETTINGS_DIRECTORY
${EndUnless}
${If} $INSTALL_TYPE == "${INSTALL_TYPE_FULL}"
ClearErrors
${If} ${FileExists} $INSTDIR
StrCpy $INSTALL_DIR_PREEXISTS ${TRUE}
${Else}
StrCpy $INSTALL_DIR_PREEXISTS ${FALSE}
CreateDirectory $INSTDIR ; create the folder where ASBS will be installed
${EndIf}
${If} ${Errors}
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Could not create installation directory. Verify you have the proper permissions on your PC.$\r$\nInstallation will be aborted." \
/SD IDOK
Call AbortInstall
${EndIf}
${EndIf}
SectionEnd
SectionGroup /e "${APP_NAME_LONG}" SecASBS
Section "$(^Name) Client Software" SecClient
SectionIn RO
${If} $DO_INSTALL_CLIENT == ${TRUE}
inetc::get /TIMEOUT 30000 \
"${DOWNLOAD_SERVER_NAME}/files/$CLIENT_ZIP_FILENAME" \
"${TEMP_DOWNLOAD_DIRECTORY}\$CLIENT_ZIP_FILENAME"
Pop $0
${If} $0 != "OK"
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Unable to download client files from server '${DOWNLOAD_SERVER_NAME}'.$\r$\nInstallation will be aborted.$\r$\n$\r$\nError: $0" \
/SD IDOK
Call AbortInstall
${EndIf}
SetDetailsPrint both
DetailPrint "Client download complete"
SetDetailsPrint listonly
ClearErrors
!insertmacro ZIPDLL_EXTRACT "${TEMP_DOWNLOAD_DIRECTORY}\$CLIENT_ZIP_FILENAME" "$INSTDIR" "<ALL>"
${If} ${Errors}
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Error occurred extracting $CLIENT_ZIP_FILENAME.$\r$\nInstallation will be aborted." \
/SD IDOK
Abort
${EndIf}
${If} $INSTALL_ARCHIVE_VIEWER == ${FALSE}
Delete "$INSTDIR\${ARCHIVE_EXE_FILENAME}"
Delete "$INSTDIR\${ARCHIVE_ICO_FILENAME}"
${EndIf}
${If} $INSTALL_USER == ${INSTALL_USER_SCRUBBER}
Delete "$INSTDIR\lib\${CONFIG_PROPS_FILENAME}"
Rename /REBOOTOK "$INSTDIR\lib\scrubber_${CONFIG_PROPS_FILENAME}" "$INSTDIR\lib\${CONFIG_PROPS_FILENAME}"
Delete /REBOOTOK "$INSTDIR\lib\voter_${CONFIG_PROPS_FILENAME}"
${ElseIf} $INSTALL_USER == ${INSTALL_USER_VOTER}
Delete "$INSTDIR\lib\${CONFIG_PROPS_FILENAME}"
Rename /REBOOTOK "$INSTDIR\lib\voter_${CONFIG_PROPS_FILENAME}" "$INSTDIR\lib\${CONFIG_PROPS_FILENAME}"
Delete /REBOOTOK "$INSTDIR\lib\scrubber_${CONFIG_PROPS_FILENAME}"
${EndIf}
SetDetailsPrint both
DetailPrint "Client installation complete"
SetDetailsPrint listonly
${EndIf}
SectionEnd
Section "IrfanView Software" SecIrfanView
SectionIn RO
${If} $DO_INSTALL_IRFANVIEW == ${TRUE}
inetc::get /TIMEOUT 30000 \
"${DOWNLOAD_SERVER_NAME}/files/$IRFANVIEW_ZIP_FILENAME" \
"${TEMP_DOWNLOAD_DIRECTORY}\$IRFANVIEW_ZIP_FILENAME"
Pop $0
${If} $0 != "OK"
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Unable to download IrfanView files from server '${DOWNLOAD_SERVER_NAME}'.$\r$\nInstallation will be aborted.$\r$\n$\r$\nError: $0" \
/SD IDOK
Call AbortInstall
${EndIf}
SetDetailsPrint both
DetailPrint "IrfanView download complete"
SetDetailsPrint listonly
ClearErrors
!insertmacro ZIPDLL_EXTRACT "${TEMP_DOWNLOAD_DIRECTORY}\$IRFANVIEW_ZIP_FILENAME" "$INSTDIR" "<ALL>"
${If} ${Errors}
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Error occurred extracting $IRFANVIEW_ZIP_FILENAME.$\r$\nInstallation will be aborted." \
/SD IDOK
Abort
${EndIf}
SetDetailsPrint both
DetailPrint "IrfanView installation complete"
SetDetailsPrint listonly
${EndIf}
SectionEnd
SectionGroupEnd
Section "Java Runtime Environment" SecJRE
SectionIn RO
${If} $DO_INSTALL_JRE == ${TRUE}
SetDetailsPrint both
DetailPrint "Removing previous JRE"
SetDetailsPrint listonly
RMDir /r $INSTDIR/jre
ClearErrors
SetDetailsPrint both
DetailPrint "Downloading JRE"
SetDetailsPrint listonly
inetc::get /TIMEOUT 30000 \
"${DOWNLOAD_SERVER_NAME}/files/$JRE_ZIP_FILENAME" \
"${TEMP_DOWNLOAD_DIRECTORY}\$JRE_ZIP_FILENAME"
Pop $0
${If} $0 != "OK"
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Unable to download Java Runtime Environment files from server '${DOWNLOAD_SERVER_NAME}'.$\r$\nInstallation will be aborted.$\r$\n$\r$\nError: $0" \
/SD IDOK
Call AbortInstall
${EndIf}
SetDetailsPrint both
DetailPrint "JRE download complete"
SetDetailsPrint listonly
ClearErrors
!insertmacro ZIPDLL_EXTRACT "${TEMP_DOWNLOAD_DIRECTORY}\$JRE_ZIP_FILENAME" "$INSTDIR" "<ALL>"
${If} ${Errors}
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Error occurred extracting $JRE_ZIP_FILENAME.$\r$\nInstallation will be aborted." \
/SD IDOK
Abort
${EndIf}
SetDetailsPrint both
DetailPrint "JRE installation complete"
SetDetailsPrint listonly
${EndIf}
SectionEnd
Section "-Finalization"
${If} $INSTALL_TYPE == "${INSTALL_TYPE_UPGRADE}"
SetDetailsPrint textonly
DetailPrint "Removing old files..."
SetDetailsPrint listonly
Delete /REBOOTOK $APP_DATA_DIRECTORY\.keystore
Delete /REBOOTOK $INSTDIR\ASBS_RELEASE_NOTES.RTF
Delete /REBOOTOK $INSTDIR\lib\commons-collections-3.2.jar
Delete /REBOOTOK $INSTDIR\lib\commons-io-1.1.jar
Delete /REBOOTOK $INSTDIR\lib\commons-lang-2.1.jar
Delete /REBOOTOK $INSTDIR\lib\l2fprod-common-directorychooser.jar
Delete /REBOOTOK $INSTDIR\lib\jcalendar.jar
Delete /REBOOTOK $INSTDIR\lib\jcommon-1.0.0.jar
Delete /REBOOTOK $INSTDIR\lib\jcommon-1.0.10.jar
Delete /REBOOTOK $INSTDIR\lib\jfreechart-1.0.0.jar
Delete /REBOOTOK $INSTDIR\lib\jfreechart-1.0.6.jar
Delete /REBOOTOK $INSTDIR\lib\ojdbc14[10.2.0.3].jar
Delete /REBOOTOK $INSTDIR\lib\ojdbc14_10g[10.1.0.5.0].jar
Delete /REBOOTOK $INSTDIR\lib\oracle-thin[10g-1.4].jar
Delete /REBOOTOK $INSTDIR\lib\swinglabs.jar
${EndIf}
SetDetailsPrint textonly
DetailPrint "Updating registry..."
SetDetailsPrint listonly
${If} $INSTALL_TYPE == "${INSTALL_TYPE_FULL}"
; write general application values
WriteRegStr HKLM "${APP_ROOT_REG_KEY}" "${INSTALL_DIR_REG_KEY}" "$INSTDIR"
WriteRegStr HKLM "${APP_ROOT_REG_KEY}" "${APPDATA_DIR_REG_KEY}" "$APP_DATA_DIRECTORY"
WriteRegStr HKLM "${APP_ROOT_REG_KEY}" "${USER_TYPE_REG_KEY}" "$INSTALL_USER"
${EndIf}
; write specific component values
${If} $DO_INSTALL_CLIENT == ${TRUE}
WriteRegStr HKLM "${APP_ROOT_REG_KEY}\${COMPONENTS_REG_KEY}\${CLIENT_COMP_REG_KEY}" "${VERSION_REG_KEY}" "${CLIENT_VERSION}"
WriteRegStr HKLM "${APP_ROOT_REG_KEY}\${COMPONENTS_REG_KEY}\${CLIENT_COMP_REG_KEY}" "${BUILD_REG_KEY}" "${CLIENT_BUILD}"
${EndIf}
${If} $DO_INSTALL_IRFANVIEW == ${TRUE}
WriteRegStr HKLM "${APP_ROOT_REG_KEY}\${COMPONENTS_REG_KEY}\${IRFANVIEW_COMP_REG_KEY}" "${VERSION_REG_KEY}" "${IRFANVIEW_VERSION}"
${EndIf}
${If} $DO_INSTALL_JRE == ${TRUE}
WriteRegStr HKLM "${APP_ROOT_REG_KEY}\${COMPONENTS_REG_KEY}\${JRE_COMP_REG_KEY}" "${VERSION_REG_KEY}" "${JRE_VERSION}"
${EndIf}
; write uninstall strings
StrCpy $R0 "$(^Name) (${APP_NAME_LONG})"
${If} ${ENVIRONMENT} != "prod"
StrCpy $R0 "$R0 - ${ENVIRONMENT}"
${EndIf}
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)-${ENVIRONMENT}" "DisplayName" "$R0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)-${ENVIRONMENT}" "UninstallString" '"$INSTDIR\${UNINSTALLER_FILENAME}"'
SetDetailsPrint textonly
DetailPrint "Creating uninstaller..."
SetDetailsPrint listonly
SetOutPath $INSTDIR
WriteUninstaller "${UNINSTALLER_FILENAME}"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetDetailsPrint textonly
DetailPrint "Creating application shortcuts..."
SetDetailsPrint listonly
;Create shortcuts
SetOutPath "$INSTDIR"
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(^Name).lnk" "$INSTDIR\${APP_EXE_FILENAME}" "" "$INSTDIR\${APP_ICO_FILENAME}" "" "" "" "${APP_NAME_LONG}"
${If} $INSTALL_ARCHIVE_VIEWER == ${TRUE}
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${ARCHIVE_NAME}.lnk" "$INSTDIR\${ARCHIVE_EXE_FILENAME}" "" "$INSTDIR\${ARCHIVE_ICO_FILENAME}" "" "" "" "$(^Name) ${ARCHIVE_NAME}"
${EndIf}
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Release Notes.lnk" "$INSTDIR\${RELEASE_NOTES_FILENAME}" "" "" "" "" "" "$(^Name) Release Notes"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall $(^Name).lnk" "$INSTDIR\${UNINSTALLER_FILENAME}" "" "" "" "" "" "Remove $(^Name) Application"
SetShellVarContext current
!insertmacro MUI_STARTMENU_WRITE_END
; set files to not have readonly attribute, otherwise errors will occur during upgrade
${Locate} "$INSTDIR" "/L=FD /M=*.*" "LocateCallback"
${If} ${Errors}
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Error occurred trying to set file attributes.$\r$\nInstallation will be aborted." \
/SD IDOK
Abort
${EndIf}
SetDetailsPrint textonly
SectionEnd
;--------------------------------
;Functions
Function LocateCallback
; set file to not have any attributes (readonly, etc.)
SetFileAttributes $R9 FILE_ATTRIBUTE_NORMAL
Push $0
FunctionEnd
Function CleanUp
; delete temporary directory used to store downloaded files
RMDir /r /REBOOTOK ${TEMP_DOWNLOAD_DIRECTORY}
${If} $INSTALL_TYPE == "${INSTALL_TYPE_UPGRADE}"
; delete this installer on upgrades
Delete /REBOOTOK $EXEDIR\${OUTFILE_NAME}
${EndIf}
FunctionEnd
Function AbortCleanUp
${If} $INSTALL_TYPE == ${INSTALL_TYPE_FULL}
; a full installation was aborted so check for folders to delete
${If} $APP_DATA_DIR_PREEXISTS == "${FALSE}"
; delete application data folder
RMDir /r /REBOOTOK "$APP_DATA_DIRECTORY"
${EndIf}
${If} $INSTALL_DIR_PREEXISTS == "${FALSE}"
; delete install folder
RMDir /r /REBOOTOK $INSTDIR
${EndIf}
${EndIf}
Call CleanUp
FunctionEnd
Function AbortInstall
Call AbortCleanUp
Quit
FunctionEnd
Function .onInstFailed
Call AbortInstall
FunctionEnd
Function myUserAbort
Call AbortCleanUp
FunctionEnd
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\install.bmp ".\UncleSamInstall.bmp"
File /oname=$PLUGINSDIR\upgrade.bmp ".\UncleSamUpgrade.bmp"
StrCpy $APP_DATA_DIRECTORY "$APPDATA\${APP_NAME_SHORT}\${ENVIRONMENT}"
StrCpy $LOGS_DIRECTORY "$APP_DATA_DIRECTORY\logs"
StrCpy $SETTINGS_DIRECTORY "$APP_DATA_DIRECTORY\settings"
${If} ${ENVIRONMENT} != "prod"
StrCpy $INSTDIR "$INSTDIR-${ENVIRONMENT}"
${EndIf}
; create temporary directory to store downloaded files
CreateDirectory ${TEMP_DOWNLOAD_DIRECTORY}
StrCpy $RETRIEVED_HEADERS ${FALSE}
StrCpy $DO_INSTALL_CLIENT ${TRUE}
StrCpy $DO_INSTALL_IRFANVIEW ${TRUE}
StrCpy $DO_INSTALL_JRE ${TRUE}
StrCpy $INSTALL_ARCHIVE_VIEWER ${TRUE}
${If} ${FileExists} $INSTDIR\${ARCHIVE_EXE_FILENAME}
StrCpy $CHECK_INSTALL_ARCHIVE_VIEWER ${FALSE}
${Else}
StrCpy $CHECK_INSTALL_ARCHIVE_VIEWER ${TRUE}
${EndIf}
; determine if need to perform full install or upgrade
ReadRegStr $R0 "HKLM" "${APP_ROOT_REG_KEY}" "${INSTALL_DIR_REG_KEY}"
${If} ${Errors}
; registry key does not exist so need to perform a full install
StrCpy $INSTALL_TYPE ${INSTALL_TYPE_FULL}
${Else}
; registry key exists so need to perform an upgrade
StrCpy $INSTALL_TYPE ${INSTALL_TYPE_UPGRADE}
ReadRegStr $INSTALL_USER "HKLM" "${APP_ROOT_REG_KEY}" "${USER_TYPE_REG_KEY}"
ReadRegStr $INSTALLED_CLIENT_VER "HKLM" "${APP_ROOT_REG_KEY}\${COMPONENTS_REG_KEY}\${CLIENT_COMP_REG_KEY}" "${VERSION_REG_KEY}"
ReadRegStr $INSTALLED_CLIENT_BUILD "HKLM" "${APP_ROOT_REG_KEY}\${COMPONENTS_REG_KEY}\${CLIENT_COMP_REG_KEY}" "${BUILD_REG_KEY}"
ReadRegStr $INSTALLED_IRFANVIEW_VER "HKLM" "${APP_ROOT_REG_KEY}\${COMPONENTS_REG_KEY}\${IRFANVIEW_COMP_REG_KEY}" "${VERSION_REG_KEY}"
ReadRegStr $INSTALLED_JRE_VER "HKLM" "${APP_ROOT_REG_KEY}\${COMPONENTS_REG_KEY}\${JRE_COMP_REG_KEY}" "${VERSION_REG_KEY}"
${If} $INSTALLED_CLIENT_VER == "${CLIENT_VERSION}"
${AndIf} $INSTALLED_CLIENT_BUILD == "${CLIENT_BUILD}"
StrCpy $DO_INSTALL_CLIENT ${FALSE} ; client versions are equal
${EndIf}
${If} $INSTALLED_IRFANVIEW_VER == "${IRFANVIEW_VERSION}"
StrCpy $DO_INSTALL_IRFANVIEW ${FALSE} ; IrfanView versions are equal
${EndIf}
${If} $INSTALLED_JRE_VER == "${JRE_VERSION}"
StrCpy $DO_INSTALL_JRE ${FALSE} ; JRE versions are equal
${EndIf}
!insertmacro CheckStartMenu
${EndIf}
; load custom pages
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "${INSTALL_USER_INI}"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "${ARCHIVE_VIEWER_INI}"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "${INSTALL_READY_INI}"
; disable ASBS section group
!insertmacro SetSectionFlag ${SecASBS} ${SF_RO}
StrCpy $R0 "is up-to-date and will not be upgraded"
${If} $DO_INSTALL_CLIENT == ${TRUE}
StrCpy $SECTION_DESC_CLIENT "$(^Name) core files"
${Else}
SectionGetText ${SecClient} $0
StrCpy $SECTION_DESC_CLIENT "$0 $R0"
${EndIf}
${If} $DO_INSTALL_IRFANVIEW == ${TRUE}
StrCpy $SECTION_DESC_IRFANVIEW "IrfanView application for image manipulation"
${Else}
SectionGetText ${SecIrfanView} $0
StrCpy $SECTION_DESC_IRFANVIEW "$0 $R0"
${EndIf}
${If} $DO_INSTALL_JRE == ${TRUE}
StrCpy $SECTION_DESC_JRE "Java Runtime Environment used to launch $(^Name)"
${Else}
SectionGetText ${SecJRE} $0
StrCpy $SECTION_DESC_JRE "$0 $R0"
${EndIf}
FunctionEnd
Function .onGUIEnd
Call CleanUp
FunctionEnd
Function PreWelcomePage
${If} $INSTALL_TYPE == "${INSTALL_TYPE_FULL}"
; this is a full install
StrCpy $R0 "$PLUGINSDIR\install.bmp"
${ElseIf} $INSTALL_TYPE == "${INSTALL_TYPE_UPGRADE}"
; this is an upgrade
StrCpy $R0 "$PLUGINSDIR\upgrade.bmp"
${EndIf}
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Text" "$R0"
${If} $DO_INSTALL_CLIENT == ${FALSE}
${AndIf} $DO_INSTALL_IRFANVIEW == ${FALSE}
${AndIf} $DO_INSTALL_JRE == ${FALSE}
; exit install if no newer versions found
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Text" \
"The current installation of $(^Name) is completely up-to-date.\r\n\r\nClick $(^CancelBtn) to exit."
GetDlgItem $0 $HWNDPARENT 1 ; gets the Next button
EnableWindow $0 0 ; disables the Next button
${EndIf}
FunctionEnd
Function LeaveWelcomePage
${If} $RETRIEVED_HEADERS == ${FALSE}
inetc::get /NOCANCEL /TIMEOUT 30000 \
/CAPTION "$(^Name) ${CLIENT_VERSION} Setup" \
/BANNER "Downloading installation properties from server.$\r$\n$\r$\nPlease Wait..." \
${DOWNLOAD_SERVER_NAME}/files/${INSTALL_PROPS_FILENAME} \
${TEMP_DOWNLOAD_DIRECTORY}\${INSTALL_PROPS_FILENAME} /END
Pop $0
${If} $0 != "OK"
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Unable to download installation properties file from server '${DOWNLOAD_SERVER_NAME}'.$\r$\nInstallation will be aborted.$\r$\n$\r$\nError: $0" \
/SD IDOK
Call AbortInstall
${EndIf}
${If} $DO_INSTALL_CLIENT == ${TRUE}
${ConfigRead} "${TEMP_DOWNLOAD_DIRECTORY}\${INSTALL_PROPS_FILENAME}" "CLIENT_COMPRESSED_FILENAME=" $CLIENT_ZIP_FILENAME
${ConfigRead} "${TEMP_DOWNLOAD_DIRECTORY}\${INSTALL_PROPS_FILENAME}" "CLIENT_SIZE_UNCOMPRESSED=" $R1
; set section size in kilobytes
IntOp $R1 $R1 / 1024
SectionSetSize SecClient $R1
${EndIf}
${If} $DO_INSTALL_IRFANVIEW == ${TRUE}
${ConfigRead} "${TEMP_DOWNLOAD_DIRECTORY}\${INSTALL_PROPS_FILENAME}" "IRFANVIEW_COMPRESSED_FILENAME=" $IRFANVIEW_ZIP_FILENAME
${ConfigRead} "${TEMP_DOWNLOAD_DIRECTORY}\${INSTALL_PROPS_FILENAME}" "IRFANVIEW_SIZE_UNCOMPRESSED=" $R2
; set section size in kilobytes
IntOp $R2 $R2 / 1024
SectionSetSize SecIrfanView $R2
${EndIf}
${If} $DO_INSTALL_JRE == ${TRUE}
${ConfigRead} "${TEMP_DOWNLOAD_DIRECTORY}\${INSTALL_PROPS_FILENAME}" "JRE_COMPRESSED_FILENAME=" $JRE_ZIP_FILENAME
${ConfigRead} "${TEMP_DOWNLOAD_DIRECTORY}\${INSTALL_PROPS_FILENAME}" "JRE_SIZE_UNCOMPRESSED=" $R3
; set section size in kilobytes
IntOp $R3 $R3 / 1024
SectionSetSize SecJRE $R3
${EndIf}
StrCpy $RETRIEVED_HEADERS ${TRUE}
${EndIf}
FunctionEnd
Function CreateInstallTypePage
${If} $INSTALL_TYPE == "${INSTALL_TYPE_FULL}"
!insertmacro MUI_HEADER_TEXT "Choose Installation Type" "Choose the type of installation."
!insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTALL_USER_INI}" "Field 1" "Text" "Select the type of installation to be performed. This should be based on the type user who will be running $(^Name) once installed. Click Next to continue."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "${INSTALL_USER_INI}"
${EndIf}
FunctionEnd
Function LeaveInstallTypePage
ReadINIStr $R0 "$PLUGINSDIR\${INSTALL_USER_INI}" "Field 3" "State" ; scrubber
ReadINIStr $R1 "$PLUGINSDIR\${INSTALL_USER_INI}" "Field 4" "State" ; voter
${If} $R0 = ${TRUE}
StrCpy $INSTALL_USER ${INSTALL_USER_SCRUBBER}
${ElseIf} $R1 = ${TRUE}
StrCpy $INSTALL_USER ${INSTALL_USER_VOTER}
${EndIf}
FunctionEnd
Function PreComponentsPage
; uncheck sections which will not be installed
${If} $DO_INSTALL_CLIENT == ${FALSE}
!insertmacro UnselectSection ${SecClient}
${EndIf}
${If} $DO_INSTALL_IRFANVIEW == ${FALSE}
!insertmacro UnselectSection ${SecIrfanView}
${EndIf}
${If} $DO_INSTALL_JRE == ${FALSE}
!insertmacro UnselectSection ${SecJRE}
${EndIf}
FunctionEnd
Function ShowComponentsPage
${If} $INSTALL_TYPE == "${INSTALL_TYPE_FULL}"
!insertmacro MUI_HEADER_TEXT "Components" "$(^Name) features to be installed."
${ElseIf} $INSTALL_TYPE == "${INSTALL_TYPE_UPGRADE}"
!insertmacro MUI_HEADER_TEXT "Components" "$(^Name) features to be updated."
${EndIf}
FunctionEnd
Function ShowDirectoryPage
${If} $INSTALL_TYPE == "${INSTALL_TYPE_UPGRADE}"
!insertmacro MUI_HEADER_TEXT "Install Location" "Current location of $(^Name)."
${EndIf}
FindWindow $R1 "#32770" "" $HWNDPARENT
ReadRegStr $R0 "HKLM" "${APP_ROOT_REG_KEY}" "${INSTALL_DIR_REG_KEY}"
${If} ${Errors}
; enable page so user can specify a destination folder
GetDlgItem $R2 $R1 1019 # Dir box
EnableWindow $R2 1
GetDlgItem $R2 $R1 1001 # Browse button
EnableWindow $R2 1
${Else}
; ASBS already installed so disbale page and install into same folder
GetDlgItem $R2 $R1 1006 # Dir box
SendMessage $R2 ${WM_SETTEXT} 1 "STR:Setup will install $(^Name) in the following folder. $_CLICK"
GetDlgItem $R2 $R1 1019 # Dir box
EnableWindow $R2 0
GetDlgItem $R2 $R1 1001 # Browse button
EnableWindow $R2 0
${EndIf}
FunctionEnd
Function LeaveDirectoryPage
${If} $INSTALL_TYPE == "${INSTALL_TYPE_FULL}"
${AndIf} ${FileExists} $INSTDIR
MessageBox MB_YESNO|MB_ICONQUESTION \
"The selected folder already exists. Are you sure you want to install $(^Name) in$\r$\n$INSTDIR?" \
/SD IDNO IDYES proceed IDNO stop
stop:
Abort
proceed:
${EndIf}
FunctionEnd
Function CreateArchiveViewerPage
${If} $CHECK_INSTALL_ARCHIVE_VIEWER = ${TRUE}
!insertmacro MUI_HEADER_TEXT "${ARCHIVE_NAME}" "Install ${ARCHIVE_NAME}."
!insertmacro MUI_INSTALLOPTIONS_WRITE "${ARCHIVE_VIEWER_INI}" "Field 1" "Text" "Select whether or not to install the ${ARCHIVE_NAME}. Click Next to continue."
!insertmacro MUI_INSTALLOPTIONS_WRITE "${ARCHIVE_VIEWER_INI}" "Field 2" "Text" "Install ${ARCHIVE_NAME}?"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "${ARCHIVE_VIEWER_INI}"
${EndIf}
FunctionEnd
Function LeaveArchiveViewerPage
ReadINIStr $R0 "$PLUGINSDIR\${ARCHIVE_VIEWER_INI}" "Field 3" "State" ; no
ReadINIStr $R1 "$PLUGINSDIR\${ARCHIVE_VIEWER_INI}" "Field 4" "State" ; yes
${If} $R0 = ${TRUE}
StrCpy $INSTALL_ARCHIVE_VIEWER ${FALSE}
${ElseIf} $R1 = ${TRUE}
StrCpy $INSTALL_ARCHIVE_VIEWER ${TRUE}
${EndIf}
FunctionEnd
Function PreStartMenuPage
${If} $SKIP_STARTMENU = ${TRUE}
Abort
${EndIf}
${If} ${ENVIRONMENT} != "prod"
StrCpy $STARTMENU_FOLDER "${APP_NAME_LONG} (${ENVIRONMENT})"
${EndIf}
FunctionEnd
Function CreateInstallReadyPage
!insertmacro MUI_HEADER_TEXT "Install Confirmation" "The installation wizard is ready to install."
Var /GLOBAL ConfirmList
Var /GLOBAL DELIMITER
StrCpy $ConfirmList ""
StrCpy $DELIMITER "\r\n"
!insertmacro AddConfirmItem "User type: $INSTALL_USER" $ConfirmList $DELIMITER
${If} ${SectionIsSelected} ${SecClient}
SectionGetText ${SecClient} $0
!insertmacro AddConfirmItem "Install $0" $ConfirmList $DELIMITER
${EndIf}
${If} $CHECK_INSTALL_ARCHIVE_VIEWER = ${TRUE}
${Switch} $INSTALL_ARCHIVE_VIEWER
${Case} ${FALSE}
!insertmacro AddConfirmItem "Do not install ${ARCHIVE_NAME}" $ConfirmList $DELIMITER
${Break}
${Case} ${TRUE}
!insertmacro AddConfirmItem "Install ${ARCHIVE_NAME}" $ConfirmList $DELIMITER
${EndSwitch}
${EndIf}
${If} ${SectionIsSelected} ${SecIrfanView}
SectionGetText ${SecIrfanView} $0
!insertmacro AddConfirmItem "Install $0" $ConfirmList $DELIMITER
${EndIf}
${If} ${SectionIsSelected} ${SecJRE}
SectionGetText ${SecJRE} $0
!insertmacro AddConfirmItem "Install $0" $ConfirmList $DELIMITER
${EndIf}
!insertmacro AddConfirmItem "Destination: $INSTDIR" $ConfirmList $DELIMITER
${StrLoc} $0 "$STARTMENU_FOLDER" ">" ">"
${If} $0 == 0
!insertmacro AddConfirmItem "Do not create shortcuts" $ConfirmList $DELIMITER
${Else}
!insertmacro AddConfirmItem "Start menu folder: $STARTMENU_FOLDER" $ConfirmList $DELIMITER
${EndIf}
!insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTALL_READY_INI}" "Field 2" "State" "$ConfirmList"
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "${INSTALL_READY_INI}"
Pop $R0 # HWND
GetDlgItem $R1 $R0 1201
SetCtlColors $R1 0x000000 0xFFFFFF
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd
Function PreFinishPage
GetDlgItem $R0 $HWNDPARENT 1
SendMessage $R0 ${WM_SETTEXT} "" "STR:Finish"
; add checkbox to allow user to specify whether to create desktop shortcut
!define CREATE_DESKTOP_SHORTCUT_FIELD "Field 7"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "NumFields" "7"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "${CREATE_DESKTOP_SHORTCUT_FIELD}" "Text" "Create Desktop Shortcut"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "${CREATE_DESKTOP_SHORTCUT_FIELD}" "Type" "CheckBox"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "${CREATE_DESKTOP_SHORTCUT_FIELD}" "Left" "120"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "${CREATE_DESKTOP_SHORTCUT_FIELD}" "Right" "315"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "${CREATE_DESKTOP_SHORTCUT_FIELD}" "Top" "130"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "${CREATE_DESKTOP_SHORTCUT_FIELD}" "Bottom" "140"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "${CREATE_DESKTOP_SHORTCUT_FIELD}" "State" "1"
FunctionEnd
Function ShowFinishPage
GetDlgItem $MUI_TEMP1 $MUI_HWND 1206 ; ID for Create Desktop Shortcut checkbox
SetCtlColors $MUI_TEMP1 "" "${MUI_BGCOLOR}"
GetDlgItem $0 $HWNDPARENT 2 ; gets the Cancel button
EnableWindow $0 0 ; disables the Cancel button
FunctionEnd
Function LeaveFinishPage
!insertmacro MUI_INSTALLOPTIONS_READ $MUI_TEMP1 "ioSpecial.ini" "${CREATE_DESKTOP_SHORTCUT_FIELD}" "State"
${If} $MUI_TEMP1 = ${TRUE}
; create desktop shortcut(s)
SetShellVarContext all
StrCpy $R0 "$(^Name)"
${If} ${ENVIRONMENT} != "prod"
StrCpy $R0 "$R0 (${ENVIRONMENT})"
${EndIf}
CreateShortCut "$DESKTOP\$R0.lnk" "$INSTDIR\${APP_EXE_FILENAME}" "" "$INSTDIR\${APP_ICO_FILENAME}" "" "" "" "${APP_NAME_LONG}"
SetShellVarContext current
${EndIf}
FunctionEnd
Function FinishPageRun
; check if user selected checkbox to launch application on finish
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "ioSpecial.ini" "Field 4" "State"
${If} $R0 = ${TRUE}
Exec "${APP_EXE_FILENAME}"
${EndIf}
FunctionEnd
;--------------------------------
;Descriptions
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecASBS} "Main application"
!insertmacro MUI_DESCRIPTION_TEXT ${SecClient} "$SECTION_DESC_CLIENT"
!insertmacro MUI_DESCRIPTION_TEXT ${SecIrfanView} "$SECTION_DESC_IRFANVIEW"
!insertmacro MUI_DESCRIPTION_TEXT ${SecJRE} "$SECTION_DESC_JRE"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecASBS} "Main application"
!insertmacro MUI_DESCRIPTION_TEXT ${SecClient} "$SECTION_DESC_CLIENT"
!insertmacro MUI_DESCRIPTION_TEXT ${SecIrfanView} "$SECTION_DESC_IRFANVIEW"
!insertmacro MUI_DESCRIPTION_TEXT ${SecJRE} "$SECTION_DESC_JRE"
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
;--------------------------------
; Uninstaller
Section "Uninstall"
ReadRegStr $R0 "HKLM" "${APP_ROOT_REG_KEY}" "${INSTALL_DIR_REG_KEY}"
${If} ${Errors}
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Registry setting not found (HKLM\${APP_ROOT_REG_KEY}\${INSTALL_DIR_REG_KEY}).$\r$\nUninstallation will be aborted." \
/SD IDOK
Quit
${EndIf}
ReadRegStr $APP_DATA_DIRECTORY "HKLM" "${APP_ROOT_REG_KEY}" "${APPDATA_DIR_REG_KEY}"
${If} ${Errors}
MessageBox MB_OK|MB_ICONEXCLAMATION \
"Registry setting not found (HKLM\${APP_ROOT_REG_KEY}\${APPDATA_DIR_REG_KEY}).$\r$\nUninstallation will be aborted." \
/SD IDOK
Quit
${EndIf}
; remove registry entries
SetDetailsPrint both
DetailPrint "Removing Registry Keys..."
SetDetailsPrint listonly
DeleteRegKey /ifempty HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)-${ENVIRONMENT}"
DeleteRegKey HKLM "${APP_ROOT_REG_KEY}\${COMPONENTS_REG_KEY}"
DeleteRegKey /ifempty HKLM "${APP_ROOT_REG_KEY}"
; remove shortcuts
SetDetailsPrint both
DetailPrint "Removing Shortcuts..."
SetDetailsPrint listonly
SetShellVarContext all
RMDir /r /REBOOTOK "$SMPROGRAMS\$STARTMENU_FOLDER"
StrCpy $R1 "$(^Name)"
${If} ${ENVIRONMENT} != "prod"
StrCpy $R1 "$R1 (${ENVIRONMENT})"
${EndIf}
Delete /REBOOTOK "$DESKTOP\$R1.lnk"
SetShellVarContext current
; remove files
SetDetailsPrint both
DetailPrint "Removing $(^Name) Core Files..."
SetDetailsPrint listonly
RMDir /r /REBOOTOK "$R0\lib"
Delete /REBOOTOK "$R0\*"
SetDetailsPrint both
DetailPrint "Removing IrfanView Application..."
SetDetailsPrint listonly
RMDir /r /REBOOTOK "$R0\IrfanView"
SetDetailsPrint both
DetailPrint "Removing Java Runtime Environment..."
SetDetailsPrint listonly
RMDir /r /REBOOTOK "$R0\jre"
RMDir /r /REBOOTOK "$R0"
SetDetailsPrint both
DetailPrint "Removing Application Data..."
SetDetailsPrint listonly
RMDir /r /REBOOTOK "$APP_DATA_DIRECTORY"
SetDetailsPrint textonly
SectionEnd
Function un.onInit
!insertmacro CheckStartMenu
FunctionEnd
Function un.PreFinishPage
GetDlgItem $R0 $HWNDPARENT 1
SendMessage $R0 ${WM_SETTEXT} "" "STR:Finish"
FunctionEnd