Merge branch 'master' of git+ssh://repo.or.cz/srv/git/jben
[jben.git] / src / installer.nsi
blob77e35638ab149bc33058dbd56e7595566c6788fb
1 # This installer requires a version of NSIS with NSISdl support (any recent one),
2 # plus the ZipDLL plugin.
3 Name "J-Ben ${version}"
4 OutFile "..\archives\${version}\J-Ben_${version}_Installer.exe"
5 InstallDir $PROGRAMFILES\J-Ben
6 InstallDirRegKey HKLM \
7 "Software\Microsoft\Windows\CurrentVersion\Uninstall\J-Ben" \
8 "InstallLocation"
10 LicenseData ..\J-Ben\COPYING
11 LicenseForceSelection checkbox
13 Page license
14 Page components
15 Page directory
16 Page instfiles
17 UninstPage uninstConfirm
18 UninstPage components
19 UninstPage instfiles
21 # I am deliberately being very specific on which files are installed
22 # and uninstalled. This allows us to easily copy/paste from the
23 # installer section to the uninstaller, ensuring we ONLY remove the files
24 # we installed. It's ugly, I know, but the script suggested to automate
25 # this is ugly enough by itself.
26 Section "!J-Ben Core"
27 # Program Files\J-Ben
28 SetOutPath "$INSTDIR"
29 File "..\J-Ben\README"
30 File "..\J-Ben\CHANGELOG"
31 File "..\J-Ben\CREDITS"
32 File "..\J-Ben\DEDICATION"
33 File "..\J-Ben\COPYING"
34 # The following folders will always be added/removed in full,
35 # so using File /r (and RMDir /r on uninstall) is acceptable.
36 File /r "..\J-Ben\bin"
37 File /r "..\J-Ben\etc"
38 File /r "..\J-Ben\kpengine_data"
39 File /r "..\J-Ben\lib"
40 File /r "..\J-Ben\license"
41 File /r "..\J-Ben\share"
43 # Program Files\J-Ben\dicts
44 SetOutPath "$INSTDIR\dicts"
45 File "..\J-Ben\dicts\README"
47 # Program Files\J-Ben\sods
48 SetOutPath "$INSTDIR\sods"
49 File "..\J-Ben\sods\README"
51 # Write registry settings and make uninstaller
52 WriteRegStr HKLM \
53 "Software\Microsoft\Windows\CurrentVersion\Uninstall\J-Ben" \
54 "DisplayName" "J-Ben"
55 WriteRegStr HKLM \
56 "Software\Microsoft\Windows\CurrentVersion\Uninstall\J-Ben" \
57 "UninstallString" "$INSTDIR\uninstall.exe"
58 WriteRegStr HKLM \
59 "Software\Microsoft\Windows\CurrentVersion\Uninstall\J-Ben" \
60 "InstallLocation" "$INSTDIR"
61 WriteRegStr HKLM \
62 "Software\Microsoft\Windows\CurrentVersion\Uninstall\J-Ben" \
63 "DisplayIcon" "$INSTDIR\jben.exe"
64 WriteUninstaller "$INSTDIR\uninstall.exe"
65 SectionEnd
67 SectionGroup "Dictionary Files"
68 Section "EDICT2"
69 SetOutPath "$INSTDIR\dicts"
70 File "..\J-Ben\dicts\edict2.gz"
71 SectionEnd
72 Section "KANJIDIC"
73 SetOutPath "$INSTDIR\dicts"
74 File "..\J-Ben\dicts\kanjidic.gz"
75 SectionEnd
76 Section /o "KANJIDIC2 (Download)"
77 SetOutPath "$INSTDIR\dicts"
78 NSISdl::download http://www.vultaire.net/software/jben/files/dicts/kanjidic2.xml.gz kanjidic2.xml.gz
79 Pop $R0
80 StrCmp $R0 "success" +2
81 MessageBox MB_OK "The installer was unable to download KANJIDIC2. Installation will continue, but the program may not work properly."
82 SectionEnd
83 SectionGroupEnd
85 SectionGroup "Stroke Order Diagrams (Download)"
86 Section /o "KanjiCafe.com SODs"
87 SetOutPath "$INSTDIR\sods"
88 NSISdl::download http://www.vultaire.net/software/jben/files/sods/sod-utf8-hex.zip sod-utf8-hex.zip
89 Pop $R0
90 StrCmp $R0 "success" +3
91 MessageBox MB_OK "The installer was unable to download the KanjiCafe.com SODs. Installation will continue without them."
92 Return
93 ZipDLL::extractall "sod-utf8-hex.zip" "$INSTDIR\sods"
94 Delete "sod-utf8-hex.zip"
95 SectionEnd
96 Section /o "KanjiCafe.com Animated SODs"
97 SetOutPath "$INSTDIR\sods"
98 NSISdl::download http://www.vultaire.net/software/jben/files/sods/soda-utf8-hex.zip soda-utf8-hex.zip
99 Pop $R0
100 StrCmp $R0 "success" +3
101 MessageBox MB_OK "The installer was unable to download the KanjiCafe.com animated SODs. Installation will continue without them."
102 Return
103 ZipDLL::extractall "soda-utf8-hex.zip" "$INSTDIR\sods"
104 Delete "soda-utf8-hex.zip"
105 SectionEnd
106 SectionGroupEnd
108 Section "Documentation"
109 # Program Files\J-Ben
110 SetOutPath "$INSTDIR"
111 # The following folders will always be added/removed in full,
112 # so using File /r (and RMDir /r on uninstall) is acceptable.
113 File /r "..\J-Ben\doc"
114 SectionEnd
116 Section /o "Source code (Download)"
117 SetOutPath "$INSTDIR\src"
118 NSISdl::download http://www.vultaire.net/software/jben/files/${version}/jben-${version}-source.zip source.zip
119 Pop $R0
120 StrCmp $R0 "success" +3
121 MessageBox MB_OK "The installer was unable to download the J-Ben source code package. Installation will continue without it."
122 Return
123 ZipDLL::extractall "source.zip" "$INSTDIR\src"
124 Delete "source.zip"
125 SectionEnd
127 SectionGroup "Shortcuts"
128 Section "Create Start Menu Shortcuts"
129 SetOutPath "$INSTDIR\bin"
130 CreateDirectory "$SMPROGRAMS\J-Ben"
131 CreateShortcut "$SMPROGRAMS\J-Ben\J-Ben.lnk" "$INSTDIR\bin\jben.exe"
132 CreateShortcut "$SMPROGRAMS\J-Ben\Uninstall J-Ben.lnk" "$INSTDIR\uninstall.exe"
133 SectionEnd
135 Section "Create Desktop Shortcut"
136 SetOutPath "$INSTDIR\bin"
137 CreateShortcut "$DESKTOP\J-Ben.lnk" "$INSTDIR\bin\jben.exe"
138 SectionEnd
139 SectionGroupEnd
141 Section "un.J-Ben Core"
142 # Program Files\J-Ben
143 SetOutPath "$INSTDIR"
144 Delete "README"
145 Delete "CHANGELOG"
146 Delete "CREDITS"
147 Delete "DEDICATION"
148 Delete "COPYING"
149 RMDir /r "$INSTDIR\bin"
150 RMDir /r "$INSTDIR\etc"
151 RMDir /r "$INSTDIR\kpengine_data"
152 RMDir /r "$INSTDIR\lib"
153 RMDir /r "$INSTDIR\license"
154 RMDir /r "$INSTDIR\share"
156 Delete "dicts\README"
157 RMDir "$INSTDIR\dicts"
158 Delete "sods\README"
159 RMDir "$INSTDIR\sods"
161 Delete "uninstall.exe"
162 SetOutPath "$INSTDIR\.."
163 RMDir "$INSTDIR"
165 DeleteRegKey HKLM \
166 "Software\Microsoft\Windows\CurrentVersion\Uninstall\J-Ben"
167 SectionEnd
169 SectionGroup "un.Dictionaries"
170 Section "un.EDICT2"
171 SetOutPath "$INSTDIR"
172 Delete "dicts\edict2.gz"
173 RMDir "$INSTDIR\dicts"
174 SetOutPath "$INSTDIR\.."
175 RMDir "$INSTDIR"
176 SectionEnd
177 Section "un.KANJIDIC"
178 SetOutPath "$INSTDIR"
179 Delete "dicts\kanjidic.gz"
180 RMDir "$INSTDIR\dicts"
181 SetOutPath "$INSTDIR\.."
182 RMDir "$INSTDIR"
183 SectionEnd
184 Section "un.KANJIDIC2"
185 SetOutPath "$INSTDIR"
186 Delete "dicts\kanjidic2.xmlgz"
187 RMDir "$INSTDIR\dicts"
188 SetOutPath "$INSTDIR\.."
189 RMDir "$INSTDIR"
190 SectionEnd
191 SectionGroupEnd
193 SectionGroup "un.Stroke Order Diagrams"
194 Section "un.KanjiCafe.com SODs"
195 SetOutPath "$INSTDIR\sods"
196 RMDir /r "$INSTDIR\sods\sod-utf8-hex"
197 SetOutPath "$INSTDIR"
198 RMDir "$INSTDIR\sods"
199 SetOutPath "$INSTDIR\.."
200 RMDir "$INSTDIR"
201 SectionEnd
202 Section "un.KanjiCafe.com Animated SODs"
203 SetOutPath "$INSTDIR\sods"
204 RMDir /r "$INSTDIR\sods\soda-utf8-hex"
205 SetOutPath "$INSTDIR"
206 RMDir "$INSTDIR\sods"
207 SetOutPath "$INSTDIR\.."
208 RMDir "$INSTDIR"
209 SectionEnd
210 SectionGroupEnd
212 Section "un.J-Ben Documentation"
213 # Program Files\J-Ben
214 SetOutPath "$INSTDIR"
215 # The following folders will always be added/removed in full,
216 # so using File /r (and RMDir /r on uninstall) is acceptable.
217 RMDir /r "$INSTDIR\doc"
219 SetOutPath "$INSTDIR\.."
220 RMDir "$INSTDIR"
221 SectionEnd
223 Section "un.Start Menu and Desktop Shortcuts"
224 Delete "$SMPROGRAMS\J-Ben\J-Ben.lnk"
225 Delete "$SMPROGRAMS\J-Ben\Uninstall J-Ben.lnk"
226 RMDir "$SMPROGRAMS\J-Ben"
227 Delete "$DESKTOP\J-Ben.lnk"
228 SectionEnd
230 Section "un.Source code"
231 SetOutPath "$INSTDIR"
232 RMDir /r "$INSTDIR\src"
233 SetOutPath "$INSTDIR\.."
234 RMDir "$INSTDIR"
235 SectionEnd