installation windows files update
[cdmlib.git] / cdm-server / src / main / installer / win32 / cdmserver.nsi
1 ; Script generated by the HM NIS Edit Script Wizard.
2
3 ;Copy a file
4 !define FileCopy `!insertmacro FileCopy`
5 !macro FileCopy FilePath TargetDir
6 CreateDirectory `${TargetDir}`
7 CopyFiles `${FilePath}` `${TargetDir}`
8 !macroend
9
10 ; HM NIS Edit Wizard helper defines
11 !define PRODUCT_NAME "cdmserver"
12 !define PRODUCT_VERSION "1.0"
13 !define PRODUCT_PUBLISHER "EDIT"
14 !define PRODUCT_WEB_SITE "http://wp5.e-taxonomy.eu/"
15 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
16 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
17
18 !define COPYRIGHT_FILE "..\templates\copyright.txt"
19 !define DATASOURCES_FILE "..\templates\.cdmLibrary\datasources.xml"
20 !define JAR_FILE "..\..\..\..\target\cdm-server-2.5.jar"
21
22 !define JAR_FILE_NAME "cdm-server-2.5.jar"
23 !define COPYRIGHT_FILE_NAME "copyright.txt"
24
25 ; MUI 1.67 compatible ------
26 !include "MUI.nsh"
27
28 ; MUI Settings
29 !define MUI_ABORTWARNING
30 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
31 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
32
33 ; Language Selection Dialog Settings
34 !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
35 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
36 !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
37
38 ; Welcome page
39 !insertmacro MUI_PAGE_WELCOME
40 ; License page
41 !insertmacro MUI_PAGE_LICENSE ${COPYRIGHT_FILE}
42 ; Directory page
43 !insertmacro MUI_PAGE_DIRECTORY
44 ; Instfiles page
45 !insertmacro MUI_PAGE_INSTFILES
46 ; Finish page
47 !insertmacro MUI_PAGE_FINISH
48
49 ; Uninstaller pages
50 !insertmacro MUI_UNPAGE_INSTFILES
51
52 ; Language files
53 !insertmacro MUI_LANGUAGE "English"
54 !insertmacro MUI_LANGUAGE "French"
55 !insertmacro MUI_LANGUAGE "German"
56 !insertmacro MUI_LANGUAGE "Spanish"
57
58 ; MUI end ------
59
60 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
61 OutFile "Setup.exe"
62 InstallDir "$PROGRAMFILES\cdmserver"
63 ShowInstDetails show
64 ShowUnInstDetails show
65
66 Function .onInit
67 !insertmacro MUI_LANGDLL_DISPLAY
68 FunctionEnd
69
70 Section "MainSection" SEC01
71 SetOutPath "$INSTDIR\bin"
72 SetOverwrite try
73 File "cdmserver\bin\cdmserver.bat"
74 File "cdmserver\bin\cdmserver.exe"
75 SetOutPath "$INSTDIR\libs\.cdmLibrary"
76 ;File "cdmserver\libs\.cdmLibrary\datasources.xml"
77 File ${DATASOURCES_FILE}
78 SetOutPath "$INSTDIR\libs"
79 ;File "cdmserver\libs\cdmserver-standalone.jar"
80 File ${JAR_FILE}
81 SetOutPath "$INSTDIR\license"
82 ;File "cdmserver\license\license.txt"
83 File ${COPYRIGHT_FILE}
84 SetOutPath "$INSTDIR\logs"
85 ;File "cdmserver\logs\cdmserverLog.txt"
86 ${FileCopy} `$INSTDIR\libs\.cdmLibrary\datasources.xml` `$PROFILE\.cdmLibrary`
87 SectionEnd
88
89 Section -AdditionalIcons
90 SetOutPath $INSTDIR
91 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
92 CreateDirectory "$SMPROGRAMS\cdmserver"
93 CreateShortCut "$SMPROGRAMS\cdmserver\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
94 CreateShortCut "$SMPROGRAMS\cdmserver\Uninstall.lnk" "$INSTDIR\uninst.exe"
95 CreateShortCut "$SMPROGRAMS\cdmserver\cdmserver.lnk" "$INSTDIR\bin\cdmserver.exe"
96 SectionEnd
97
98 Section -Post
99 WriteUninstaller "$INSTDIR\uninst.exe"
100 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
101 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
102 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
103 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
104 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
105 SectionEnd
106
107
108 Function un.onUninstSuccess
109 HideWindow
110 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
111 FunctionEnd
112
113 Function un.onInit
114 !insertmacro MUI_UNGETLANGUAGE
115 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
116 Abort
117 FunctionEnd
118
119 Section Uninstall
120 Delete "$INSTDIR\${PRODUCT_NAME}.url"
121 Delete "$INSTDIR\uninst.exe"
122 ;Delete "$INSTDIR\logs\cdmserverLog.txt"
123 Delete "$INSTDIR\license\${COPYRIGHT_FILE_NAME}"
124 Delete "$INSTDIR\libs\${JAR_FILE_NAME}"
125 Delete "$INSTDIR\libs\.cdmLibrary\datasources.xml"
126 Delete "$INSTDIR\bin\cdmserver.bat"
127 Delete "$INSTDIR\bin\cdmserver.exe"
128
129 Delete "$SMPROGRAMS\cdmserver\Uninstall.lnk"
130 Delete "$SMPROGRAMS\cdmserver\Website.lnk"
131 Delete "$SMPROGRAMS\cdmserver\cdmserver.lnk"
132
133 RMDir "$SMPROGRAMS\cdmserver"
134 RMDir "$INSTDIR\logs"
135 RMDir "$INSTDIR\license"
136 RMDir "$INSTDIR\libs\.cdmLibrary"
137 RMDir "$INSTDIR\libs"
138 RMDir "$INSTDIR\bin"
139
140 Delete "$PROFILE\.cdmLibrary\datasources.xml"
141 RMDir "$PROFILE\.cdmLibrary"
142
143 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
144 SetAutoClose true
145 SectionEnd