comparison makeinst-script.sh @ 3453:70b110956a4e

nsis-installer: Use custom page for shortcuts and install for all users. * binary-dist-rules.mk: copy installer-files/README.html to dist folder. * installer-files/README.html: New file. * makeinst-script.sh: Added custom page for Install for all users and Create shortcuts. Reassigned show readme checkbox for showing README.html at end of install. Run octave-gui as the Run program.
author John Donoghue <john.donoghue@ieee.org>
date Sat, 25 Jan 2014 19:24:09 -0500
parents a7c772aa106f
children 608931797a53
comparison
equal deleted inserted replaced
3452:1414225a963d 3453:70b110956a4e
34 !define OCTAVE_VERSION "$OCTAVE_VERSION" 34 !define OCTAVE_VERSION "$OCTAVE_VERSION"
35 !define COPYRIGHT "Copyright © 2013 John W. Eaton and others." 35 !define COPYRIGHT "Copyright © 2013 John W. Eaton and others."
36 !define DESCRIPTION "GNU Octave is a high-level programming language, primarily intended for numerical computations." 36 !define DESCRIPTION "GNU Octave is a high-level programming language, primarily intended for numerical computations."
37 !define INSTALLER_FILES "../installer-files" 37 !define INSTALLER_FILES "../installer-files"
38 !define INSTALLER_NAME "octave-$OCTAVE_VERSION-installer.exe" 38 !define INSTALLER_NAME "octave-$OCTAVE_VERSION-installer.exe"
39 !define MAIN_APP_EXE "octave.exe" 39 !define MAIN_APP_EXE "octave-gui.exe"
40 !define INSTALL_TYPE "SetShellVarContext current" 40 !define INSTALL_TYPE "SetShellVarContext current"
41 !define PRODUCT_ROOT_KEY "HKLM" 41 !define PRODUCT_ROOT_KEY "HKLM"
42 !define PRODUCT_KEY "Software\\Octave-$VERSION" 42 !define PRODUCT_KEY "Software\\Octave-$VERSION"
43 43
44 ###################################################################### 44 ######################################################################
67 \${StrRep} 67 \${StrRep}
68 ###################################################################### 68 ######################################################################
69 ; MUI settings 69 ; MUI settings
70 !include "MUI.nsh" 70 !include "MUI.nsh"
71 71
72 ; custom dialogs
73 !include nsDialogs.nsh
74 ; additional logic
75 !include LogicLib.nsh
76
77
72 !define MUI_ABORTWARNING 78 !define MUI_ABORTWARNING
73 !define MUI_UNABORTWARNING 79 !define MUI_UNABORTWARNING
74 !define MUI_HEADERIMAGE 80 !define MUI_HEADERIMAGE
75 81
76 ; Theme 82 ; Theme
83 89
84 !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." 90 !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."
85 !define MUI_LICENSEPAGE_BUTTON "Next >" 91 !define MUI_LICENSEPAGE_BUTTON "Next >"
86 !insertmacro MUI_PAGE_LICENSE "\${INSTALLER_FILES}/gpl-3.0.txt" 92 !insertmacro MUI_PAGE_LICENSE "\${INSTALLER_FILES}/gpl-3.0.txt"
87 93
94 Page custom octaveOptionsPage octaveOptionsLeave
95
88 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckPrevInstall 96 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckPrevInstall
89 !insertmacro MUI_PAGE_DIRECTORY 97 !insertmacro MUI_PAGE_DIRECTORY
90 98
91 !insertmacro MUI_PAGE_INSTFILES 99 !insertmacro MUI_PAGE_INSTFILES
92 100
93 ; set up checkbox to create desktop icon
94 Function finishpage_desktopshortcut
95 SetOutPath "%USERPROFILE%"
96 CreateShortCut "\$desktop\\Octave-$VERSION (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "" "\$INSTDIR\\$ICON" 0
97 CreateShortCut "\$desktop\\Octave-$VERSION (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0
98 FunctionEnd
99
100 !define MUI_FINISHPAGE_SHOWREADME ""
101 !define MUI_FINISHPAGE_SHOWREADME_CHECKED
102 !define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
103 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpage_desktopshortcut
104
105 !define MUI_FINISHPAGE_RUN "\$INSTDIR\\bin\\\${MAIN_APP_EXE}" 101 !define MUI_FINISHPAGE_RUN "\$INSTDIR\\bin\\\${MAIN_APP_EXE}"
102 !define MUI_FINISHPAGE_SHOWREADME "\$INSTDIR\\README.html"
106 !insertmacro MUI_PAGE_FINISH 103 !insertmacro MUI_PAGE_FINISH
107 104
108 !insertmacro MUI_UNPAGE_CONFIRM 105 !insertmacro MUI_UNPAGE_CONFIRM
109 106
110 !insertmacro MUI_UNPAGE_INSTFILES 107 !insertmacro MUI_UNPAGE_INSTFILES
114 !insertmacro MUI_LANGUAGE "English" 111 !insertmacro MUI_LANGUAGE "English"
115 112
116 ###################################################################### 113 ######################################################################
117 114
118 RequestExecutionLevel admin 115 RequestExecutionLevel admin
116
117 ######################################################################
118 ; custom options page functions
119
120 Var InstallAllUsers
121 Var InstallAllUsersCtrl
122 Var InstallShortcuts
123 Var InstallShortcutsCtrl
124 Function octaveOptionsPage
125 nsDialogs::Create 1018
126 Pop \$0
127
128 \${If} \$0 == error
129 Abort
130 \${EndIf}
131
132 \${NSD_CreateCheckBox} 0 0 100% 12u "Install for all users"
133 Pop \$InstallAllUsersCtrl
134 \${NSD_SetState} \$InstallAllUsersCtrl \${BST_CHECKED}
135
136 \${NSD_CreateCheckBox} 0 20 100% 12u "Create desktop shortcuts"
137 Pop \$InstallShortcutsCtrl
138 \${NSD_SetState} \$InstallShortcutsCtrl \${BST_CHECKED}
139
140 !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing"
141 nsDialogs::Show
142 FunctionEnd
143
144 Function octaveOptionsLeave
145 \${NSD_GetState} \$InstallAllUsersCtrl \$InstallAllUsers
146 \${NSD_GetState} \$InstallShortcutsCtrl \$InstallShortcuts
147 FunctionEnd
148
149 ######################################################################
119 150
120 Function .onInit 151 Function .onInit
121 Call DetectWinVer 152 Call DetectWinVer
122 Call CheckCurrVersion 153 Call CheckCurrVersion
123 Call CheckJRE 154 Call CheckJRE
125 FunctionEnd 156 FunctionEnd
126 157
127 ; file section 158 ; file section
128 Section "MainFiles" 159 Section "MainFiles"
129 160
161 ; set context based on whether installing for user or all
162 \${If} \$InstallAllUsers == \${BST_CHECKED}
163 SetShellVarContext all
164 \${Else}
165 SetShellVarContext current
166 \${Endif}
167
168 ; include the README
169 SetOutPath "\$INSTDIR"
170 File "$OCTAVE_SOURCE/README.html"
171
172 ; distro files
130 EOF 173 EOF
131 174
132 # insert the files 175 # insert the files
133 IFS=$'\n' 176 IFS=$'\n'
134 for f in $(find $OCTAVE_SOURCE -type d -printf "%P\n"); do 177 for f in $(find $OCTAVE_SOURCE -type d -printf "%P\n"); do
154 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayName" "Octave" 197 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayName" "Octave"
155 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayVersion" "$VERSION" 198 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayVersion" "$VERSION"
156 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "UninstallString" "\$INSTDIR\\uninstall.exe" 199 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "UninstallString" "\$INSTDIR\\uninstall.exe"
157 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoModify" 1 200 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoModify" 1
158 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoRepair" 1 201 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoRepair" 1
202 \${If} \$InstallAllUsers == \${BST_CHECKED}
203 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "AllUsers" 1
204 \${EndIf}
159 WriteUninstaller "uninstall.exe" 205 WriteUninstaller "uninstall.exe"
160 SectionEnd 206 SectionEnd
161 207
162 ; start menu (currently hardcoded) 208 ; start menu (currently hardcoded)
163 Section "Shortcuts" 209 Section "Shortcuts"
179 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.html\\index.html" "" "" 0 225 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.html\\index.html" "" "" 0
180 EOF 226 EOF
181 fi 227 fi
182 228
183 cat >> $OUTFILE << EOF 229 cat >> $OUTFILE << EOF
230
231 \${If} \$InstallShortcuts == \${BST_CHECKED}
232 SetOutPath "%USERPROFILE%"
233 CreateShortCut "\$desktop\\Octave-$VERSION (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "" "\$INSTDIR\\$ICON" 0
234 CreateShortCut "\$desktop\\Octave-$VERSION (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0
235 \${Endif}
236
184 SectionEnd 237 SectionEnd
185 238
186 Section "Uninstall" 239 Section "Uninstall"
187 240
241 ReadRegDWORD \$0 HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "AllUsers"
242 IfErrors not_all_users
243
244 SetShellVarContext all
245
246 not_all_users:
188 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" 247 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION"
189 DeleteRegKey HKLM "Software\\Octave-$VERSION" 248 DeleteRegKey HKLM "Software\\Octave-$VERSION"
190 249
191 ; Remove shortcuts 250 ; Remove shortcuts
192 Delete "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\*.*" 251 Delete "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\*.*"