comparison makeinst-script.sh @ 3403:f79780bcc843

installer: check destination path later in install (Bug #41069) * makeinst-script.sh: use version in install key, check current version installed seperately from installing to existing octave path. Use version for shortcut folder.
author John Donoghue <john.donoghue@ieee.org>
date Sun, 05 Jan 2014 13:53:15 -0500
parents b5abbada6616
children c0fe8d735baf
comparison
equal deleted inserted replaced
3402:9884a90607d0 3403:f79780bcc843
38 !define INSTALLER_FILES "../installer_files" 38 !define INSTALLER_FILES "../installer_files"
39 !define INSTALLER_NAME "octave-$OCTAVE_VERSION-installer.exe" 39 !define INSTALLER_NAME "octave-$OCTAVE_VERSION-installer.exe"
40 !define MAIN_APP_EXE "octave.exe" 40 !define MAIN_APP_EXE "octave.exe"
41 !define INSTALL_TYPE "SetShellVarContext current" 41 !define INSTALL_TYPE "SetShellVarContext current"
42 !define PRODUCT_ROOT_KEY "HKLM" 42 !define PRODUCT_ROOT_KEY "HKLM"
43 !define PRODUCT_KEY "Software\\Octave" 43 !define PRODUCT_KEY "Software\\Octave-$VERSION"
44 44
45 ###################################################################### 45 ######################################################################
46 46
47 VIProductVersion "\${VERSION}" 47 VIProductVersion "\${VERSION}"
48 VIAddVersionKey "ProductName" "\${APP_NAME}" 48 VIAddVersionKey "ProductName" "\${APP_NAME}"
80 80
81 !define MUI_LICENSEPAGE_TEXT_BOTTOM "The source code for Octave is freely redistributable under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation." 81 !define MUI_LICENSEPAGE_TEXT_BOTTOM "The source code for Octave is freely redistributable under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation."
82 !define MUI_LICENSEPAGE_BUTTON "Next >" 82 !define MUI_LICENSEPAGE_BUTTON "Next >"
83 !insertmacro MUI_PAGE_LICENSE "\${INSTALLER_FILES}/gpl-3.0.txt" 83 !insertmacro MUI_PAGE_LICENSE "\${INSTALLER_FILES}/gpl-3.0.txt"
84 84
85 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckPrevInstall
85 !insertmacro MUI_PAGE_DIRECTORY 86 !insertmacro MUI_PAGE_DIRECTORY
86 87
87 !insertmacro MUI_PAGE_INSTFILES 88 !insertmacro MUI_PAGE_INSTFILES
88 89
89 ; set up checkbox to create desktop icon 90 ; set up checkbox to create desktop icon
113 114
114 RequestExecutionLevel admin 115 RequestExecutionLevel admin
115 116
116 Function .onInit 117 Function .onInit
117 Call DetectWinVer 118 Call DetectWinVer
118 Call CheckPrevVersion 119 Call CheckCurrVersion
119 Call CheckJRE 120 Call CheckJRE
120 InitPluginsDir 121 InitPluginsDir
121 FunctionEnd 122 FunctionEnd
122 123
123 ; file section 124 ; file section
139 SectionEnd 140 SectionEnd
140 141
141 Section make_uninstaller 142 Section make_uninstaller
142 ; Write the uninstall keys for Windows 143 ; Write the uninstall keys for Windows
143 SetOutPath "\$INSTDIR" 144 SetOutPath "\$INSTDIR"
144 WriteRegStr HKLM "Software\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave" "DisplayName" "Octave" 145 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayName" "Octave"
145 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave" "UninstallString" "\$INSTDIR\\uninstall.exe" 146 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayVersion" "$VERSION"
146 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave" "NoModify" 1 147 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "UninstallString" "\$INSTDIR\\uninstall.exe"
147 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave" "NoRepair" 1 148 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoModify" 1
149 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoRepair" 1
148 WriteUninstaller "uninstall.exe" 150 WriteUninstaller "uninstall.exe"
149 SectionEnd 151 SectionEnd
150 152
151 ; start menu (currently hardcoded) 153 ; start menu (currently hardcoded)
152 Section "Shortcuts" 154 Section "Shortcuts"
153 155
154 CreateDirectory "\$SMPROGRAMS\\Octave" 156 CreateDirectory "\$SMPROGRAMS\\Octave-$VERSION"
155 CreateShortCut "\$SMPROGRAMS\\Octave\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0 157 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0
156 SetOutPath "\$INSTDIR\\bin" 158 SetOutPath "\$INSTDIR\\bin"
157 CreateShortCut "\$SMPROGRAMS\\Octave\\Octave.lnk" "\$INSTDIR\\bin\\octave.exe" "" "\$INSTDIR\\$ICON" 0 159 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave.lnk" "\$INSTDIR\\bin\\octave.exe" "" "\$INSTDIR\\$ICON" 0
158 CreateShortCut "\$SMPROGRAMS\\Octave\\Octave (Experimental GUI).lnk" "\$INSTDIR\\libexec\\octave\\$OCTAVE_VERSION\\exec\\i686-pc-mingw32\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED 160 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (Experimental GUI).lnk" "\$INSTDIR\\libexec\\octave\\$OCTAVE_VERSION\\exec\\i686-pc-mingw32\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED
159 SetOutPath "\$INSTDIR" 161 SetOutPath "\$INSTDIR"
160 EOF 162 EOF
161 # if we have documentation files, create shortcuts 163 # if we have documentation files, create shortcuts
162 if [ -d $OCTAVE_SOURCE/share/doc/octave ]; then 164 if [ -d $OCTAVE_SOURCE/share/doc/octave ]; then
163 cat >> octave.nsi << EOF 165 cat >> octave.nsi << EOF
164 CreateDirectory "\$SMPROGRAMS\\Octave\\Documentation" 166 CreateDirectory "\$SMPROGRAMS\\Octave-$VERSION\\Documentation"
165 CreateShortCut "\$SMPROGRAMS\\Octave\\Documentation\\Octave C++ Classes (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.pdf" "" "" 0 167 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave C++ Classes (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.pdf" "" "" 0
166 CreateShortCut "\$SMPROGRAMS\\Octave\\Documentation\\Octave C++ Classes (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.html\\index.html" "" "" 0 168 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave C++ Classes (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.html\\index.html" "" "" 0
167 CreateShortCut "\$SMPROGRAMS\\Octave\\Documentation\\Octave (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.pdf" "" "" 0 169 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.pdf" "" "" 0
168 CreateShortCut "\$SMPROGRAMS\\Octave\\Documentation\\Octave (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.html\\index.html" "" "" 0 170 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.html\\index.html" "" "" 0
169 EOF 171 EOF
170 fi 172 fi
171 173
172 cat >> octave.nsi << EOF 174 cat >> octave.nsi << EOF
173 SectionEnd 175 SectionEnd
174 176
175 Section "Uninstall" 177 Section "Uninstall"
176 178
177 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave" 179 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION"
178 DeleteRegKey HKLM "Software\\Octave" 180 DeleteRegKey HKLM "Software\\Octave-$VERSION"
179 181
180 ; Remove shortcuts 182 ; Remove shortcuts
181 Delete "\$SMPROGRAMS\\Octave\\Documentation\\*.*" 183 Delete "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\*.*"
182 RMDir "\$SMPROGRAMS\\Octave\\Documentation" 184 RMDir "\$SMPROGRAMS\\Octave-$VERSION\\Documentation"
183 185
184 Delete "\$SMPROGRAMS\\Octave\\*.*" 186 Delete "\$SMPROGRAMS\\Octave-$VERSION\\*.*"
185 RMDir "\$SMPROGRAMS\\Octave" 187 RMDir "\$SMPROGRAMS\\Octave-$VERSION"
186 188
187 Delete "\$desktop\\Octave-$VERSION.lnk" 189 Delete "\$desktop\\Octave-$VERSION.lnk"
188 Delete "\$desktop\\Octave-$VERSION (Experimental GUI).lnk" 190 Delete "\$desktop\\Octave-$VERSION (Experimental GUI).lnk"
189 EOF 191 EOF
190 192
203 205
204 ; Function to detect Windows version and abort if Octave is unsupported in the current platform 206 ; Function to detect Windows version and abort if Octave is unsupported in the current platform
205 Function DetectWinVer 207 Function DetectWinVer
206 Push \$0 208 Push \$0
207 Push \$1 209 Push \$1
208 ReadRegStr \$0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion 210 ReadRegStr \$0 HKLM "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" CurrentVersion
209 IfErrors is_error is_winnt 211 IfErrors is_error is_winnt
210 is_winnt: 212 is_winnt:
211 StrCpy \$1 \$0 1 213 StrCpy \$1 \$0 1
212 StrCmp \$1 4 is_error ; Aborting installation for Windows versions older than Windows 2000 214 StrCmp \$1 4 is_error ; Aborting installation for Windows versions older than Windows 2000
213 StrCmp \$0 "5.0" is_error ; Removing Windows 2000 as supported Windows version 215 StrCmp \$0 "5.0" is_error ; Removing Windows 2000 as supported Windows version
239 done: 241 done:
240 Pop \$1 242 Pop \$1
241 Pop \$0 243 Pop \$0
242 FunctionEnd 244 FunctionEnd
243 245
244 ; Function to check any previously installed version of Octave in the system 246 ; Function to check whether already installed this version
245 Function CheckPrevVersion 247 Function CheckCurrVersion
246 Push \$0 248 Push \$0
247 Push \$1 249 ClearErrors
248 Push \$2 250 ReadRegStr \$0 HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayName"
249 IfFileExists "\$INSTDIR\\bin\\octave-\${OCTAVE_VERSION}.exe" 0 otherver 251 IfErrors curr_check_ok
250 MessageBox MB_OK|MB_ICONSTOP "Another Octave installation (with the same version) has been detected. Please uninstall it first." 252 MessageBox MB_OK|MB_ICONSTOP "Another Octave installation (with the same version) has been detected. Please uninstall it first."
251 Abort 253 Abort
252 otherver: 254 curr_check_ok:
253 StrCpy \$0 0
254 StrCpy \$2 ""
255 loop:
256 EnumRegKey \$1 \${PRODUCT_ROOT_KEY} "\${PRODUCT_KEY}" \$0
257 StrCmp \$1 "" loopend
258 IntOp \$0 \$0 + 1
259 StrCmp \$2 "" 0 +2
260 StrCpy \$2 "\$1"
261 StrCpy \$2 "\$2, \$1"
262 Goto loop
263 loopend:
264 ReadRegStr \$1 \${PRODUCT_ROOT_KEY} "\${PRODUCT_KEY}" "Version"
265 IfErrors finalcheck
266 StrCmp \$2 "" 0 +2
267 StrCpy \$2 "\$1"
268 StrCpy \$2 "\$2, \$1"
269 finalcheck:
270 StrCmp \$2 "" done
271 MessageBox MB_YESNO|MB_ICONEXCLAMATION "Another Octave installation (version \$2) has been detected. It is recommended to uninstall it if you intend to use the same installation directory. Do you want to proceed with the installation anyway?" IDYES done IDNO 0
272 Abort
273 done:
274 ClearErrors
275 Pop \$2
276 Pop \$1
277 Pop \$0 255 Pop \$0
256 FunctionEnd
257
258 ; Check whether prev install is here
259 Function CheckPrevInstall
260 IfFileExists "\$INSTDIR\\bin\\octave.exe" inst_exists inst_none
261 inst_exists:
262 MessageBox MB_YESNO|MB_ICONEXCLAMATION "Another Octave installation has been detected at that destination. It is recommended to uninstall it if you intend to use the same installation directory. Do you want to proceed with the installation anyway?" IDYES inst_none IDNO 0
263 Abort
264 inst_none:
278 FunctionEnd 265 FunctionEnd
279 266
280 ; Function to check Java Runtime Environment 267 ; Function to check Java Runtime Environment
281 Function CheckJRE 268 Function CheckJRE
282 ; looks in: 269 ; looks in:
305 292
306 JRE_Error: 293 JRE_Error:
307 MessageBox MB_ICONEXCLAMATION|MB_YESNO "Octave includes a Java integration component, but it seems Java is not available on this system. This component requires the Java Runtime Environment from Oracle (http://www.java.com) installed on your system. Octave can work without Java available, but the Java integration component will not be functional. Installing those components without Java available might prevent Octave from working correctly. Proceed with installation anyway?" IDYES continue 294 MessageBox MB_ICONEXCLAMATION|MB_YESNO "Octave includes a Java integration component, but it seems Java is not available on this system. This component requires the Java Runtime Environment from Oracle (http://www.java.com) installed on your system. Octave can work without Java available, but the Java integration component will not be functional. Installing those components without Java available might prevent Octave from working correctly. Proceed with installation anyway?" IDYES continue
308 Abort 295 Abort
309 continue: 296 continue:
297 Pop \$R1
298 Pop \$R0
310 FunctionEnd 299 FunctionEnd
311 EOF 300 EOF
312 301
313 echo "Generation Completed" 302 echo "Generation Completed"