use multimaint-merge to make Debian changelogs less ugly
[fw/altos] / altosui / altos-windows.nsi
1 !addplugindir Instdrv/NSIS/Plugins
2 ; Definitions for Java 1.6 Detection
3 !define JRE_VERSION "1.6"
4 !define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=52247&/jre-6u27-windows-i586-p.exe"
5 !define PRODUCT_NAME "Altus Metrum Windows Software"
6
7 Name "Altus Metrum Installer"
8
9 ; Default install directory
10 InstallDir "$PROGRAMFILES\AltusMetrum"
11
12 ; Tell the installer where to re-install a new version
13 InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir"
14
15 LicenseText "GNU General Public License Version 2"
16 LicenseData "../COPYING"
17
18 ; Need admin privs for Vista or Win7
19 RequestExecutionLevel admin
20
21 ShowInstDetails Show
22
23 ComponentText "Altus Metrum Software and Driver Installer"
24
25 Function GetJRE
26         MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION} 32-bit, it will now \
27                          be downloaded and installed"
28
29         StrCpy $2 "$TEMP\Java Runtime Environment.exe"
30         nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2
31         Pop $R0 ;Get the return value
32                 StrCmp $R0 "success" +3
33                 MessageBox MB_OK "Download failed: $R0"
34                 Quit
35         ExecWait $2
36         Delete $2
37 FunctionEnd
38
39
40 Function DetectJRE
41   ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \
42              "CurrentVersion"
43   StrCmp $2 ${JRE_VERSION} done
44
45   Call GetJRE
46
47   done:
48 FunctionEnd
49
50 ; Pages to present
51
52 Page license
53 Page components
54 Page directory
55 Page instfiles
56
57 UninstPage uninstConfirm
58 UninstPage instfiles
59
60 ; And the stuff to install
61
62 Section "Install Driver" InstDriver
63
64         InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
65         Pop $0
66         DetailPrint "InitDriverSetup: $0"
67         InstDrv::DeleteOemInfFiles /NOUNLOAD
68         InstDrv::CreateDevice /NOUNLOAD
69
70         SetOutPath $TEMP
71         File "../telemetrum.inf"
72         InstDrv::InstallDriver /NOUNLOAD "$TEMP\telemetrum.inf"
73
74         SetOutPath $INSTDIR
75         File "../telemetrum.inf"
76
77         SetOutPath $WINDIR\Inf
78         File "../telemetrum.inf"
79
80 SectionEnd
81
82 Section "AltosUI Application"
83         Call DetectJRE
84
85         SetOutPath $INSTDIR
86
87         File "altosui-fat.jar"
88         File "cmudict04.jar"
89         File "cmulex.jar"
90         File "cmu_time_awb.jar"
91         File "cmutimelex.jar"
92         File "cmu_us_kal.jar"
93         File "en_us.jar"
94         File "freetts.jar"
95         File "jfreechart.jar"
96         File "jcommon.jar"
97
98         File "*.dll"
99
100         File "../icon/*.ico"
101
102         CreateShortCut "$SMPROGRAMS\AltusMetrum.lnk" "$SYSDIR\javaw.exe" "-jar altosui-fat.jar" "$INSTDIR\altus-metrum.ico"
103 SectionEnd
104
105 Section "AltosUI Desktop Shortcut"
106         CreateShortCut "$DESKTOP\AltusMetrum.lnk" "$INSTDIR\altosui-fat.jar"  "" "$INSTDIR\altus-metrum.ico"
107 SectionEnd
108
109 Section "TeleMetrum and TeleDongle Firmware"
110
111         SetOutPath $INSTDIR
112
113         File "../src/telemetrum-v1.0/telemetrum-v1.0-${VERSION}.ihx"
114         File "../src/telemetrum-v1.1/telemetrum-v1.1-${VERSION}.ihx"
115         File "../src/telemini-v1.0/telemini-v1.0-${VERSION}.ihx"
116         File "../src/teledongle-v0.2/teledongle-v0.2-${VERSION}.ihx"
117
118 SectionEnd
119
120 Section "Documentation"
121
122         SetOutPath $INSTDIR
123
124         File "../doc/altusmetrum.pdf"
125         File "../doc/altos.pdf"
126         File "../doc/telemetry.pdf"
127         File "../doc/telemetrum-outline.pdf"
128 SectionEnd
129
130 Section "Uninstaller"
131
132         ; Deal with the uninstaller
133
134         SetOutPath $INSTDIR
135
136         ; Write the install path to the registry
137         WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR"
138
139         ; Write the uninstall keys for windows
140         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum"
141         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"'
142         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1"
143         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1"
144
145         WriteUninstaller "uninstall.exe"
146 SectionEnd
147
148 Section "Uninstall"
149         DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum"
150         DeleteRegKey HKLM "Software\AltusMetrum"
151
152         Delete "$INSTDIR\*.*"
153         RMDir "$INSTDIR"
154
155         ; Remove devices
156         InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
157         InstDrv::DeleteOemInfFiles /NOUNLOAD
158         InstDrv::RemoveAllDevices
159
160         ; Remove shortcuts, if any
161         Delete "$SMPROGRAMS\AltusMetrum.lnk"
162         Delete "$DESKTOP\AltusMetrum.lnk"
163 SectionEnd