b41455206532d5152840c88be662d70e5a598f9e
[fw/altos] / telegps / telegps-windows.nsi.in
1 !addplugindir ../altosui/Instdrv/NSIS/Plugins
2 !addincludedir ../altosui/Instdrv/NSIS/Includes
3 !include x64.nsh
4 !include java.nsh
5
6 Name "TeleGPS Installer"
7
8 ; Default install directory
9 InstallDir "$PROGRAMFILES\AltusMetrum"
10
11 ; Tell the installer where to re-install a new version
12 InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir"
13
14 LicenseText "GNU General Public License Version 2"
15 LicenseData "../COPYING"
16
17 ; Need admin privs for Vista or Win7
18 RequestExecutionLevel admin
19
20 ShowInstDetails Show
21
22 ComponentText "TeleGPS Software Installer"
23
24 Function .onInit
25         DetailPrint "Checking host operating system"
26         ${If} ${RunningX64}
27                 DetailPrint "Installer running on 64-bit host"
28                 SetRegView 64
29                 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
30                 ${DisableX64FSRedirection}
31         ${EndIf}
32 FunctionEnd
33
34 ; Pages to present
35
36 Page license
37 Page components
38 Page directory
39 Page instfiles
40
41 UninstPage uninstConfirm
42 UninstPage instfiles
43
44 ; And the stuff to install
45
46 Section "Install Driver" InstDriver
47
48         InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
49         Pop $0
50         DetailPrint "InitDriverSetup: $0"
51         InstDrv::DeleteOemInfFiles /NOUNLOAD
52         InstDrv::CreateDevice /NOUNLOAD
53
54         SetOutPath $INSTDIR
55         File "../altusmetrum.inf"
56         File "../altusmetrum.cat"
57
58         ${DisableX64FSRedirection}
59         IfFileExists $WINDIR\System32\PnPutil.exe 0 nopnp
60                 ${DisableX64FSRedirection}
61                 nsExec::ExecToLog '"$WINDIR\System32\PnPutil.exe" -i -a "$INSTDIR\altusmetrum.inf"'
62                 Goto done
63 nopnp:
64                 InstDrv::InstallDriver /NOUNLOAD "$INSTDIR\altusmetrum.inf"
65 done:
66
67 SectionEnd
68
69 Section "TeleGPS Application"
70         Call DetectJRE
71
72         SetOutPath $INSTDIR
73
74         File "telegps-fat.jar"
75         File "altoslib_@ALTOSLIB_VERSION@.jar"
76         File "altosuilib_@ALTOSUILIB_VERSION@.jar"
77         File "cmudict04.jar"
78         File "cmulex.jar"
79         File "cmu_time_awb.jar"
80         File "cmutimelex.jar"
81         File "cmu_us_kal.jar"
82         File "en_us.jar"
83         File "freetts.jar"
84         File "jfreechart.jar"
85         File "jcommon.jar"
86
87         File "*.dll"
88
89         File "../icon/*.ico"
90
91         CreateShortCut "$SMPROGRAMS\TeleGPS.lnk" "$SYSDIR\javaw.exe" "-jar telegps-fat.jar" "$INSTDIR\telegps.ico"
92 SectionEnd
93
94 Section "TeleGPS Desktop Shortcut"
95         CreateShortCut "$DESKTOP\TeleGPS.lnk" "$INSTDIR\telegps-fat.jar"  "" "$INSTDIR\telegps.ico"
96 SectionEnd
97
98 Section "TeleGPS, TeleDongle and TeleBT Firmware"
99
100         SetOutPath $INSTDIR
101
102         File "../src/telegps-v1.0/telegps-v1.0-${VERSION}.ihx"
103         File "../src/teledongle-v0.2/teledongle-v0.2-${VERSION}.ihx"
104         File "../src/telebt-v1.0/telebt-v1.0-${VERSION}.ihx"
105
106 SectionEnd
107
108 Section "Documentation"
109
110         SetOutPath $INSTDIR
111
112         File "../doc/telegps.pdf"
113         File "../doc/altos.pdf"
114         File "../doc/telemetry.pdf"
115 SectionEnd
116
117 Section "Uninstaller"
118
119         ; Deal with the uninstaller
120
121         SetOutPath $INSTDIR
122
123         ; Write the install path to the registry
124         WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR"
125
126         ; Write the uninstall keys for windows
127         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum"
128         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"'
129         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1"
130         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1"
131
132         WriteUninstaller "uninstall.exe"
133 SectionEnd
134
135 Section "Uninstall"
136         DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum"
137         DeleteRegKey HKLM "Software\AltusMetrum"
138
139         Delete "$INSTDIR\*.*"
140         RMDir "$INSTDIR"
141
142         ; Remove devices
143         InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
144         InstDrv::DeleteOemInfFiles /NOUNLOAD
145         InstDrv::RemoveAllDevices
146
147         ; Remove shortcuts, if any
148         Delete "$SMPROGRAMS\TeleGPS.lnk"
149         Delete "$DESKTOP\TeleGPS.lnk"
150         
151 SectionEnd