# HG changeset patch # User John Donoghue # Date 1425341681 18000 # Node ID 6daa158a7018d158a9b6cf8a3b876963c3479260 # Parent fbc5d86517c98df1052eb3029fb8ab61c99d0f61 nsis installer: use octave.vbs as laucher (Bug #41074) * installer-files/octave.vbs: new file * dist-files.mk: add octave.vbs * makeinst-script.sh: use octave.vbs as laucher diff -r fbc5d86517c9 -r 6daa158a7018 binary-dist-rules.mk --- a/binary-dist-rules.mk Sun Mar 01 19:05:38 2015 -0800 +++ b/binary-dist-rules.mk Mon Mar 02 19:14:41 2015 -0500 @@ -75,6 +75,7 @@ cp $(OCTAVE_DIST_DIR)/bin/libblas.dll $(OCTAVE_DIST_DIR)/bin/librefblas.dll echo " octave.bat..." cp $(TOP_DIR)/installer-files/octave.bat $(OCTAVE_DIST_DIR)/ + cp $(TOP_DIR)/installer-files/octave.vbs $(OCTAVE_DIST_DIR)/ endef else define copy-windows-dist-files diff -r fbc5d86517c9 -r 6daa158a7018 dist-files.mk --- a/dist-files.mk Sun Mar 01 19:05:38 2015 -0800 +++ b/dist-files.mk Mon Mar 02 19:14:41 2015 -0500 @@ -826,6 +826,7 @@ gpl-3.0.txt \ octave.bat \ octave.bmp \ + octave.vbs \ octave-hdr.bmp \ octave-logo.ico \ README.html diff -r fbc5d86517c9 -r 6daa158a7018 installer-files/octave.vbs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/installer-files/octave.vbs Mon Mar 02 19:14:41 2015 -0500 @@ -0,0 +1,39 @@ +' script to run octave in gui/command mode + +Set wshShell = CreateObject( "WScript.Shell" ) + +' get the directory that script resides in +Set fso = CreateObject("Scripting.FileSystemObject") +OctavePath = fso.GetParentFolderName(WScript.ScriptFullName) +Set fso = Nothing + +' set up path to ensure octave bin comes first +Set wshSystemEnv = wshShell.Environment( "PROCESS" ) +wshSystemEnv("PATH") = OctavePath & ";" & wshSystemEnv("PATH") + +' set terminal type +wshSystemEnv("TERM") = "cygwin" + +' check args to see if told to run gui or command line +' and build other args to use +GUI_MODE=1 +AllArgs = "" +Set wshArgs = WScript.Arguments +For I = 0 to wshArgs.Count - 1 + if wshArgs(I) = "--force-gui" then GUI_MODE=1 + if wshArgs(I) = "--no-gui" then GUI_MODE=0 + AllArgs = AllArgs & " " & chr(34) & wshArgs(I) & chr(34) +Next + +' start whatever octave we no want to run +If GUI_MODE = 1 then + wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 0 +Else + wshShell.Run chr(34) & OctavePath & "\bin\octave-cli.exe" & Chr(34) & AllArgs, 1 +End If + +' free our objects +Set wshShell = Nothing +Set wshSystemEnv = Nothing +Set wshArgs = Nothing + diff -r fbc5d86517c9 -r 6daa158a7018 makeinst-script.sh --- a/makeinst-script.sh Sun Mar 01 19:05:38 2015 -0800 +++ b/makeinst-script.sh Mon Mar 02 19:14:41 2015 -0500 @@ -41,7 +41,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.bat" +!define MAIN_APP_EXE "octave.vbs" !define INSTALL_TYPE "SetShellVarContext current" !define PRODUCT_ROOT_KEY "HKLM" !define PRODUCT_KEY "Software\\Octave-$VERSION" @@ -219,6 +219,7 @@ ; include the octave.bat file SetOutPath "\$INSTDIR" File "$OCTAVE_SOURCE/octave.bat" + File "$OCTAVE_SOURCE/octave.vbs" ; distro files EOF @@ -262,8 +263,8 @@ CreateDirectory "\$SMPROGRAMS\\Octave-$VERSION" CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0 SetOutPath "%USERPROFILE%" - CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (CLI).lnk" "\$INSTDIR\\octave.bat" "--no-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED - CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (GUI).lnk" "\$INSTDIR\\octave.bat" "--force-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED + CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (CLI).lnk" "\$INSTDIR\\octave.vbs" "--no-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED + CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (GUI).lnk" "\$INSTDIR\\octave.vbs" "--force-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED SetOutPath "\$INSTDIR" EOF # if we have documentation files, create shortcuts @@ -281,8 +282,8 @@ \${If} \$InstallShortcuts == \${BST_CHECKED} SetOutPath "%USERPROFILE%" - CreateShortCut "\$desktop\\Octave-$VERSION (CLI).lnk" "\$INSTDIR\\octave.bat" "--no-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED - CreateShortCut "\$desktop\\Octave-$VERSION (GUI).lnk" "\$INSTDIR\\octave.bat" "--force-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED + CreateShortCut "\$desktop\\Octave-$VERSION (CLI).lnk" "\$INSTDIR\\octave.vbs" "--no-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED + CreateShortCut "\$desktop\\Octave-$VERSION (GUI).lnk" "\$INSTDIR\\octave.vbs" "--force-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED \${Endif} ; BLAS set up