# Auto-generated by EclipseNSIS Script Wizard # 28.10.2010 13:58:54 # TODO : preserve $INSTDIR/.cdmLibrary from being deleted if the user desides to keep it, or just warn the user. # # Wiki: http://nsis.sourceforge.net/Main_Page # see http://nsis.sourceforge.net/Docs/Chapter5.html for Compile Time Command reference # Name "EDIT CDM-Server" # General Symbol Definitions !define /date BUILD_TIMESTAMP "%Y%m%d-%H%M%S" !define REGKEY "SOFTWARE\$(^Name)" !define VERSION ${project.version} !define COMPANY "EDIT - European Distributed Institute of Taxonomy" !define EDIT_PLATFORM "EDIT Platform for Cybertaxonomy" !define URL http://wp5.e-taxonomy.eu/ !define URL-EDIT http://www.e-taxonomy.eu/ # Included files !include Sections.nsh # Files and Folders !define OUT_FOLDER "${project.build.directory}" !define JAR_FILE_NAME "cdm-server-${VERSION}.jar" !define JAR_FILE "${project.build.directory}\${JAR_FILE_NAME}" !define CDMLIBRARY_TEMPLATE "${project.build.directory}\installer\templates\.cdmLibrary" # Reserved Files ReserveFile "${NSISDIR}\Plugins\StartMenu.dll" # Variables Var StartMenuGroup # Installer pages Page license Page directory Page custom StartMenuGroupSelect "" ": Start Menu Folder" Page instfiles # Installer attributes OutFile "${OUT_FOLDER}\EDIT CDM-Server-${VERSION}-${BUILD_TIMESTAMP}.exe" InstallDir "$PROGRAMFILES\EDIT CDM-Server" CRCCheck on XPStyle on Icon "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" ShowInstDetails show AutoCloseWindow false LicenseData ${project.basedir}\LICENSE.TXT VIProductVersion 3.0.0.0 VIAddVersionKey ProductName "$(^Name)" VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey CompanyName "${COMPANY}" VIAddVersionKey CompanyWebsite "${URL}" VIAddVersionKey FileVersion "${VERSION}" VIAddVersionKey FileDescription "" VIAddVersionKey LegalCopyright "" InstallDirRegKey HKLM "${REGKEY}" Path UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" ShowUninstDetails show # Installer sections Section -Main SEC0000 SetOutPath $INSTDIR SetOverwrite on File /r /x .svn /x *.log /x *.jar program-folder\* SetOutPath "$INSTDIR\lib" File ${JAR_FILE} # last but not least the .cdmLibrary folder unlesses it already exists SetOverwrite off SetOutPath $INSTDIR File /r /x .svn ${CDMLIBRARY_TEMPLATE} WriteRegStr HKLM "${REGKEY}\Components" Main 1 SectionEnd Section -post SEC0001 WriteRegStr HKLM "${REGKEY}" Path $INSTDIR WriteRegStr HKLM "${REGKEY}" StartMenuGroup $StartMenuGroup SetOutPath $INSTDIR WriteUninstaller $INSTDIR\uninstall.exe SetOutPath $SMPROGRAMS\$StartMenuGroup CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)" WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}" WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}" WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}" WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1 ExecWait '"$INSTDIR\CDMServer.exe" --install "$INSTDIR\etc\CDMServer.conf$\"' ExecWait '"$INSTDIR\CDMServer.exe" --start "$INSTDIR\etc\CDMServer.conf$\"' SectionEnd Section -AdditionalIcons SEC0003 SetOutPath $INSTDIR WriteIniStr "$INSTDIR\${EDIT_PLATFORM}.url" "InternetShortcut" "URL" "${URL}" WriteIniStr "$INSTDIR\${COMPANY}.url" "InternetShortcut" "URL" "${URL-EDIT}" CreateDirectory "$SMPROGRAMS\$(^Name)" CreateShortCut "$SMPROGRAMS\$(^Name)\${EDIT_PLATFORM}.lnk" "$INSTDIR\${EDIT_PLATFORM}.url" CreateShortCut "$SMPROGRAMS\$(^Name)\${COMPANY}.lnk" "$INSTDIR\${COMPANY}.url" CreateShortCut "$SMPROGRAMS\$(^Name)\Uninstall $(^Name).lnk" "$INSTDIR\uninstall.exe" CreateShortCut "$SMPROGRAMS\$(^Name)\Start $(^Name).lnk" "$INSTDIR\start-service.bat" CreateShortCut "$SMPROGRAMS\$(^Name)\Stop $(^Name).lnk" "$INSTDIR\stop-service.bat" SectionEnd # Macro for selecting uninstaller sections !macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID Push $R0 ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}" StrCmp $R0 1 0 next${UNSECTION_ID} !insertmacro SelectSection "${UNSECTION_ID}" GoTo done${UNSECTION_ID} next${UNSECTION_ID}: !insertmacro UnselectSection "${UNSECTION_ID}" done${UNSECTION_ID}: Pop $R0 !macroend # Uninstaller sections Section /o -un.Main UNSEC0000 ExecWait '"$INSTDIR\CDMServer.exe" --remove "$INSTDIR\etc\CDMServer.conf$\"' RmDir /r /REBOOTOK $INSTDIR DeleteRegValue HKLM "${REGKEY}\Components" Main SectionEnd Section -un.post UNSEC0001 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" Delete /REBOOTOK $INSTDIR\uninstall.exe DeleteRegValue HKLM "${REGKEY}" StartMenuGroup DeleteRegValue HKLM "${REGKEY}" Path DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components" DeleteRegKey /IfEmpty HKLM "${REGKEY}" RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup RmDir /REBOOTOK $INSTDIR SectionEnd # Installer functions Function StartMenuGroupSelect Push $R1 StartMenu::Select /autoadd /text "Select the Start Menu folder in which to create the program's shortcuts:" /lastused $StartMenuGroup "$(^Name)" Pop $R1 StrCmp $R1 success success StrCmp $R1 cancel done MessageBox MB_OK $R1 Goto done success: Pop $StartMenuGroup done: Pop $R1 FunctionEnd Function .onInstSuccess FunctionEnd Function .onInit InitPluginsDir FunctionEnd # Uninstaller functions Function un.onInit ReadRegStr $INSTDIR HKLM "${REGKEY}" Path ReadRegStr $StartMenuGroup HKLM "${REGKEY}" StartMenuGroup !insertmacro SELECT_UNSECTION Main ${UNSEC0000} FunctionEnd