altosui: Add windows installer build using 'nsis'
[fw/altos] / ao-tools / altosui / altos-windows.nsi
1 !addplugindir Instdrv/NSIS/Plugins
2
3 Name "Altus Metrum Installer"
4
5 OutFile "Altos-Windows.exe"
6
7 ; Default install directory
8 InstallDir "$PROGRAMFILES\AltusMetrum"
9
10 ; Tell the installer where to re-install a new version
11 InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir"
12
13 LicenseText "GNU General Public License Version 2"
14 LicenseData "../../COPYING"
15
16 ; Need admin privs for Vista or Win7
17 RequestExecutionLevel admin
18
19 ShowInstDetails Show
20
21 ComponentText "Altus Metrum Software and Driver Installer"
22
23 ; Pages to present
24
25 Page license
26 Page components
27 Page directory
28 Page instfiles
29
30 UninstPage uninstConfirm
31 UninstPage instfiles
32
33 ; And the stuff to install
34
35 Section "Install Driver" InstDriver
36         InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} "Altus Metrum"
37         Pop $0
38         DetailPrint "InitDriverSetup: $0"
39
40         InstDrv::DeleteOemInfFiles /NOUNLOAD
41         InstDrv::CreateDevice /NOUNLOAD
42         SetOutPath $TEMP
43         File "../../telemetrum.inf"
44         InstDrv::InstallDriver /NOUNLOAD "$TEMP\telemetrum.inf"
45 SectionEnd
46
47 Section "AltosUI Application"
48         SetOutPath $INSTDIR
49
50         File "windows/AltOS/*.jar"
51         File "windows/AltOS/*.dll"
52
53         CreateShortCut "$SMPROGRAMS\AltusMetrum.lnk" "$INSTDIR\altosui.jar"
54 SectionEnd
55
56 Section "AltosUI Desktop Shortcut"
57         CreateShortCut "$DESKTOP\AltusMetrum.lnk" "$INSTDIR\altosui.jar"
58 SectionEnd
59
60 Section "TeleMetrum and TeleDongle Firmware"
61
62         SetOutPath $INSTDIR
63
64         File "windows/AltOS/telemetrum-v1.0.ihx"
65         File "windows/AltOS/teledongle-v0.2.ihx"
66
67 SectionEnd
68
69 Section "Uninstaller"
70
71         ; Deal with the uninstaller
72         
73         SetOutPath $INSTDIR
74
75         ; Write the install path to the registry
76         WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR"
77         
78         ; Write the uninstall keys for windows
79         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum"
80         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"'
81         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1"
82         WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1"
83
84         WriteUninstaller "uninstall.exe"
85 SectionEnd
86
87 Section "Uninstall"
88         DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum"
89         DeleteRegKey HKLM "Software\AltusMetrum"
90
91         Delete "$INSTDIR\*.*"
92         RMDir "$INSTDIR"
93
94         ; Remove devices
95         InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} "Altus Metrum"
96         InstDrv::DeleteOemInfFiles /NOUNLOAD
97         InstDrv::RemoveAllDevices
98
99         ; Remove shortcuts, if any
100         Delete "$SMPROGRAMS\AltusMetrum.lnk"
101         Delete "$DESKTOP\AltusMetrum.lnk"
102 SectionEnd