Mercurial > mxe-octave
diff 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 |
line wrap: on
line diff
--- a/makeinst-script.sh Fri Jan 24 13:51:28 2014 -0500 +++ b/makeinst-script.sh Sat Jan 25 19:24:09 2014 -0500 @@ -36,7 +36,7 @@ !define DESCRIPTION "GNU Octave is a high-level programming language, primarily intended for numerical computations." !define INSTALLER_FILES "../installer-files" !define INSTALLER_NAME "octave-$OCTAVE_VERSION-installer.exe" -!define MAIN_APP_EXE "octave.exe" +!define MAIN_APP_EXE "octave-gui.exe" !define INSTALL_TYPE "SetShellVarContext current" !define PRODUCT_ROOT_KEY "HKLM" !define PRODUCT_KEY "Software\\Octave-$VERSION" @@ -69,6 +69,12 @@ ; MUI settings !include "MUI.nsh" +; custom dialogs +!include nsDialogs.nsh +; additional logic +!include LogicLib.nsh + + !define MUI_ABORTWARNING !define MUI_UNABORTWARNING !define MUI_HEADERIMAGE @@ -85,24 +91,15 @@ !define MUI_LICENSEPAGE_BUTTON "Next >" !insertmacro MUI_PAGE_LICENSE "\${INSTALLER_FILES}/gpl-3.0.txt" +Page custom octaveOptionsPage octaveOptionsLeave + !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckPrevInstall !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES -; set up checkbox to create desktop icon -Function finishpage_desktopshortcut - SetOutPath "%USERPROFILE%" - CreateShortCut "\$desktop\\Octave-$VERSION (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "" "\$INSTDIR\\$ICON" 0 - CreateShortCut "\$desktop\\Octave-$VERSION (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0 -FunctionEnd - -!define MUI_FINISHPAGE_SHOWREADME "" -!define MUI_FINISHPAGE_SHOWREADME_CHECKED -!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut" -!define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpage_desktopshortcut - !define MUI_FINISHPAGE_RUN "\$INSTDIR\\bin\\\${MAIN_APP_EXE}" +!define MUI_FINISHPAGE_SHOWREADME "\$INSTDIR\\README.html" !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM @@ -117,6 +114,40 @@ RequestExecutionLevel admin +###################################################################### +; custom options page functions + +Var InstallAllUsers +Var InstallAllUsersCtrl +Var InstallShortcuts +Var InstallShortcutsCtrl +Function octaveOptionsPage + nsDialogs::Create 1018 + Pop \$0 + + \${If} \$0 == error + Abort + \${EndIf} + + \${NSD_CreateCheckBox} 0 0 100% 12u "Install for all users" + Pop \$InstallAllUsersCtrl + \${NSD_SetState} \$InstallAllUsersCtrl \${BST_CHECKED} + + \${NSD_CreateCheckBox} 0 20 100% 12u "Create desktop shortcuts" + Pop \$InstallShortcutsCtrl + \${NSD_SetState} \$InstallShortcutsCtrl \${BST_CHECKED} + + !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing" + nsDialogs::Show +FunctionEnd + +Function octaveOptionsLeave + \${NSD_GetState} \$InstallAllUsersCtrl \$InstallAllUsers + \${NSD_GetState} \$InstallShortcutsCtrl \$InstallShortcuts +FunctionEnd + +###################################################################### + Function .onInit Call DetectWinVer Call CheckCurrVersion @@ -127,6 +158,18 @@ ; file section Section "MainFiles" + ; set context based on whether installing for user or all + \${If} \$InstallAllUsers == \${BST_CHECKED} + SetShellVarContext all + \${Else} + SetShellVarContext current + \${Endif} + + ; include the README + SetOutPath "\$INSTDIR" + File "$OCTAVE_SOURCE/README.html" + + ; distro files EOF # insert the files @@ -156,6 +199,9 @@ WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "UninstallString" "\$INSTDIR\\uninstall.exe" WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoModify" 1 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoRepair" 1 + \${If} \$InstallAllUsers == \${BST_CHECKED} + WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "AllUsers" 1 + \${EndIf} WriteUninstaller "uninstall.exe" SectionEnd @@ -181,10 +227,23 @@ fi cat >> $OUTFILE << EOF + + \${If} \$InstallShortcuts == \${BST_CHECKED} + SetOutPath "%USERPROFILE%" + CreateShortCut "\$desktop\\Octave-$VERSION (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "" "\$INSTDIR\\$ICON" 0 + CreateShortCut "\$desktop\\Octave-$VERSION (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0 + \${Endif} + SectionEnd Section "Uninstall" + ReadRegDWORD \$0 HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "AllUsers" + IfErrors not_all_users + + SetShellVarContext all + +not_all_users: DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" DeleteRegKey HKLM "Software\\Octave-$VERSION"