1 # Auto-generated by EclipseNSIS Script Wizard
4 # TODO : preserve $INSTDIR/.cdmLibrary from being deleted if the user desides to keep it, or just warn the user.
8 # General Symbol Definitions
9 !define REGKEY "SOFTWARE\$(^Name)"
11 !define COMPANY "EDIT - European Distributed Institute of Taxonomy"
12 !define EDIT_PLATFORM "EDIT Platform for Cybertaxonomy"
13 !define URL http://wp5.e-taxonomy.eu/
14 !define URL-EDIT http://www.e-taxonomy.eu/
20 !define OUT_FOLDER "..\..\..\..\dist"
21 !define JAR_FILE_NAME "cdm-server-${VERSION}.jar"
22 !define JAR_FILE "..\..\..\..\target\${JAR_FILE_NAME}"
23 !define CDMLIBRARY_TEMPLATE "..\templates\.cdmLibrary"
26 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
34 Page custom StartMenuGroupSelect "" ": Start Menu Folder"
37 # Installer attributes
38 OutFile "${OUT_FOLDER}\EDIT CDM-Server-${VERSION}.exe"
39 InstallDir "$PROGRAMFILES\EDIT CDM-Server"
42 Icon "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
45 LicenseData ..\..\..\..\LICENSE.TXT
46 VIProductVersion 2.5.0.0
47 VIAddVersionKey ProductName "$(^Name)"
48 VIAddVersionKey ProductVersion "${VERSION}"
49 VIAddVersionKey CompanyName "${COMPANY}"
50 VIAddVersionKey CompanyWebsite "${URL}"
51 VIAddVersionKey FileVersion "${VERSION}"
52 VIAddVersionKey FileDescription ""
53 VIAddVersionKey LegalCopyright ""
54 InstallDirRegKey HKLM "${REGKEY}" Path
55 UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
56 ShowUninstDetails show
62 File /r /x .svn /x *.log /x *.jar program-folder\*
63 SetOutPath "$INSTDIR\lib"
65 # last but not least the .cdmLibrary folder unlesses it already exists
68 File /r /x .svn ${CDMLIBRARY_TEMPLATE}
69 WriteRegStr HKLM "${REGKEY}\Components" Main 1
73 WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
74 WriteRegStr HKLM "${REGKEY}" StartMenuGroup $StartMenuGroup
76 WriteUninstaller $INSTDIR\uninstall.exe
77 SetOutPath $SMPROGRAMS\$StartMenuGroup
78 CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
79 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
80 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
81 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
82 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
83 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
84 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
85 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
86 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
88 ExecWait '"$INSTDIR\CDMServer.exe" --install "$INSTDIR\etc\CDMServer.conf$\"'
89 ExecWait '"$INSTDIR\CDMServer.exe" --start "$INSTDIR\etc\CDMServer.conf$\"'
92 Section -AdditionalIcons SEC0003
94 WriteIniStr "$INSTDIR\${EDIT_PLATFORM}.url" "InternetShortcut" "URL" "${URL}"
95 WriteIniStr "$INSTDIR\${COMPANY}.url" "InternetShortcut" "URL" "${URL-EDIT}"
96 CreateDirectory "$SMPROGRAMS\$(^Name)"
97 CreateShortCut "$SMPROGRAMS\$(^Name)\${EDIT_PLATFORM}.lnk" "$INSTDIR\${EDIT_PLATFORM}.url"
98 CreateShortCut "$SMPROGRAMS\$(^Name)\${COMPANY}.lnk" "$INSTDIR\${COMPANY}.url"
99 CreateShortCut "$SMPROGRAMS\$(^Name)\Uninstall $(^Name).lnk" "$INSTDIR\uninstall.exe"
100 CreateShortCut "$SMPROGRAMS\$(^Name)\Start $(^Name).lnk" "$INSTDIR\start-service.bat"
101 CreateShortCut "$SMPROGRAMS\$(^Name)\Stop $(^Name).lnk" "$INSTDIR\stop-service.bat"
104 # Macro for selecting uninstaller sections
105 !macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
107 ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
108 StrCmp $R0 1 0 next${UNSECTION_ID}
109 !insertmacro SelectSection "${UNSECTION_ID}"
110 GoTo done${UNSECTION_ID}
112 !insertmacro UnselectSection "${UNSECTION_ID}"
117 # Uninstaller sections
118 Section /o -un.Main UNSEC0000
119 ExecWait '"$INSTDIR\CDMServer.exe" --remove "$INSTDIR\etc\CDMServer.conf$\"'
120 RmDir /r /REBOOTOK $INSTDIR
121 DeleteRegValue HKLM "${REGKEY}\Components" Main
124 Section -un.post UNSEC0001
125 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
126 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
127 Delete /REBOOTOK $INSTDIR\uninstall.exe
128 DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
129 DeleteRegValue HKLM "${REGKEY}" Path
130 DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
131 DeleteRegKey /IfEmpty HKLM "${REGKEY}"
132 RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
133 RmDir /REBOOTOK $INSTDIR
136 # Installer functions
137 Function StartMenuGroupSelect
139 StartMenu::Select /autoadd /text "Select the Start Menu folder in which to create the program's shortcuts:" /lastused $StartMenuGroup "$(^Name)"
141 StrCmp $R1 success success
142 StrCmp $R1 cancel done
151 Function .onInstSuccess
159 # Uninstaller functions
161 ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
162 ReadRegStr $StartMenuGroup HKLM "${REGKEY}" StartMenuGroup
163 !insertmacro SELECT_UNSECTION Main ${UNSEC0000}