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