changeset 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 1414225a963d
children b1d77c77adfe
files binary-dist-rules.mk installer-files/README.html makeinst-script.sh
diffstat 3 files changed, 119 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/binary-dist-rules.mk	Fri Jan 24 13:51:28 2014 -0500
+++ b/binary-dist-rules.mk	Sat Jan 25 19:24:09 2014 -0500
@@ -73,6 +73,8 @@
   echo "  notepad++..."
   cd $(TOP_DIR) \
     && tar -c -h -f - notepad++ | ( cd $(OCTAVE_DIST_DIR) ; tar xpf - )
+  echo "  README.html..."
+  cp $(TOP_DIR)/installer-files/README.html $(OCTAVE_DIST_DIR)/
 endef
 endif
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/installer-files/README.html	Sat Jan 25 19:24:09 2014 -0500
@@ -0,0 +1,45 @@
+<html>
+<head>
+<title>GNU Octave</title>
+<style TYPE="text/css">
+<!--
+body {
+}
+-->
+</style>
+</head>
+<body>
+<h2>Welcome</h2>
+<p>
+Thank you for installing GNU Octave!
+</p>
+<p>
+Octave 3.8 is a major new release with many new features, including an
+experimental graphical user interface.  But because the GUI is not
+quite as polished as we would like, we have decided to wait until the
+4.0.x release series before making the GUI the default interface.
+</p>
+<p>
+See the release notes or the "Experimental GUI Info" button in the GUI
+for more information about the release and how you can help us with
+GUI development and speed up the 4.0 release.
+</p>
+<h2>Included Octave Forge Packages</h2>
+<p>
+A number of Octave-forge packages have been included with this install Octave, 
+however they need to be installed in order to use them.
+</p>
+<p>
+To install:
+<ul>
+ <li>Start Octave and then open the build_packages.m file found in the src folder 
+where Octave was installed.</li>
+ <li>Run the build_packages.m script to build and install the packages.</li>
+</ul>
+Packages must then be loaded in order to use them with the <tt>pkg load PACKAGENAME</tt> command.
+</p>
+<p>
+Other packages are available from <a href="http://octave.sourceforge.net/">Octave-Forge</a>
+</p>
+</body>
+</html>
--- 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"