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"
8 Name "Altus Metrum MicroPeak Installer"
10 ; Default install directory
11 InstallDir "$PROGRAMFILES\AltusMetrum"
13 ; Tell the installer where to re-install a new version
14 InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir"
16 LicenseText "GNU General Public License Version 2"
17 LicenseData "../COPYING"
19 ; Need admin privs for Vista or Win7
20 RequestExecutionLevel admin
24 ComponentText "Altus Metrum MicroPeak Software Installer"
27 MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION} 32-bit, it will now \
28 be downloaded and installed"
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"
42 ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \
44 StrCmp $2 ${JRE_VERSION} done
46 StrCmp $2 ${JRE_ALTERNATE} done
60 UninstPage uninstConfirm
63 ; And the stuff to install
65 Section "MicroPeak Application"
70 File "micropeak-fat.jar"
80 CreateShortCut "$SMPROGRAMS\MicroPeak.lnk" "$SYSDIR\javaw.exe" "-jar micropeak-fat.jar" "$INSTDIR\micro-peak.ico"
83 Section "MicroPeak Desktop Shortcut"
84 CreateShortCut "$DESKTOP\MicroPeak.lnk" "$INSTDIR\micropeak-fat.jar" "" "$INSTDIR\micro-peak.ico"
87 Section "Documentation"
91 File "../doc/micropeak.pdf"
96 ; Deal with the uninstaller
100 ; Write the install path to the registry
101 WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR"
103 ; Write the uninstall keys for windows
104 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum"
105 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"'
106 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1"
107 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1"
109 WriteUninstaller "uninstall.exe"
113 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum"
114 DeleteRegKey HKLM "Software\AltusMetrum"
116 Delete "$INSTDIR\*.*"
119 ; Remove shortcuts, if any
120 Delete "$SMPROGRAMS\MicroPeak.lnk"
121 Delete "$DESKTOP\MicroPeak.lnk"